{"_id":"axway-flow-sdk","_rev":"170-2b544f19c3c5f361bc71bc52ffe9964c","name":"axway-flow-sdk","dist-tags":{"v4-next":"1.1.1-6","v4-preview1":"2.0.0-3","v4-preview2":"2.0.0-5","v4-preview3":"2.0.0-16","v3-latest":"1.2.13","latest":"3.4.3","next":"3.4.3"},"versions":{"1.0.0":{"name":"axway-flow-sdk","version":"1.0.0","author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENCE","_id":"axway-flow-sdk@1.0.0","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"c16732e0cd82989dc240a60b1824cc09581b9706","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-1.0.0.tgz","integrity":"sha512-6q9SkySrfpuFpO0LaIARCiaFNaLoEIQyyKEdUF1bkfvkqLUn0OZ7FW6R11af8fo0AstNgmFNv/k4Wp9rPQxlSA==","signatures":[{"sig":"MEUCIHOONRxNeXEUPxLJQl48+1isHQlo0REzNJYqe2A1Vj0MAiEA4uJv8Ud6Hdqn+DKZ+Ljwuf4jiY5eZALpvNY2QLHyqVY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"dist/index.js","_from":"axway-flow-sdk-1.0.0.tgz","files":["bin","dist","templates","README.md","LICENSE"],"_shasum":"c16732e0cd82989dc240a60b1824cc09581b9706","scripts":{"test":"rimraf coverage && rimraf .nyc-output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary node_modules/mocha/bin/mocha --require babel-register ./test --recursive -R spec","build":"npm run build:dev && npm run build:checkdeps && npm run security","clean":"rimraf dist/* coverage/*","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","security":"npm run security:retire && npm run security:nsp","build:dev":"npm run build:lint && npm run build:dist && npm run test","build:dist":"npm run build:readme && babel -d ./dist ./src","build:lint":"eslint .","test:watch":"rimraf coverage && rimraf .nyc-output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary node_modules/mocha/bin/mocha --require babel-register ./test --recursive -R spec --watch","release:npm":"curl -X GET http://registry.ecd.axway.int:8081/artifactory/local-npm/$npm_package_name/-/$npm_package_name-$npm_package_version.tgz 2>/dev/null > $npm_package_name-$npm_package_version.tgz && npm publish --registry  https://registry.npmjs.org ./$npm_package_name-$npm_package_version.tgz && rm ./$npm_package_name-$npm_package_version.tgz","build:readme":"node-readme && mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && rimraf README.hbs","security:nsp":"nsp check --output json > scan-nsp.json","release:major":"npm version major && npm run release:publish && git push --follow-tags","release:minor":"npm version minor && npm run release:publish && git push --follow-tags","release:patch":"npm version patch && npm run release:publish && git push --follow-tags","build:checkdeps":"dependency-check --no-dev --unused package.json && dependency-check package.json","release:publish":"git add -A && git push && git push --tags && npm publish","security:retire":"retire --exitwith 0 --package --outputformat json --outputpath scan-retire.json","release:prerelease":"npm version prerelease && npm run release:publish && git push --follow-tags"},"_npmUser":{"name":"axway","email":"gmatthews@axway.com"},"_resolved":"file:axway-flow-sdk-1.0.0.tgz","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/axway-flow-sdk","type":"git"},"_npmVersion":"4.5.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"7.9.0","dependencies":{"ajv":"^5.2.3","dot":"^1.1.2","nomnom":"^1.8.1","validate-npm-package-name":"^3.0.0"},"devDependencies":{"nsp":"^2.7.0","nyc":"^10.1.2","chai":"^3.5.0","mocha":"^3.4.2","eslint":"4.3.0","retire":"^1.3.3","rimraf":"^2.6.1","istanbul":"^1.1.0-alpha.1","babel-cli":"^6.24.1","cross-env":"^5.0.1","axway-flow":"^2.0.0","babel-core":"^6.25.0","node-readme":"^0.1.9","simple-mock":"^0.8.0","babel-eslint":"^7.2.3","eslint-loader":"^1.9.0","babel-istanbul":"^0.12.2","chai-as-promised":"^7.1.1","dependency-check":"^2.9.1","jsdoc-to-markdown":"^3.0.0","babel-preset-es2015":"^6.24.1","eslint-config-axway":"^2.0.3","eslint-plugin-mocha":"^4.11.0","eslint-plugin-react":"7.1.0","babel-preset-stage-2":"^6.24.1","eslint-plugin-import":"^2.7.0","eslint-plugin-jsx-a11y":"^5.1.1","eslint-config-axway-base":"^2.0.0-0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk-1.0.0.tgz_1510762657546_0.5981233362108469","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"axway-flow-sdk","version":"1.0.1","author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENCE","_id":"axway-flow-sdk@1.0.1","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"b597b3dced6de5bcbca902faea38e159990e59f2","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-1.0.1.tgz","integrity":"sha512-Gci3S7csP498mZ+qnws8Wdq9EKI08GHiVHCvYDKHyLAIRV85TxtZ5RrCMBMizuYz50zgoekk7eMVbGMcmXBkDw==","signatures":[{"sig":"MEUCIFcc2F+29mWID7Ysc8FNcYuc1ek94+JxyEY5byiLajWHAiEAuwVp8V7nQugH9IXM5eAhcIfScRVkMSzCXPnprGGBX9A=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"dist/index.js","_from":"axway-flow-sdk-1.0.1.tgz","files":["bin","dist","templates","README.md","LICENSE"],"_shasum":"b597b3dced6de5bcbca902faea38e159990e59f2","scripts":{"test":"rimraf coverage && rimraf .nyc-output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary node_modules/mocha/bin/mocha --require babel-register ./test --recursive -R spec","build":"npm run build:dev && npm run build:checkdeps && npm run security","clean":"rimraf dist/* coverage/*","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","security":"npm run security:retire && npm run security:nsp","build:dev":"npm run build:lint && npm run build:dist && npm run test","build:dist":"npm run build:readme && babel -d ./dist ./src","build:lint":"eslint .","test:watch":"rimraf coverage && rimraf .nyc-output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary node_modules/mocha/bin/mocha --require babel-register ./test --recursive -R spec --watch","release:npm":"curl -X GET http://registry.ecd.axway.int:8081/artifactory/local-npm/$npm_package_name/-/$npm_package_name-$npm_package_version.tgz 2>/dev/null > $npm_package_name-$npm_package_version.tgz && npm publish --registry  https://registry.npmjs.org ./$npm_package_name-$npm_package_version.tgz && rm ./$npm_package_name-$npm_package_version.tgz","build:readme":"node-readme && mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && rimraf README.hbs","security:nsp":"nsp check --output json > scan-nsp.json","release:major":"npm version major && npm run release:publish && git push --follow-tags","release:minor":"npm version minor && npm run release:publish && git push --follow-tags","release:patch":"npm version patch && npm run release:publish && git push --follow-tags","build:checkdeps":"dependency-check --no-dev --unused package.json && dependency-check package.json","release:publish":"git add -A && git push && git push --tags && npm publish","security:retire":"retire --exitwith 0 --package --outputformat json --outputpath scan-retire.json","release:prerelease":"npm version prerelease && npm run release:publish && git push --follow-tags"},"_npmUser":{"name":"axway","email":"gmatthews@axway.com"},"_resolved":"file:axway-flow-sdk-1.0.1.tgz","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/axway-flow-sdk","type":"git"},"_npmVersion":"2.15.9","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"4.5.0","dependencies":{"ajv":"^5.2.3","dot":"^1.1.2","nomnom":"^1.8.1","validate-npm-package-name":"^3.0.0"},"devDependencies":{"nsp":"^2.7.0","nyc":"^10.1.2","chai":"^3.5.0","mocha":"^3.4.2","eslint":"4.3.0","retire":"^1.3.3","rimraf":"^2.6.1","istanbul":"^1.1.0-alpha.1","babel-cli":"^6.24.1","cross-env":"^5.0.1","axway-flow":"^2.0.0","babel-core":"^6.25.0","node-readme":"^0.1.9","simple-mock":"^0.8.0","babel-eslint":"^7.2.3","eslint-loader":"^1.9.0","babel-istanbul":"^0.12.2","chai-as-promised":"^7.1.1","dependency-check":"^2.9.1","jsdoc-to-markdown":"^3.0.0","babel-preset-es2015":"^6.24.1","eslint-config-axway":"^2.0.3","eslint-plugin-mocha":"^4.11.0","eslint-plugin-react":"7.1.0","babel-preset-stage-2":"^6.24.1","eslint-plugin-import":"^2.7.0","eslint-plugin-jsx-a11y":"^5.1.1","eslint-config-axway-base":"^2.0.0-0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk-1.0.1.tgz_1510844331164_0.7981725505087525","host":"s3://npm-registry-packages"}},"1.0.3":{"name":"axway-flow-sdk","version":"1.0.3","author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENCE","_id":"axway-flow-sdk@1.0.3","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"2a7c412f2c8b976299487df056e16f5ee86c9d27","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-1.0.3.tgz","integrity":"sha512-fbo1UPxDD+XmsBZ52yPcVYeGjERZphONQY8BCDKhqjhQNICNq/ca+CM1ZY0j4PXp0AN7u6bNdkmIqtehJOhuIQ==","signatures":[{"sig":"MEYCIQCcZNU1FNQ3MwkhCtDQn8FX5qRFJT6iVpPsR43fvUuqVAIhAKZo+NNVUXHa87ohXj2BQ+A20QaYsCUpSSfY1/8ZVAMF","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"dist/index.js","_from":"axway-flow-sdk-1.0.3.tgz","files":["bin","dist","templates","README.md","LICENSE"],"_shasum":"2a7c412f2c8b976299487df056e16f5ee86c9d27","scripts":{"test":"rimraf coverage && rimraf .nyc-output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary node_modules/mocha/bin/mocha --require babel-register ./test --recursive -R spec","build":"npm run build:dev && npm run build:checkdeps && npm run security","clean":"rimraf dist/* coverage/*","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","security":"npm run security:retire && npm run security:nsp","build:dev":"npm run build:lint && npm run build:dist && npm run test","build:dist":"npm run build:readme && babel -d ./dist ./src","build:lint":"eslint .","test:watch":"rimraf coverage && rimraf .nyc-output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary node_modules/mocha/bin/mocha --require babel-register ./test --recursive -R spec --watch","release:npm":"curl -X GET http://registry.ecd.axway.int:8081/artifactory/local-npm/$npm_package_name/-/$npm_package_name-$npm_package_version.tgz 2>/dev/null > $npm_package_name-$npm_package_version.tgz && npm publish --registry  https://registry.npmjs.org ./$npm_package_name-$npm_package_version.tgz && rm ./$npm_package_name-$npm_package_version.tgz","build:readme":"node-readme && mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && rimraf README.hbs","security:nsp":"nsp check --output json > scan-nsp.json","release:major":"npm version major && npm run release:publish && git push --follow-tags","release:minor":"npm version minor && npm run release:publish && git push --follow-tags","release:patch":"npm version patch && npm run release:publish && git push --follow-tags","build:checkdeps":"dependency-check --no-dev --unused package.json && dependency-check package.json","release:publish":"git add -A && git push && git push --tags && npm publish","security:retire":"retire --exitwith 0 --package --outputformat json --outputpath scan-retire.json","release:prerelease":"npm version prerelease && npm run release:publish && git push --follow-tags"},"_npmUser":{"name":"axway","email":"gmatthews@axway.com"},"_resolved":"file:axway-flow-sdk-1.0.3.tgz","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/axway-flow-sdk","type":"git"},"_npmVersion":"4.5.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"7.9.0","dependencies":{"ajv":"^5.2.3","dot":"^1.1.2","nomnom":"^1.8.1","validate-npm-package-name":"^3.0.0"},"devDependencies":{"nsp":"^2.7.0","nyc":"^10.1.2","chai":"^3.5.0","mocha":"^3.4.2","eslint":"4.3.0","retire":"^1.3.3","rimraf":"^2.6.1","istanbul":"^1.1.0-alpha.1","babel-cli":"^6.24.1","cross-env":"^5.0.1","axway-flow":"^2.0.0","babel-core":"^6.25.0","node-readme":"^0.1.9","simple-mock":"^0.8.0","babel-eslint":"^7.2.3","eslint-loader":"^1.9.0","babel-istanbul":"^0.12.2","chai-as-promised":"^7.1.1","dependency-check":"^2.9.1","jsdoc-to-markdown":"^3.0.0","babel-preset-es2015":"^6.24.1","eslint-config-axway":"^2.0.3","eslint-plugin-mocha":"^4.11.0","eslint-plugin-react":"7.1.0","babel-preset-stage-2":"^6.24.1","eslint-plugin-import":"^2.7.0","eslint-plugin-jsx-a11y":"^5.1.1","eslint-config-axway-base":"^2.0.0-0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk-1.0.3.tgz_1510846768864_0.8115462914574891","host":"s3://npm-registry-packages"}},"1.0.4":{"name":"axway-flow-sdk","version":"1.0.4","author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENCE","_id":"axway-flow-sdk@1.0.4","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"e629f4b2d0599e03bd5d5452989a8bf27eadfa4f","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-1.0.4.tgz","integrity":"sha512-hdWiiVPKxPniL6pp7l9i1PhKUvzt5ixv3xAQbHWXHFJMVTXjngws2ajCPN6gyN6EeNe5P3tsCRwAFEoRFd2jZw==","signatures":[{"sig":"MEUCIQDskxs0jIjgs0eDdJKS7mp7xcy1OlEVSWCkpzBq2QuyCwIgFcOwSXAOBG49vbf3D8CVz5uWtPQAp2hyUijdy37XOsc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"dist/index.js","_from":"axway-flow-sdk-1.0.4.tgz","files":["bin","dist","templates","README.md","LICENSE"],"_shasum":"e629f4b2d0599e03bd5d5452989a8bf27eadfa4f","scripts":{"test":"rimraf coverage && rimraf .nyc-output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary node_modules/mocha/bin/mocha --require babel-register ./test --recursive -R spec","build":"npm run build:dev && npm run build:checkdeps && npm run security","clean":"rimraf dist/* coverage/*","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","security":"npm run security:retire && npm run security:nsp","build:dev":"npm run build:lint && npm run build:dist && npm run test","build:dist":"npm run build:readme && babel -d ./dist ./src","build:lint":"eslint .","test:watch":"rimraf coverage && rimraf .nyc-output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary node_modules/mocha/bin/mocha --require babel-register ./test --recursive -R spec --watch","release:npm":"curl -X GET http://registry.ecd.axway.int:8081/artifactory/local-npm/$npm_package_name/-/$npm_package_name-$npm_package_version.tgz 2>/dev/null > $npm_package_name-$npm_package_version.tgz && npm publish --registry  https://registry.npmjs.org ./$npm_package_name-$npm_package_version.tgz && rm ./$npm_package_name-$npm_package_version.tgz","build:readme":"node-readme && mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && rimraf README.hbs","security:nsp":"nsp check --output json > scan-nsp.json","release:major":"npm version major && npm run release:publish && git push --follow-tags","release:minor":"npm version minor && npm run release:publish && git push --follow-tags","release:patch":"npm version patch && npm run release:publish && git push --follow-tags","build:checkdeps":"dependency-check --no-dev --unused package.json && dependency-check package.json","release:publish":"git add -A && git push && git push --tags && npm publish","security:retire":"retire --exitwith 0 --package --outputformat json --outputpath scan-retire.json","release:prerelease":"npm version prerelease && npm run release:publish && git push --follow-tags"},"_npmUser":{"name":"axway","email":"gmatthews@axway.com"},"_resolved":"file:axway-flow-sdk-1.0.4.tgz","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/axway-flow-sdk","type":"git"},"_npmVersion":"4.5.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"7.9.0","dependencies":{"ajv":"^5.2.3","dot":"^1.1.2","nomnom":"^1.8.1","validate-npm-package-name":"^3.0.0"},"devDependencies":{"nsp":"^2.7.0","nyc":"^10.1.2","chai":"^3.5.0","mocha":"^3.4.2","eslint":"4.3.0","retire":"^1.3.3","rimraf":"^2.6.1","istanbul":"^1.1.0-alpha.1","babel-cli":"^6.24.1","cross-env":"^5.0.1","axway-flow":"^2.0.0","babel-core":"^6.25.0","node-readme":"^0.1.9","simple-mock":"^0.8.0","babel-eslint":"^7.2.3","eslint-loader":"^1.9.0","babel-istanbul":"^0.12.2","chai-as-promised":"^7.1.1","dependency-check":"^2.9.1","jsdoc-to-markdown":"^3.0.0","babel-preset-es2015":"^6.24.1","eslint-config-axway":"^2.0.3","eslint-plugin-mocha":"^4.11.0","eslint-plugin-react":"7.1.0","babel-preset-stage-2":"^6.24.1","eslint-plugin-import":"^2.7.0","eslint-plugin-jsx-a11y":"^5.1.1","eslint-config-axway-base":"^2.0.0-0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk-1.0.4.tgz_1510922168475_0.6428930598776788","host":"s3://npm-registry-packages"}},"1.1.0-101":{"name":"axway-flow-sdk","version":"1.1.0-101","keywords":["amplify","api-builder","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@1.1.0-101","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"5b0846c94b9d730348304625bc646b65efe93ad3","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-1.1.0-101.tgz","integrity":"sha512-4Rh6yItTY4cfTebQoqnZVOq6S2Vk3yoOh74G3X3BfT0LSonAMB5uvk6tLyWj9CAjKowtRUsaXR8k6DLdwWX2Fw==","signatures":[{"sig":"MEUCIC+hkn80DdYnE+zUJsWfzJRzKhPX/46b3zsBfoIXwVGmAiEAjFxfDDN10Aud5X/WV3leTjHmndcpKcI9Jg+yRwZ6nV8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"engines":{"node":">= 8"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"gmatthews@axway.com"},"deprecated":"Support for API Builder 3.x will cease on 30th April 2020. Use the v3 to v4 upgrade guide (https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder_v3_to_v4_upgrade_guide.html) to migrate all your applications to API Builder 4.x.","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"1.0.0-101","validate-npm-package-name":"^3.0.0"},"devDependencies":{"axway-flow":"2.1.0-101"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk-1.1.0-101.tgz_1517849246615_0.17545251408591866","host":"s3://npm-registry-packages"}},"1.1.0-102":{"name":"axway-flow-sdk","version":"1.1.0-102","keywords":["amplify","api-builder","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@1.1.0-102","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"56214c914aab92a2af86ab27eb31bcfabd1888ef","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-1.1.0-102.tgz","fileCount":16,"integrity":"sha512-8StjlY5FhEO0bMrkOzFP/O3GcuFcEF/VKYMtABCMWtQ7Z1u+uGewT8LJ4dqqQK7JfXGWb07Er1OUrpfseor1vw==","signatures":[{"sig":"MEQCIANoj9/wkwTTDEU0VN9mCkSArAfONBejz8doicKMHyRSAiBrkjMK9K7B3CYAhR9OdT/KhJidk6vL3n+XmoJ2fXJJ4Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":43444},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module)\n\t.add('encodeURI', {\n\t\tname: 'Encode URI',\n\t\ticon: 'encode.svg',\n\t\tdescription: 'URI encoder'\n\t})\n\t.method('encode', {\n\t\tname: 'Encode URI',\n\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t})\n\t.parameter('uri', {\n\t\ttype: 'string',\n\t\tdescription: 'The URI to encode.'\n\t})\n\t.output('encoded', {\n\t\tname: 'Encoded',\n\t\tdescription: 'The encoded URI.',\n\t\tcontext: '$.encodedURI',\n\t\tschema: {\n\t\t\ttype: 'string'\n\t\t}\n\t})\n\t.action((req, cb) => {\n\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t});\n```\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, options)](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, options) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| options | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis code is closed source and Confidential and Proprietary to Axway, Inc. All Rights Reserved. This code MUST not be modified, copied or otherwise redistributed without express written permission of Axway. This file is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement. Your right to use this software terminates when you terminate your Axway subscription.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"gmatthews@axway.com"},"deprecated":"Support for API Builder 3.x will cease on 30th April 2020. Use the v3 to v4 upgrade guide (https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder_v3_to_v4_upgrade_guide.html) to migrate all your applications to API Builder 4.x.","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"1.0.0-102","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"2.1.0-102"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_1.1.0-102_1518531182730_0.4336121002849229","host":"s3://npm-registry-packages"}},"1.1.0-103":{"name":"axway-flow-sdk","version":"1.1.0-103","keywords":["amplify","api-builder","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@1.1.0-103","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"f11995c529a6cb37ce0c44b2ce96b08ce60bf510","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-1.1.0-103.tgz","fileCount":16,"integrity":"sha512-qPnrlFl71vMqVhmis2YtdY/z2GuYm/b3ee2pgse8EwXwUpL/kPb8jV+q4XkU+41GN9HFQuc01m4epnKwGijJ6g==","signatures":[{"sig":"MEYCIQDPJ7HOsT6abWWKpUb6ThA7igq9/XtPjEqE0wG8nHGxUwIhAPbEZKY67/Ol29qGkl7pKoWKHiuBFIG6FlD/wrJJggAn","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":43444},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module)\n\t.add('encodeURI', {\n\t\tname: 'Encode URI',\n\t\ticon: 'encode.svg',\n\t\tdescription: 'URI encoder'\n\t})\n\t.method('encode', {\n\t\tname: 'Encode URI',\n\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t})\n\t.parameter('uri', {\n\t\ttype: 'string',\n\t\tdescription: 'The URI to encode.'\n\t})\n\t.output('encoded', {\n\t\tname: 'Encoded',\n\t\tdescription: 'The encoded URI.',\n\t\tcontext: '$.encodedURI',\n\t\tschema: {\n\t\t\ttype: 'string'\n\t\t}\n\t})\n\t.action((req, cb) => {\n\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t});\n```\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, options)](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, options) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| options | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis code is closed source and Confidential and Proprietary to Axway, Inc. All Rights Reserved. This code MUST not be modified, copied or otherwise redistributed without express written permission of Axway. This file is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement. Your right to use this software terminates when you terminate your Axway subscription.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"gmatthews@axway.com"},"deprecated":"Support for API Builder 3.x will cease on 30th April 2020. Use the v3 to v4 upgrade guide (https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder_v3_to_v4_upgrade_guide.html) to migrate all your applications to API Builder 4.x.","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"1.0.0-102","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"2.1.0-103"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_1.1.0-103_1519063282488_0.5113696978465636","host":"s3://npm-registry-packages"}},"1.1.0-104":{"name":"axway-flow-sdk","version":"1.1.0-104","keywords":["amplify","api-builder","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@1.1.0-104","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"671d30be22f129538df61585240797a362432924","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-1.1.0-104.tgz","fileCount":16,"integrity":"sha512-1qU0rfbR34WMxoXh6Yni/Ip33yB1vh7I9bqNahKDaQGz5m7PpazZDDI4+JtpX+ih7VSGb+DV+gN5lbNQpuie3g==","signatures":[{"sig":"MEUCID4JJ+M/T0W7n6V0PK3Gz7B3soe1qHvRNT1XRl50aWGPAiEAo9h5z8w9d5nkXwpkKpfzzZDmqehBqvH0ht6pXW0U38k=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":43444},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module)\n\t.add('encodeURI', {\n\t\tname: 'Encode URI',\n\t\ticon: 'encode.svg',\n\t\tdescription: 'URI encoder'\n\t})\n\t.method('encode', {\n\t\tname: 'Encode URI',\n\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t})\n\t.parameter('uri', {\n\t\ttype: 'string',\n\t\tdescription: 'The URI to encode.'\n\t})\n\t.output('encoded', {\n\t\tname: 'Encoded',\n\t\tdescription: 'The encoded URI.',\n\t\tcontext: '$.encodedURI',\n\t\tschema: {\n\t\t\ttype: 'string'\n\t\t}\n\t})\n\t.action((req, cb) => {\n\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t});\n```\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, options)](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, options) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| options | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis code is closed source and Confidential and Proprietary to Axway, Inc. All Rights Reserved. This code MUST not be modified, copied or otherwise redistributed without express written permission of Axway. This file is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement. Your right to use this software terminates when you terminate your Axway subscription.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"gmatthews@axway.com"},"deprecated":"Support","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"1.0.0-102","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"2.1.0-104"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_1.1.0-104_1519225918194_0.5064684067668377","host":"s3://npm-registry-packages"}},"1.1.0-105":{"name":"axway-flow-sdk","version":"1.1.0-105","keywords":["amplify","api-builder","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@1.1.0-105","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"b52ceb62773dfc7f94b7fe667651a4e4c197f4ee","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-1.1.0-105.tgz","fileCount":16,"integrity":"sha512-JgAgZHo8jpKPPmDSjrDgP5JnLfb9Zpu/I50ArJtaG7CxG9b/y8SiBQcpRc7ckZrqj23Pda8J6If0ygQoJhzITw==","signatures":[{"sig":"MEYCIQCejFN/EmE9m3ipfiGAMc5cFF8hfHcTqlsb5DVZbe+X4gIhALYaPQxqvsmeRVOZI8VjrSm8NbpgNCkoCA/16ZD7SXAv","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":43444},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module)\n\t.add('encodeURI', {\n\t\tname: 'Encode URI',\n\t\ticon: 'encode.svg',\n\t\tdescription: 'URI encoder'\n\t})\n\t.method('encode', {\n\t\tname: 'Encode URI',\n\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t})\n\t.parameter('uri', {\n\t\ttype: 'string',\n\t\tdescription: 'The URI to encode.'\n\t})\n\t.output('encoded', {\n\t\tname: 'Encoded',\n\t\tdescription: 'The encoded URI.',\n\t\tcontext: '$.encodedURI',\n\t\tschema: {\n\t\t\ttype: 'string'\n\t\t}\n\t})\n\t.action((req, cb) => {\n\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t});\n```\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, options)](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, options) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| options | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis code is closed source and Confidential and Proprietary to Axway, Inc. All Rights Reserved. This code MUST not be modified, copied or otherwise redistributed without express written permission of Axway. This file is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement. Your right to use this software terminates when you terminate your Axway subscription.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"gmatthews@axway.com"},"deprecated":"Support for API Builder 3.x will cease on 30th April 2020. Use the v3 to v4 upgrade guide (https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder_v3_to_v4_upgrade_guide.html) to migrate all your applications to API Builder 4.x.","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"1.0.0-102","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"2.1.0-105"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_1.1.0-105_1519248535908_0.3852045575007699","host":"s3://npm-registry-packages"}},"1.1.0-106":{"name":"axway-flow-sdk","version":"1.1.0-106","keywords":["amplify","api-builder","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@1.1.0-106","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"49206f11e2d04b459b385031f260d949d1a3ef3e","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-1.1.0-106.tgz","fileCount":16,"integrity":"sha512-+3HUMjstqwqtqpJVwAvYOVPZEi1QaxZtEWMNWD3aA5Rrszs4nAHO1N2xgI9okKHSF4vHq4lNrPgNyBRXk03g1g==","signatures":[{"sig":"MEUCIQCjIpcWc/4Fq+n0Y4UDgoZGgbefAW/Qi6XV/TBLE87jsQIgRtld+xOvKnRtlpp4i8kAPqbWpK/J6F9HRWd6MX7UQpE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":43479},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module)\n\t.add('encodeURI', {\n\t\tname: 'Encode URI',\n\t\ticon: 'encode.svg',\n\t\tdescription: 'URI encoder'\n\t})\n\t.method('encode', {\n\t\tname: 'Encode URI',\n\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t})\n\t.parameter('uri', {\n\t\ttype: 'string',\n\t\tdescription: 'The URI to encode.'\n\t})\n\t.output('encoded', {\n\t\tname: 'Encoded',\n\t\tdescription: 'The encoded URI.',\n\t\tcontext: '$.encodedURI',\n\t\tschema: {\n\t\t\ttype: 'string'\n\t\t}\n\t})\n\t.action((req, cb) => {\n\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t});\n```\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, options)](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, options) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| options | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis code is closed source and Confidential and Proprietary to Axway, Inc. All Rights Reserved. This code MUST not be modified, copied or otherwise redistributed without express written permission of Axway. This file is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement. Your right to use this software terminates when you terminate your Axway subscription.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"gmatthews@axway.com"},"deprecated":"Support","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"1.0.0-102","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"2.1.0-106"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_1.1.0-106_1519274300433_0.3212646401118531","host":"s3://npm-registry-packages"}},"1.1.0-107":{"name":"axway-flow-sdk","version":"1.1.0-107","keywords":["amplify","api-builder","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@1.1.0-107","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"8499024a8a45e1c9e91748bd43c2cfcc0fc78977","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-1.1.0-107.tgz","fileCount":16,"integrity":"sha512-dIjgg2zLw3CZr3xL8iDMtBJkH+8kBelVrv7le4QLuHSgBOLGKP6NXX5LYsvUcFOaiN6aqFPRdczi4gIN+2MVrQ==","signatures":[{"sig":"MEQCIEV8Ld6ysNHySUmoIwlVCRtZQbVGQh6PAKcLy2vv72mAAiAK9OsCMW8Alt6zxmvlp9O1/sfoRM3+XjpxquvZG18fqQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":43475},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module)\n\t.add('encodeURI', {\n\t\tname: 'Encode URI',\n\t\ticon: 'encode.svg',\n\t\tdescription: 'URI encoder'\n\t})\n\t.method('encode', {\n\t\tname: 'Encode URI',\n\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t})\n\t.parameter('uri', {\n\t\ttype: 'string',\n\t\tdescription: 'The URI to encode.'\n\t})\n\t.output('encoded', {\n\t\tname: 'Encoded',\n\t\tdescription: 'The encoded URI.',\n\t\tcontext: '$.encodedURI',\n\t\tschema: {\n\t\t\ttype: 'string'\n\t\t}\n\t})\n\t.action((req, cb) => {\n\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t});\n```\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, options)](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, options) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| options | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis code is closed source and Confidential and Proprietary to Axway, Inc. All Rights Reserved. This code MUST not be modified, copied or otherwise redistributed without express written permission of Axway. This file is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement. Your right to use this software terminates when you terminate your Axway subscription.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"gmatthews@axway.com"},"deprecated":"Support for API Builder 3.x will cease on 30th April 2020. Use the v3 to v4 upgrade guide (https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder_v3_to_v4_upgrade_guide.html) to migrate all your applications to API Builder 4.x.","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"1.0.0-102","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"2.1.0-106"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_1.1.0-107_1519293090074_0.9993341165810299","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"axway-flow-sdk","version":"1.1.0","keywords":["amplify","api-builder","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@1.1.0","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"9898d780342ad1969bdf385c342ff7d6972c8504","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-1.1.0.tgz","fileCount":16,"integrity":"sha512-Rd505kDZaGrLctNBgQVE6t3ETNFR0ItjPr07KQzuQg/YDvmHQjU5F30ala0xp6LwgT5yQJXEBGynS51oKK2vOQ==","signatures":[{"sig":"MEUCIQD+tr6UwT0yi9nUi1KQawFHmZ3hheycesGcbUrKy7v3AwIgVXp7uvsLdE/foqntN1w1z3zhzj+NKPEGB2WkOJCcv1U=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":43465},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"gmatthews@axway.com"},"deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"^1.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"devDependencies":{"axway-flow":"^2.1.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_1.1.0_1519323956941_0.6955362001517924","host":"s3://npm-registry-packages"}},"1.1.1-0":{"name":"axway-flow-sdk","version":"1.1.1-0","keywords":["amplify","api-builder","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@1.1.1-0","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"013279b19b8235552086d68b5b321033638e24c4","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-1.1.1-0.tgz","fileCount":16,"integrity":"sha512-RW6HZ5k0jcDsdwlkLNOxqFkoDFFZmiYPyk4YLfxVz/qo8LFc5Ggmf3cBkm/NNgM534LW0geRZUSmvNoyH621ZQ==","signatures":[{"sig":"MEUCIQC6CmNv8s7a2rJN3r/ZHuRBhN60xatYT8K8SrXnOxgArAIgV8Pqb9oY5TM3J6If3xkqe2nK4IaRrk2blskJay7ewlc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":43467},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module)\n\t.add('encodeURI', {\n\t\tname: 'Encode URI',\n\t\ticon: 'encode.svg',\n\t\tdescription: 'URI encoder'\n\t})\n\t.method('encode', {\n\t\tname: 'Encode URI',\n\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t})\n\t.parameter('uri', {\n\t\ttype: 'string',\n\t\tdescription: 'The URI to encode.'\n\t})\n\t.output('encoded', {\n\t\tname: 'Encoded',\n\t\tdescription: 'The encoded URI.',\n\t\tcontext: '$.encodedURI',\n\t\tschema: {\n\t\t\ttype: 'string'\n\t\t}\n\t})\n\t.action((req, cb) => {\n\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t});\n```\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, options)](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, options) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| options | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis code is closed source and Confidential and Proprietary to Axway, Inc. All Rights Reserved. This code MUST not be modified, copied or otherwise redistributed without express written permission of Axway. This file is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement. Your right to use this software terminates when you terminate your Axway subscription.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"gmatthews@axway.com"},"deprecated":"Support","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"^1.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"^2.1.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_1.1.1-0_1519823115210_0.6734016336909383","host":"s3://npm-registry-packages"}},"1.1.1-2":{"name":"axway-flow-sdk","version":"1.1.1-2","keywords":["amplify","api-builder","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@1.1.1-2","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"0f5a11b7cd5dfe38381b875a76744e2c45ec0dc6","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-1.1.1-2.tgz","fileCount":16,"integrity":"sha512-DF+iEeJHWb3rXLnsOm2QeFeNdnFIJiu1YFn8q7sRJYQuW+JYZQ1zVUsVZfZKVYDERILU2j346UwAFo3x3zqH1Q==","signatures":[{"sig":"MEQCH1T/w3aap+RNfLHixxkriu3cKz5NHcri3Ic35d5C3NACIQD5tfkkN8Z1XzjgjOu9iyoBN9QbYioDh7snaKnBYbIjtQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":43467},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module)\n\t.add('encodeURI', {\n\t\tname: 'Encode URI',\n\t\ticon: 'encode.svg',\n\t\tdescription: 'URI encoder'\n\t})\n\t.method('encode', {\n\t\tname: 'Encode URI',\n\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t})\n\t.parameter('uri', {\n\t\ttype: 'string',\n\t\tdescription: 'The URI to encode.'\n\t})\n\t.output('encoded', {\n\t\tname: 'Encoded',\n\t\tdescription: 'The encoded URI.',\n\t\tcontext: '$.encodedURI',\n\t\tschema: {\n\t\t\ttype: 'string'\n\t\t}\n\t})\n\t.action((req, cb) => {\n\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t});\n```\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, options)](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, options) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| options | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis code is closed source and Confidential and Proprietary to Axway, Inc. All Rights Reserved. This code MUST not be modified, copied or otherwise redistributed without express written permission of Axway. This file is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement. Your right to use this software terminates when you terminate your Axway subscription.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"gmatthews@axway.com"},"deprecated":"Support for API Builder 3.x will cease on 30th April 2020. Use the v3 to v4 upgrade guide (https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder_v3_to_v4_upgrade_guide.html) to migrate all your applications to API Builder 4.x.","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"^1.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"^2.1.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_1.1.1-2_1519851589505_0.2588073955279042","host":"s3://npm-registry-packages"}},"1.1.1-3":{"name":"axway-flow-sdk","version":"1.1.1-3","keywords":["amplify","api-builder","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@1.1.1-3","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"6f101912c6f6adecdc49352b9211c3a24ddb96ee","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-1.1.1-3.tgz","fileCount":16,"integrity":"sha512-wt6r5bC3uI3nh82/jMRMMT3KvYwj9E+gUXDecnFPampXFGpEG6ubS8QkXk7pgWFCjfZQmDypuQuFM/Y4rWwVmw==","signatures":[{"sig":"MEYCIQCBRaqnxh7DfbSVj5rR+vMHlLUuUVncgGHZ6u8cJFMfewIhAP6zZ5qSg0fX1DDRypLOXhYdzGXwmiRgP+xXEvRYCsc3","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":43478},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module)\n\t.add('encodeURI', {\n\t\tname: 'Encode URI',\n\t\ticon: 'encode.svg',\n\t\tdescription: 'URI encoder'\n\t})\n\t.method('encode', {\n\t\tname: 'Encode URI',\n\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t})\n\t.parameter('uri', {\n\t\ttype: 'string',\n\t\tdescription: 'The URI to encode.'\n\t})\n\t.output('encoded', {\n\t\tname: 'Encoded',\n\t\tdescription: 'The encoded URI.',\n\t\tcontext: '$.encodedURI',\n\t\tschema: {\n\t\t\ttype: 'string'\n\t\t}\n\t})\n\t.action((req, cb) => {\n\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t});\n```\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, options)](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, options) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| options | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis code is closed source and Confidential and Proprietary to Axway, Inc. All Rights Reserved. This code MUST not be modified, copied or otherwise redistributed without express written permission of Axway. This file is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement. Your right to use this software terminates when you terminate your Axway subscription.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"gmatthews@axway.com"},"deprecated":"Support","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"1.0.1-0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"^2.1.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_1.1.1-3_1521554027725_0.4718351042235285","host":"s3://npm-registry-packages"}},"1.1.1-4":{"name":"axway-flow-sdk","version":"1.1.1-4","keywords":["amplify","api-builder","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@1.1.1-4","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"48aaab9cc4abfc1109d7ab5f39d244e8213ee9a2","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-1.1.1-4.tgz","fileCount":16,"integrity":"sha512-o74H0fQL1ALSvp4rtjGavENaBdbz174cuHwPTUBEAUSCPzQaNWhPdty0aPjy2of/0nqevxjw9/UvwYIq4T7vlA==","signatures":[{"sig":"MEYCIQCVUtFYjIAhCiqv8mBafUgfTPCE+rFcGqBfhLwD063B5gIhAKBGopMa55q9pjlDo7m5uc5aQ+7QgFkh38DvCbzLZUh0","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":43478},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module)\n\t.add('encodeURI', {\n\t\tname: 'Encode URI',\n\t\ticon: 'encode.svg',\n\t\tdescription: 'URI encoder'\n\t})\n\t.method('encode', {\n\t\tname: 'Encode URI',\n\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t})\n\t.parameter('uri', {\n\t\ttype: 'string',\n\t\tdescription: 'The URI to encode.'\n\t})\n\t.output('encoded', {\n\t\tname: 'Encoded',\n\t\tdescription: 'The encoded URI.',\n\t\tcontext: '$.encodedURI',\n\t\tschema: {\n\t\t\ttype: 'string'\n\t\t}\n\t})\n\t.action((req, cb) => {\n\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t});\n```\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, options)](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, options) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| options | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis code is closed source and Confidential and Proprietary to Axway, Inc. All Rights Reserved. This code MUST not be modified, copied or otherwise redistributed without express written permission of Axway. This file is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement. Your right to use this software terminates when you terminate your Axway subscription.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"gmatthews@axway.com"},"deprecated":"Support for API Builder 3.x will cease on 30th April 2020. Use the v3 to v4 upgrade guide (https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder_v3_to_v4_upgrade_guide.html) to migrate all your applications to API Builder 4.x.","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"1.0.1-0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"^2.1.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_1.1.1-4_1521635847299_0.6111358110011871","host":"s3://npm-registry-packages"}},"1.1.1-5":{"name":"axway-flow-sdk","version":"1.1.1-5","keywords":["amplify","api-builder","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@1.1.1-5","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"17742494a6c0bd2281456f396d2ff50c85c80c32","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-1.1.1-5.tgz","fileCount":16,"integrity":"sha512-ZmH2YEF0M5yL1nisquNVKUWWDqdNmrnE8Fj7SM8ReswdlT2PbRP5uMT/6P/HpQaL/41cOd0bYf9XnJgUA3uZpg==","signatures":[{"sig":"MEQCIE1eZITeEP0XlcXYrAkl5Jdk1ZWyr4KHq8eZCVgvacePAiAFwAOd5+CST9CJ923AtLwm4/KmGzA7667O8YKzjicCug==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":43480},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module)\n\t.add('encodeURI', {\n\t\tname: 'Encode URI',\n\t\ticon: 'encode.svg',\n\t\tdescription: 'URI encoder'\n\t})\n\t.method('encode', {\n\t\tname: 'Encode URI',\n\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t})\n\t.parameter('uri', {\n\t\ttype: 'string',\n\t\tdescription: 'The URI to encode.'\n\t})\n\t.output('encoded', {\n\t\tname: 'Encoded',\n\t\tdescription: 'The encoded URI.',\n\t\tcontext: '$.encodedURI',\n\t\tschema: {\n\t\t\ttype: 'string'\n\t\t}\n\t})\n\t.action((req, cb) => {\n\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t});\n```\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, options)](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, options) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| options | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis code is closed source and Confidential and Proprietary to Axway, Inc. All Rights Reserved. This code MUST not be modified, copied or otherwise redistributed without express written permission of Axway. This file is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement. Your right to use this software terminates when you terminate your Axway subscription.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"gmatthews@axway.com"},"deprecated":"Support","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"1.0.1-0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"^2.2.0-2"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_1.1.1-5_1521841656659_0.0827245939742125","host":"s3://npm-registry-packages"}},"1.1.1-6":{"name":"axway-flow-sdk","version":"1.1.1-6","keywords":["amplify","api-builder","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@1.1.1-6","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"04bf3373c50d572fa4cbaa152dd84addd6700df6","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-1.1.1-6.tgz","fileCount":16,"integrity":"sha512-01J+n08W7hZ9Y0Fb+44jstfCPg0244bz8pkREVc7M5caEdHr6zKgMD21TsV5VDecppkYruA1nHK4Kg1FxY5LHA==","signatures":[{"sig":"MEQCIC9yA3HnDFXWXoT3Fkr69jrjroC9Ma1tkho2DBrgJllwAiBQCk7QRsiGkv+U70wlAzJG9aLMynBfAgpVTvF28YYYWw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":43479},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module)\n\t.add('encodeURI', {\n\t\tname: 'Encode URI',\n\t\ticon: 'encode.svg',\n\t\tdescription: 'URI encoder'\n\t})\n\t.method('encode', {\n\t\tname: 'Encode URI',\n\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t})\n\t.parameter('uri', {\n\t\ttype: 'string',\n\t\tdescription: 'The URI to encode.'\n\t})\n\t.output('encoded', {\n\t\tname: 'Encoded',\n\t\tdescription: 'The encoded URI.',\n\t\tcontext: '$.encodedURI',\n\t\tschema: {\n\t\t\ttype: 'string'\n\t\t}\n\t})\n\t.action((req, cb) => {\n\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t});\n```\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, options)](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, options) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| options | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis code is closed source and Confidential and Proprietary to Axway, Inc. All Rights Reserved. This code MUST not be modified, copied or otherwise redistributed without express written permission of Axway. This file is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement. Your right to use this software terminates when you terminate your Axway subscription.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"gmatthews@axway.com"},"deprecated":"Support for API Builder 3.x will cease on 30th April 2020. Use the v3 to v4 upgrade guide (https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder_v3_to_v4_upgrade_guide.html) to migrate all your applications to API Builder 4.x.","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"1.0.1-0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"2.2.0-3"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_1.1.1-6_1522157643060_0.48320328359633846","host":"s3://npm-registry-packages"}},"1.1.1-7":{"name":"axway-flow-sdk","version":"1.1.1-7","keywords":["amplify","api-builder","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@1.1.1-7","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"4ec63e445e7da4820838b86aff6165f4cff623cc","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-1.1.1-7.tgz","fileCount":16,"integrity":"sha512-dOIK0Q0r5zovYxdlr2hzt+QWi4Wfp6VvMAGXyXlJ5jgHQDgGuk9nxmbBKFMfKMQUBQh0Y04A/gQ/ggvMvLu9gA==","signatures":[{"sig":"MEUCIQDSxVsGJMcR+iT09qahyg/QeKhkRLXEo2Kvgke2CB2DTgIgHh2CGVina0TEYtuFsXYpdabJLUB9J2UvDH6pu4iLB+U=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":43484},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module)\n\t.add('encodeURI', {\n\t\tname: 'Encode URI',\n\t\ticon: 'encode.svg',\n\t\tdescription: 'URI encoder'\n\t})\n\t.method('encode', {\n\t\tname: 'Encode URI',\n\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t})\n\t.parameter('uri', {\n\t\ttype: 'string',\n\t\tdescription: 'The URI to encode.'\n\t})\n\t.output('encoded', {\n\t\tname: 'Encoded',\n\t\tdescription: 'The encoded URI.',\n\t\tcontext: '$.encodedURI',\n\t\tschema: {\n\t\t\ttype: 'string'\n\t\t}\n\t})\n\t.action((req, cb) => {\n\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t});\n```\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, options)](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, options) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| options | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis code is closed source and Confidential and Proprietary to Axway, Inc. All Rights Reserved. This code MUST not be modified, copied or otherwise redistributed without express written permission of Axway. This file is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement. Your right to use this software terminates when you terminate your Axway subscription.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"gmatthews@axway.com"},"deprecated":"Support","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"1.0.1-0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"2.2.0-3"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_1.1.1-7_1523455255480_0.7440969918611757","host":"s3://npm-registry-packages"}},"1.1.1-8":{"name":"axway-flow-sdk","version":"1.1.1-8","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@1.1.1-8","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"5e32b249c7e9c1f276e61930bd82a1ee50f4d587","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-1.1.1-8.tgz","fileCount":16,"integrity":"sha512-HgvEqkXBp6nbbY8i7myLNsG+dxztgLTmD9aPTtGLJhs+wuu6AdHq+nyfeek3Y2TBGAZPK/ORjK4SOjQJVv8+Vw==","signatures":[{"sig":"MEQCIHwnSMJ9lekOVdRhWagfk5XjyO7S7680wllrWXc6KUdhAiAK+BmwHG/kfSZV1bmmHPbpAZkZi2OWhuWBBmrPf81uug==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":43495},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module)\n\t.add('encodeURI', {\n\t\tname: 'Encode URI',\n\t\ticon: 'encode.svg',\n\t\tdescription: 'URI encoder'\n\t})\n\t.method('encode', {\n\t\tname: 'Encode URI',\n\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t})\n\t.parameter('uri', {\n\t\ttype: 'string',\n\t\tdescription: 'The URI to encode.'\n\t})\n\t.output('encoded', {\n\t\tname: 'Encoded',\n\t\tdescription: 'The encoded URI.',\n\t\tcontext: '$.encodedURI',\n\t\tschema: {\n\t\t\ttype: 'string'\n\t\t}\n\t})\n\t.action((req, cb) => {\n\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t});\n```\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, options)](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, options) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| options | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis code is closed source and Confidential and Proprietary to Axway, Inc. All Rights Reserved. This code MUST not be modified, copied or otherwise redistributed without express written permission of Axway. This file is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement. Your right to use this software terminates when you terminate your Axway subscription.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"gmatthews@axway.com"},"deprecated":"Support for API Builder 3.x will cease on 30th April 2020. Use the v3 to v4 upgrade guide (https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder_v3_to_v4_upgrade_guide.html) to migrate all your applications to API Builder 4.x.","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"1.0.1-1","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"2.2.0-4"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_1.1.1-8_1523458265075_0.509125576126265","host":"s3://npm-registry-packages"}},"2.0.0-1":{"name":"axway-flow-sdk","version":"2.0.0-1","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.0-1","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"2deff9c7666c85ac4e2ca44e8b4cf878976509f0","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.0-1.tgz","fileCount":16,"integrity":"sha512-fIiGo/I7nF5x9ERlWEBBNrRyfDAB6Anphs/5Lk8e5oSxxx4dJ0mJTzPYS7FiDsrzfc2mDpqAK6oaObEHTQRJPg==","signatures":[{"sig":"MEUCIH5iTed6Goj6wMkqB+uRCKROkUEe8bGlP6HUO96Tmz1eAiEAv+6ZTMekc/bZbS7qIW91rPqoih1/N2EUR77uVT+zq70=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":43495},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module)\n\t.add('encodeURI', {\n\t\tname: 'Encode URI',\n\t\ticon: 'encode.svg',\n\t\tdescription: 'URI encoder'\n\t})\n\t.method('encode', {\n\t\tname: 'Encode URI',\n\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t})\n\t.parameter('uri', {\n\t\ttype: 'string',\n\t\tdescription: 'The URI to encode.'\n\t})\n\t.output('encoded', {\n\t\tname: 'Encoded',\n\t\tdescription: 'The encoded URI.',\n\t\tcontext: '$.encodedURI',\n\t\tschema: {\n\t\t\ttype: 'string'\n\t\t}\n\t})\n\t.action((req, cb) => {\n\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t});\n```\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, options)](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, options) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| options | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis code is closed source and Confidential and Proprietary to Axway, Inc. All Rights Reserved. This code MUST not be modified, copied or otherwise redistributed without express written permission of Axway. This file is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement. Your right to use this software terminates when you terminate your Axway subscription.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"gmatthews@axway.com"},"repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"2.0.0-1","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"3.0.0-1"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.0-1_1523531986732_0.2030104871783811","host":"s3://npm-registry-packages"}},"2.0.0-2":{"name":"axway-flow-sdk","version":"2.0.0-2","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.0-2","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"a8b5fec60264b4f6321a23d81a66c7db35183532","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.0-2.tgz","fileCount":16,"integrity":"sha512-nKPPIKF12irUCYnZwgu6EmEnqD+U29+BNE4NWOB0Rj6Mh9UBO/7VDzEXrojfBCHW7IOFDP/tt/10AbDV3bnxTw==","signatures":[{"sig":"MEUCIQDUUjdtzyfkXpbyaFQWN6xzXRYAByUGbwHiVY56in2NfwIgWxVTUlpsS4mOJXw0H8gHfbSHjuGV6TGZLvOohaFgw94=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":43495},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module)\n\t.add('encodeURI', {\n\t\tname: 'Encode URI',\n\t\ticon: 'encode.svg',\n\t\tdescription: 'URI encoder'\n\t})\n\t.method('encode', {\n\t\tname: 'Encode URI',\n\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t})\n\t.parameter('uri', {\n\t\ttype: 'string',\n\t\tdescription: 'The URI to encode.'\n\t})\n\t.output('encoded', {\n\t\tname: 'Encoded',\n\t\tdescription: 'The encoded URI.',\n\t\tcontext: '$.encodedURI',\n\t\tschema: {\n\t\t\ttype: 'string'\n\t\t}\n\t})\n\t.action((req, cb) => {\n\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t});\n```\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, options)](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, options) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| options | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis code is closed source and Confidential and Proprietary to Axway, Inc. All Rights Reserved. This code MUST not be modified, copied or otherwise redistributed without express written permission of Axway. This file is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement. Your right to use this software terminates when you terminate your Axway subscription.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"gmatthews@axway.com"},"repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"2.0.0-1","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"3.0.0-1"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.0-2_1523623705876_0.10009869303931929","host":"s3://npm-registry-packages"}},"2.0.0-3":{"name":"axway-flow-sdk","version":"2.0.0-3","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.0-3","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"05cf65717ebf7605a108ad34a89c193e58b9b772","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.0-3.tgz","fileCount":16,"integrity":"sha512-Cfj4UDMOq/7c2IQeEQIA/b4Bp3lKBd0s6qUxIkWCpOmmUa9VsC70xCuNMokHYrln466unlVWQcBf4K30Tkaeyw==","signatures":[{"sig":"MEYCIQDT4CG9B1VOaTmVYnlBZ5CyOyLqy4oZiQqjzgpLDGX6MgIhAJVNA2fpqWp1QXoPNHhbKoivZCBs5Me9S1N/z9jWZETH","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":43495},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module)\n\t.add('encodeURI', {\n\t\tname: 'Encode URI',\n\t\ticon: 'encode.svg',\n\t\tdescription: 'URI encoder'\n\t})\n\t.method('encode', {\n\t\tname: 'Encode URI',\n\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t})\n\t.parameter('uri', {\n\t\ttype: 'string',\n\t\tdescription: 'The URI to encode.'\n\t})\n\t.output('encoded', {\n\t\tname: 'Encoded',\n\t\tdescription: 'The encoded URI.',\n\t\tcontext: '$.encodedURI',\n\t\tschema: {\n\t\t\ttype: 'string'\n\t\t}\n\t})\n\t.action((req, cb) => {\n\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t});\n```\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, options)](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, options) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| options | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis code is closed source and Confidential and Proprietary to Axway, Inc. All Rights Reserved. This code MUST not be modified, copied or otherwise redistributed without express written permission of Axway. This file is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement. Your right to use this software terminates when you terminate your Axway subscription.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"gmatthews@axway.com"},"repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"2.0.0-1","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"3.0.0-1"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.0-3_1523633407337_0.12741433446185702","host":"s3://npm-registry-packages"}},"2.0.0-4":{"name":"axway-flow-sdk","version":"2.0.0-4","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.0-4","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"a25cdf1d7a7915146783802994a6719b0440c059","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.0-4.tgz","fileCount":16,"integrity":"sha512-4zfc3i+6PMn+H6zvHrTeSAVSgvhQiB58AN/yyobwsPy9kTjdnz7co0Wc04FhbXkr628pMFgB2C54WbofxcBGgQ==","signatures":[{"sig":"MEUCIBVLYZsTqvZZS7IQBZsK8BYH5c412u4T1iuGxvP0k3nGAiEAtBLpn63/9JAkD/q2esQHCv/7e7A9pY7v7HximS7ZlX4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":43495},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module)\n\t.add('encodeURI', {\n\t\tname: 'Encode URI',\n\t\ticon: 'encode.svg',\n\t\tdescription: 'URI encoder'\n\t})\n\t.method('encode', {\n\t\tname: 'Encode URI',\n\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t})\n\t.parameter('uri', {\n\t\ttype: 'string',\n\t\tdescription: 'The URI to encode.'\n\t})\n\t.output('encoded', {\n\t\tname: 'Encoded',\n\t\tdescription: 'The encoded URI.',\n\t\tcontext: '$.encodedURI',\n\t\tschema: {\n\t\t\ttype: 'string'\n\t\t}\n\t})\n\t.action((req, cb) => {\n\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t});\n```\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, options)](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, options) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| options | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis code is closed source and Confidential and Proprietary to Axway, Inc. All Rights Reserved. This code MUST not be modified, copied or otherwise redistributed without express written permission of Axway. This file is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement. Your right to use this software terminates when you terminate your Axway subscription.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"gmatthews@axway.com"},"repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"2.0.0-1","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"3.0.0-1"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.0-4_1523635027827_0.18122844848798025","host":"s3://npm-registry-packages"}},"2.0.0-5":{"name":"axway-flow-sdk","version":"2.0.0-5","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.0-5","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"4d8b19a32dc1f4993c12d89cfc91dc6720e40c40","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.0-5.tgz","fileCount":16,"integrity":"sha512-kKhsyx8XYx5hkwQfY5h03A5+fuxrZbF7DOalxX7QwKVjOEfpct4+6MU8o6jR76xayD4wnQAPyQgCPadSVuz5ZA==","signatures":[{"sig":"MEUCIAVvfDeKxLzeKzsB4BiQrgAFtdV0223y/jLHCp5isaUFAiEAtXp5EzPdtOYYZkdJTPfQ11Q21zyb912IHpWQTYxjksc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":43495,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa4LH9CRA9TVsSAnZWagAAEYkP/jglM0vYCsBioWWZ/FGn\nxojmfnhapju3yX975CY+HH7NuzxgyAiDeTayogn5L7jGbidENm/iqyULpOwH\nGqqeRGTlfRFvfXrvaxctXpYfZ4pyhb7/M75jfsRrFTRes3Gfewq04VgPs4vD\niOLqFL5ooIwdCSExVhnPkCIK7HXIVsqPKQzzFM3+pJQVVJQVhR1+QRoX90Id\nDsOpfkmgXlGuTzFROdMQy+rObK9/yzNllfvMP+Ah+61BQtAJk7xPfTDXw5Zv\n6gt5K7BY73F3MfKi/H9v974WGkKAGRJY7PN2iUMrWly/pdvGqWQOiqfX3/Nt\nS+A8KkBOMGCgiTtV73YpY7iiIOL0C/Wjj3TuVN8uvUHQBWAbuwzadubK2LAv\n3pLl/7URxqpjZD1/2K6YGaCNqqvnY+3xF6zAedVJc5+y9Z+Ie+2xv+7AfjD/\ndIFNrVOWoX2kIte8/Sz15/jQvOlqSy7/JDS2KoMezyjdhQjzwVTBnzz7+ubR\nBxB+sNSpmCf/cGrrYe1ScsJOgh/Evcs7Fmy8E3c7Y8gm7O3Mxa5L5rWAPcMD\nJvUXmYnJS9sRJHiUrL+DS38IwqqaiMsP2LgTg+Zz6ZE+5dEaXO4dSktKv2W4\n6TzOGt1BzQ0guSH2BDFjMlMnxanUH21fzzcAuKOVZLrMiQ/xxdGejOM+tFnQ\nlNQm\r\n=eH3n\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module)\n\t.add('encodeURI', {\n\t\tname: 'Encode URI',\n\t\ticon: 'encode.svg',\n\t\tdescription: 'URI encoder'\n\t})\n\t.method('encode', {\n\t\tname: 'Encode URI',\n\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t})\n\t.parameter('uri', {\n\t\ttype: 'string',\n\t\tdescription: 'The URI to encode.'\n\t})\n\t.output('encoded', {\n\t\tname: 'Encoded',\n\t\tdescription: 'The encoded URI.',\n\t\tcontext: '$.encodedURI',\n\t\tschema: {\n\t\t\ttype: 'string'\n\t\t}\n\t})\n\t.action((req, cb) => {\n\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t});\n```\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, options)](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, options) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| options | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis code is closed source and Confidential and Proprietary to Axway, Inc. All Rights Reserved. This code MUST not be modified, copied or otherwise redistributed without express written permission of Axway. This file is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement. Your right to use this software terminates when you terminate your Axway subscription.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"gmatthews@axway.com"},"repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"2.0.0-1","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"3.0.0-2"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.0-5_1524675069325_0.5280037788662959","host":"s3://npm-registry-packages"}},"2.0.0-6":{"name":"axway-flow-sdk","version":"2.0.0-6","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.0-6","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"70fadbea4a3b0960bb771ca4d3ffbb02f6191b37","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.0-6.tgz","fileCount":16,"integrity":"sha512-ZKbdM1IyjDR/jvSw6k+YdTe/PUY6+Ky7ltjPsNNvjVFcWJ3cdJARn6BhW9TD3htwDlJenBqeVlIFCE2DTfswag==","signatures":[{"sig":"MEYCIQDyL02JdKWMUSRfkvZiY7pO1Uc0Ru+cKGfb3lbg+IthSQIhAO0R+SXddcd8qulTLi3T9QJhJypyrXQIJuPhcPDH34YF","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":43495,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa4dWSCRA9TVsSAnZWagAAkjEP+wf5LoBT4kezf1VRyV2b\nWZF29elvhTclqvJSl7i+RZdOwn1KDtUqVI/c4EEA6ExMI5uN0K0BMNRhZbnx\nOgsSkMRLFqYtH9Swn9moy7heZCJqhEa3oxs+oPD9Ilqe36rUVKYV8sKiDXAP\nOxEZAZjgSFads7C246+Gw0kewMx0nvXgAAvLfKrr5cnsZzL9M/PkboCdi5Fe\nCmO/p6uxUkh113nfTV1M6BAdK3bpZCUNTqH6T6d35xiCbJMYBShPlCq6A999\nLiYy/URRmSmzBjHzJhqEqL/JhZJ9/+M3XdoL6GtMEpAx+mcpTNR7K7brWFP1\nBUAj7qSVgkxkmtYba2OrCfDdrecZmT6vdAvvgD+b9UbyCS0+9XAoa+Rzhb5l\nWeJKkFPGe0YYZmK7jrm4eNNQzvvs7zPlarX2dSn2RSMS5+k8q37Qc3kklhw/\nGJGZBbP8b6dwBZXvO8b9OKRcmeH2RF/7J8ljzEXLuLS8OAh9fUNqpQFrYJKP\nhZ8JjppbXv8Cma/Dfce8kFaeLV1CaHZ+/G59e1mAMLc7f317eZ4z6Kte59cZ\nPlvg/fn1N3C+UjParecloVRppIa05aaNpmvSy+yyJWzgz/DJhSWD88CwCpN7\nKdCLTtemOPxWdli4p3vWnCGKp0uImX9ETkGiHU2HUqdC9QltXfQlGEo65yzX\nwoqr\r\n=8Zuo\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module)\n\t.add('encodeURI', {\n\t\tname: 'Encode URI',\n\t\ticon: 'encode.svg',\n\t\tdescription: 'URI encoder'\n\t})\n\t.method('encode', {\n\t\tname: 'Encode URI',\n\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t})\n\t.parameter('uri', {\n\t\ttype: 'string',\n\t\tdescription: 'The URI to encode.'\n\t})\n\t.output('encoded', {\n\t\tname: 'Encoded',\n\t\tdescription: 'The encoded URI.',\n\t\tcontext: '$.encodedURI',\n\t\tschema: {\n\t\t\ttype: 'string'\n\t\t}\n\t})\n\t.action((req, cb) => {\n\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t});\n```\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, options)](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, options) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| options | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis code is closed source and Confidential and Proprietary to Axway, Inc. All Rights Reserved. This code MUST not be modified, copied or otherwise redistributed without express written permission of Axway. This file is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement. Your right to use this software terminates when you terminate your Axway subscription.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"gmatthews@axway.com"},"repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"2.0.0-1","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"3.0.0-2"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.0-6_1524749714295_0.5681835931529324","host":"s3://npm-registry-packages"}},"2.0.0-7":{"name":"axway-flow-sdk","version":"2.0.0-7","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.0-7","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"5c28f912e1b19f51d98d70a348e69fa2ba52cbdd","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.0-7.tgz","fileCount":16,"integrity":"sha512-0KN5yJeqIrK3WKVzk56bsFKW8digYvVDRw8Zhf+q7O8p0Yr6Td3EQQYvNeTo67OcgvFHtbdrR3c1+rSbgi1wzA==","signatures":[{"sig":"MEYCIQDfEFp6HmCdUPDRJkjIdAwFYl3PLjsfcNSOT0VLDmURbAIhAO4jkzdJOTCJuRr309skMKRc4jFaWgBaZ6XwwKq1e1Pt","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":43495,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa9AkGCRA9TVsSAnZWagAAZAwP/Rktld4ZO7x63vsRrgSm\n5cEsNlv0WyLA2UPW574IkY+ZRfkkPTZvUpTQD8Pgk3nFAobOsm29FDYUyNw2\ntJ0Q/FS1uodNhYgVfsO6BcS1wy/zxa1l7t9ZPg0UBWh9Wy5OjwIhmxT/xAcV\n3/Ei04RRcqY0VY8vcs4TTQUuz9fTmC3BHqn95wamUxoTPTukPznbE5gnJC2j\nguxQgm97DIZ19QjjKaOIuWxuz4CyuwXgp/lE9wEraUrpK31TShJJvDm85A9H\nHgV6r3cGDJzYgUlH2wszy3IAT+5fk/zF+0U19kguFO8Ahc6FpW8AoDANtzUq\nSVq4gSnv1Q6RGkHl4vqkyBJjiAXfWwLD0j6jad9nGuJQtVITMRIYxCqMErtv\nlyI1eIcbhbsX/X9GwZQJmdr/qPERwFmtq7Zt7Z8RN0aqnK3nTubLnKylx50n\nMiDzgewkJHufwq1Vv8Mrq3bj7PD6RQ1xt2DEQbLJYUBEq+LefHb8qcLMtD02\nx+Vq2nnHSObqDPCYDeVTpHH62wVdwBYbtu4kS7ORpIUkeIKFMiD0pJhbWnwi\nJrSpis5ZMKVf3GJQhyAZ4Jq9rYY7HI9JfHNnZh4CE4Zkh+VFNkDArbmj+ecz\n3eE8oEaJY+m8ckyGMlWnMMy/r1av4fOwMkSogV+L9uxdsZFmE896K7MOVVIC\nyESQ\r\n=ziEb\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module)\n\t.add('encodeURI', {\n\t\tname: 'Encode URI',\n\t\ticon: 'encode.svg',\n\t\tdescription: 'URI encoder'\n\t})\n\t.method('encode', {\n\t\tname: 'Encode URI',\n\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t})\n\t.parameter('uri', {\n\t\ttype: 'string',\n\t\tdescription: 'The URI to encode.'\n\t})\n\t.output('encoded', {\n\t\tname: 'Encoded',\n\t\tdescription: 'The encoded URI.',\n\t\tcontext: '$.encodedURI',\n\t\tschema: {\n\t\t\ttype: 'string'\n\t\t}\n\t})\n\t.action((req, cb) => {\n\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t});\n```\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, options)](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, options) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| options | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis code is closed source and Confidential and Proprietary to Axway, Inc. All Rights Reserved. This code MUST not be modified, copied or otherwise redistributed without express written permission of Axway. This file is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement. Your right to use this software terminates when you terminate your Axway subscription.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"gmatthews@axway.com"},"repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"2.0.0-2","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"3.0.0-3"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.0-7_1525942533838_0.16925974788181009","host":"s3://npm-registry-packages"}},"2.0.0-8":{"name":"axway-flow-sdk","version":"2.0.0-8","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.0-8","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"62502c0c4b2aedd652b10b9bcfeebdf1846b04f1","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.0-8.tgz","fileCount":16,"integrity":"sha512-g1e+GsqnnMDynQO5b4I36FXrRLfLDg47+f8zZ98JfWA6XnW0h6oMokggYDIfc+WI0DY5CXZelbcMr1md+S5lKA==","signatures":[{"sig":"MEUCIQDFHcA+diEoiSS+wYE18OgEQ1Q2gfd25XoNFcZX6NP9IgIgSg7I51W2ZYEs0rZXLpuRd3Tx6Z5B9vTYVNnISTy8xRg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":44511,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbBUFHCRA9TVsSAnZWagAA4qgQAJvMN1wTwD6UheyRiH5A\nPbB28p3SAwJoeO51XT11fNvIhnd32bo9SS5tW08l95mc+o4g8+2hE4rTWKc8\nOMqKbMPmz6qy4ul3XDAXUwreo27p6orfqqreikc7oOSGtKF/OUeMM9Qt3usY\nczAfeY9Fcz9FS4YeUh3uAnNL0BWC/MZTmFywlM0x3RxS2AKvyZtSOVC7Kxia\n5ct/MhzL+t9SgNB+PevZQZn9dKXNR11itAEoCu6uuMkZQaAIracBNfAaaznT\nSZgJ1192csEMeXz3iNLzxg4kI7cEzxA+BSxGbu6MpFmVoxO+s7Z6fBRmwa5t\nRm3xQTaNmevuDdS5adbEJrPrYH4LFT8gQoE3+S9vaZQcDz+49YckIMxl14jn\nePhMSBuuZuGnAIjHJsJHiKwaTwWBOn4UbglaG80S8HYnM7bt9aAoF0aqiWHR\nxdiLmRitAQ75kJFk9ylHBQPgzg5scVukAllX78M+UDAf4jRqIDDtmC3Bti7F\n2R71ZDskYpt/FOkvheTQLpEXBRv9RIrUfVTwMMR+l/SRIdxVbuXmAuULQ9bV\n3jpeoPUfdhvDhcmVnGNaxO7le5zgaLysASJMCkh8HoCcuKS8zKseeMnqDy1E\nAm57875m3qPI1DDBLnTFQlJOsLHldTSEfCjXolmcgFK3D+kpZzLe8QXAEVs5\n+c6n\r\n=eBa0\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes();\n```\n\nNotice that this encodeURI example is returning a promise. This allows for the generation of the flow node spec to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been exported directly instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow node spec is asynchronous, i.e. returns a promise, the promise must be resolved to get the specs defined in the node. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst specPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet specs;\nbefore(() => {\n\treturn specPromise.then((resolvedSpecs) => {\n\t\tspecs = resolvedSpecs;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis code is closed source and Confidential and Proprietary to Axway, Inc. All Rights Reserved. This code MUST not be modified, copied or otherwise redistributed without express written permission of Axway. This file is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement. Your right to use this software terminates when you terminate your Axway subscription.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"gmatthews@axway.com"},"repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"2.0.0-2","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"3.0.0-3"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.0-8_1527071046581_0.23758756709229378","host":"s3://npm-registry-packages"}},"2.0.0-9":{"name":"axway-flow-sdk","version":"2.0.0-9","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.0-9","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"2a7291e337c14741fa124d05f201b63ff72e8b2a","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.0-9.tgz","fileCount":16,"integrity":"sha512-BggCisrpMc/yJNmG73DNvbPzjm0kMx6DzuNXBGBgTN7ztBMHpDmxWXk8Uo7jxaI65v8HR/3deZGY1pSeE4Kxpg==","signatures":[{"sig":"MEUCIQCVLZZtKueR11t6E8cD8juvmAahQk1p0xFIywQerqKAeQIgEGf4R5SguBDZpy/5tc+U4RfC6oPfGWsadwbcN0xhvN8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":44511,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbBv3GCRA9TVsSAnZWagAAQusP/isWRPI5q2p4RGA94X83\npoql049YreGlomo5WMy92CeIqJclvqyZKJOESVOINfMDPm514GHfRYnt/JRy\nCfvgad0lhAAwt/mVdkyWt8hEkwdDgcvF+BeyzWiY2Ca1tiELv2NaJNVvYA+z\nqaoeorjXiFJVNMxNNs6HUN6oWaDmZ1q07arpVbpd4VC4Wuqrud+lN5BljZzK\n+H0gs5NFi9TGyk74lqVTTHvdB9qqf+deXEEDG9NGqlk4n7zVXXHPdcXphu0d\n6qe0TOg2PS1I8eX1xE/YutnYU4kfJQzElCeUKBq0aRtqunRTAMU+6dvcj/0z\n4Tl87ROy2JW83SQBN1gy9UUe4Fcx4dwbXfftEJLSsZ+aLQ3508o0X+Le230P\n3xWjqPodq8Vz5rclIqCml7ZUAAsQluIK/5UOCUAjsrS11BJIM1WygoYD2KLG\noUXiY7MCgR+a3nuaftoydBGaNNApc3b1Ro7pW6sbbm5FYjictCKEWtbryYkS\nxD0GAAHrAjV1r7DDgebY/5cbKaP20X9nAWUclnSS6mZALE+/MY9lBceVlCsz\n3x5eyZhOAdO5mnSHngn3Pu+gcIYKRCPR1ehFtPUaSYjHsr1hfOfm6hucNbeu\nKox5t/tv43MvE2mTozOfggdYrx/mXXJ9Nlt48/Bbj3qeckWdC7z2uIuflTsq\nmadP\r\n=L8zY\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes();\n```\n\nNotice that this encodeURI example is returning a promise. This allows for the generation of the flow node spec to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been exported directly instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow node spec is asynchronous, i.e. returns a promise, the promise must be resolved to get the specs defined in the node. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst specPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet specs;\nbefore(() => {\n\treturn specPromise.then((resolvedSpecs) => {\n\t\tspecs = resolvedSpecs;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis code is closed source and Confidential and Proprietary to Axway, Inc. All Rights Reserved. This code MUST not be modified, copied or otherwise redistributed without express written permission of Axway. This file is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement. Your right to use this software terminates when you terminate your Axway subscription.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"gmatthews@axway.com"},"repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"2.0.0-2","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"3.0.0-4"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.0-9_1527184838336_0.4680209189156741","host":"s3://npm-registry-packages"}},"2.0.0-10":{"name":"axway-flow-sdk","version":"2.0.0-10","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.0-10","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"6b0617e6f6ebb09f32c13548fbbc9ff0c7924fa0","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.0-10.tgz","fileCount":16,"integrity":"sha512-Wou+cd4AWhPpsLNAPK0rl9zv4e2qFhHCenddpShDFe57g1gA7Q6nUm596Xp8eKuNp5+yUxq7EdtCNufE3K3gPw==","signatures":[{"sig":"MEUCIEgPLPUpCzpOgwXlOYcpXh7pnZHNsVEJRECHqIePsZOGAiEAqYhx4UqHkC312fvoSY64gzKY2K3PtrdbMzkTDJubLZY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":81587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbCDVSCRA9TVsSAnZWagAAsL8P/RNEA8FaJeeKHPkstBem\nxNeyz9HbitzsdLvbqyGbMh08GH3m0nVwHAk8lNLaz7IlLgkCv7LNyh+CDcc0\nZ5HC/Dns4BxZQaOFr2aZdSWrYdGvYDDaI9jnuldnpZTGBnx9TPGTO10Rbxge\n8C8cEK5M2G1P3M2E/bdbNTFRzciSNm2FPp7vwOhG3E8o+iVn+11pxyQsPNFR\nU0kWxt0tCPxqiF+5dAwH62gv9BkqrkzBnF2QlRE2YPbCWWtdfTLy8QDA+r4q\nr6C78NGo5Sz7WFLSqGOwRYiMon3Rjbx+IvecwO+MFa6BJFZe+krqUJdRxObA\nJtWlD+2JNAPXK7UpEjEyAWZ41MrXVZtDw0sxO2pc2UxDTEyg3m/bgALKYbXO\nWuNdouQ7g0kYK6wmgAEqPPxDBgeoxQmU8y0/Cq5gTWteQ3O2kC8DaySkpuT2\nJwNq+cGnWu8q33cnVe4TpqYKWR4gQb5qvgxvV/JJK5xrTJoKvl2xZGioecMk\noWliURELdy2CqNPLk1dsj5E1y9m+Z1D49Ex/HPYWIQ8F+LIzAPOPWS4avlhY\nTrrr/ZLabLhlFiTdxtLE6riNN9N5dPAKqyNTD7Ck8kT/u7BgCi0td2oqY7Lx\nNjoh+cV38B2XCxh/RvLWIXTPizlR2fubBxRcQxi9knA5HBcibHs14dOQbCCK\n8fWH\r\n=/x0d\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes();\n```\n\nNotice that this encodeURI example is returning a promise. This allows for the generation of the flow node spec to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been exported directly instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow node spec is asynchronous, i.e. returns a promise, the promise must be resolved to get the specs defined in the node. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst specPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet specs;\nbefore(() => {\n\treturn specPromise.then((resolvedSpecs) => {\n\t\tspecs = resolvedSpecs;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis 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](https://support.axway.com/en/auth/general-conditions).  Your right to use this software is strictly limited to the term (if any) of the license or subscription originally granted to you.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"gmatthews@axway.com"},"repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"2.0.0-3","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"3.0.0-5"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.0-10_1527264593671_0.072535782589491","host":"s3://npm-registry-packages"}},"2.0.0-11":{"name":"axway-flow-sdk","version":"2.0.0-11","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.0-11","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"121e8964d2c3c88e5a6bf4e2a7d05c0c96176991","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.0-11.tgz","fileCount":16,"integrity":"sha512-iTPZemONcm9g6wi+JrHh2aqgICTBBDbn8+KmzANHinyp5OqnZHBl08Ef2KEY4e7FBgNd5hDJHnQyXdWqJEP0eg==","signatures":[{"sig":"MEUCIQC4q3vBZlCF2ls+HyrcBItN6TA3CDRWYdjN1DGQTyObIQIgDYrPxD/CC7VUPENg2IWIkX/BjKRfkJDAQDTDr9x1i8s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":82052,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbHRYSCRA9TVsSAnZWagAA9zEP/j2YYQbBGfsCnr11hNHP\npIx52IDSFRKLPhA+NsTKaAtNX/VYnb84Gvg6Kjk9ngAOdOdPhULvYCFAVpu9\nbY7azZI73iaJX68IAvw7qh4Gz+zjoWIOCdPeObUtwdS32TKS0Q+48+Mp0L3E\nGpAxK0taPpOTLon35Zgw2NWLs9CYYy75YbMfNYZA4lVWvysKN+b50/zDuLZ0\npVN2JQSYxoq7Wc63K3KYF3D/+4GY1cwoUe3MEZ9gFssAcCJ6uaFHRArJw34n\nKEqAmx+VSJdc2lPNfjxUotI/bJkKAt1k2kNc7/V4Z4fmvd1McKuDNDBmc7xZ\nnuDU+m6HsaaGnMe3bFk6ALMOkb59x/TeULHf5Ass91N0mviJSAzO7xygW8T6\nJMF8Br41ftpLxqjCIsbHxN29AGwzrggWSsgnTViGVv9aI8WJLbZQPQw4GpLi\niA8pBLdpVy5h6Q6EtIslBk1WQBnXELtUGvNLONUBym8FakMci6R6MzySEx85\ngBAvQrdKCPA3TQQIuyd8NR8VwpVkJdPxQJpWZEwcIvvloV5ZAcLQmKCaJTjd\nAZdi2OhaqpZMby6+/j3Y3JoxuOyAUuI7BvveVxA2pIbJcf+/1geEfClkmFn3\n85hxluF6npLqt+7g0pdb72fx66IhdjhbnCYZ+RL5wRlGLr6QOOZUsNDykVrB\nWFII\r\n=uVQu\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd api-builder-plugin-fn-mynode\nnpm install\nnpm run build (optional)\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes;\n```\n\nNotice that this encodeURI example is returning a function, `getFlowNodes`, that returns a promise. This allows for the generation of the flow-node to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been returned from `getFlowNodes` instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered\nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(flownodes) : <code>function</code>\nMocks an API Builder flow-node using the flow-node generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| flownodes | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the flow-node is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the flow-node's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow-node is asynchronous, i.e. returns a promise, the promise must be resolved to get the flow-nodes defined in the plugin. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst flownodesPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet flownodes;\nbefore(() => {\n\treturn flownodesPromise.then((resolvedFlownodes) => {\n\t\tflownodes = resolvedFlownodes;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst flownodes = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new flownode and prepares the `NodeBuilder` to accept the following flownode\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the flownode and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the flownode.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node flownode and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flownodes against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid flownodes.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis 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](https://support.axway.com/en/auth/general-conditions).  Your right to use this software is strictly limited to the term (if any) of the license or subscription originally granted to you.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"builder11@axway.com"},"repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"2.0.0-3","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"3.0.0-6"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.0-11_1528632849395_0.7007604015455697","host":"s3://npm-registry-packages"}},"2.0.0-12":{"name":"axway-flow-sdk","version":"2.0.0-12","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.0-12","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"7176a3c58fe89c664088a53dfb4bb2cf009b90fe","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.0-12.tgz","fileCount":16,"integrity":"sha512-qirRqXwyFkAN2pDtLiuiJz7/CRJZw4H0FnJKGEMlLPshcwJhT6Ux59AwlZfanDHEu3b8fngI5RlpdPyIkpnuxA==","signatures":[{"sig":"MEUCIQDRN8F+f/IkjgjYWotHkt/HD2VJNLz3wfzAoPDpUV+aNQIgaqNwKnbi2IG6xDtd9X0r1oXAJcW2MfjA2VIZkYOhOYU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":82041,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbI5waCRA9TVsSAnZWagAAeBcQAJsiklRP1YbXIomMHa0f\nBN+qWgz8/IDSX/SxFWnFu1azPych+TTCFL2omqcmoE8IeF+k+UWnkyUjRu7v\nO5rrP7pUHgVAveIm/GdustV+Xjd9qZk9MGewfkoA3OtMUf9AvLszvKv5ZGNG\njYFGxE5fQKrhHjFMKMZU1vG+QvV81P6LBN/5lhT7mwtqBP7m0bAPLR8FzOTA\nzwIOoij1sOSrGWGIfvrllfhdFdDLSGFPjMkfj1JKCXfTrQ82awpvdPADE+jW\nlOwzmFSc0jwHufldmY8905hVQXthnu6qZblT1D+9OhEcEbIZDr2NU0rp1hH2\nplUOEfcrkydtmhyt0b2FlBRRydXMGrvrawlY1LADzB5ijZihOvgPqO4nnPHw\nDE2vp79PIYHxO0AAJelrvovC1eAFVbTvu8Sd1fmfMhGXE/H0i4IgtVdwL8KP\nErHVtvSI3ixk11fV9K8ycI64fhS8VWO3R7h1FPHqQf48CRFJ+PDBVSABSlMd\no8yek3WEod4SbFp4VYyNzbFd/425KL1K3Li2y+1HEiXlFrfMRxy4n1jL9/ZT\nA+51K8O/hh8tgp1+OPxg4tte0vhN7gRPKT4n8dGsLmd5xhZ/+gQuhTDQ9pv+\ntqrl7TuOgiCDpfSRCMk9LLzeFAuKUG4yi6b8NKy4nh6rgZhQpqmqZXiutMDT\nboKg\r\n=X9q7\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node plugin\n* SDK for building custom flow-node plugins for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node plugin\n\nGenerates a new flow-node plugin named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd api-builder-plugin-fn-mynode\nnpm install\nnpm run build (optional)\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes;\n```\n\nNotice that this encodeURI example is returning a function, `getFlowNodes`, that returns a promise. This allows for the generation of the flow-node to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been returned from `getFlowNodes` instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [Models](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/models.html), or registered\nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(flownodes) : <code>function</code>\nMocks an API Builder flow-node using the flow-node generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| flownodes | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the flow-node is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the flow-node's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow-node is asynchronous, i.e. returns a promise, the promise must be resolved to get the flow-nodes defined in the plugin. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst flownodesPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet flownodes;\nbefore(() => {\n\treturn flownodesPromise.then((resolvedFlownodes) => {\n\t\tflownodes = resolvedFlownodes;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst flownodes = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new flownode and prepares the `NodeBuilder` to accept the following flownode\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the flownode and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the flownode.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node flownode and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flownodes against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid flownodes.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The service configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis 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](https://support.axway.com/en/auth/general-conditions).  Your right to use this software is strictly limited to the term (if any) of the license or subscription originally granted to you.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"builder11@axway.com"},"repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"2.0.0-3","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"3.0.0-7"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.0-12_1529060378434_0.5189574674473381","host":"s3://npm-registry-packages"}},"2.0.0-13":{"name":"axway-flow-sdk","version":"2.0.0-13","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.0-13","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"b55b222844e6bfc9b1d1fd3188da1e20eacd4093","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.0-13.tgz","fileCount":16,"integrity":"sha512-B0pNempX0Xns6PtWtQ+Xltx1yPUDzB7vM4f1vXihP0xcyj09E1UTQnhRZUNRXialYpf6FkfY4uCB7NtIt2XuJw==","signatures":[{"sig":"MEUCIHSXySjcEImm5jr3Qzbg6idX+vBBPwCGyGFl78UuxElwAiEAiLDlpOgjWaF5Id5AmTFeG6DiFJkXma787fVFM7LXAaU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":82041,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbJ6b/CRA9TVsSAnZWagAA7UAP/3DZrSQcc1TiIotfVNtU\nKGvCeVSOwtD3puFadTXUQ0vAkl2LOwK+RaWIVnF+kV1BXJXWQ6Rpa/ZuSgls\nlxwLKKD1xJQ1b26GCCCOJb326Y0RYAZFwKJI51CHuoi5QJrzcqwKfmL1hFmZ\nHy7lpZQA+ZzmdmiHI+DKOYThfxRbb9n/KF5O4CFatQ2ZVt3BO4x0C8sNgQCE\n31fgjLFC5tuBuc0qeKWfDxANUhz1zW0qHiZFCM8Hp2eQo5uzTnCXGnOle5RE\nlCnemNvgYL5dnzYB/nBeQgJLiTMOythnP8NQqu+zZOIfTrYG1FgKnY2ItW33\npz6hBR3PrXf5k0qQoWWqxEqIyh6lw0odNwrw/gbW5MyeqEjku40lYs9hYATl\n1K9xmbZ7bSey6tlTnRszkfxOqJHAGz+N6T5vcSOmPRWyuiBIG5ewE4rVIxAW\nguq98RwMYbQusEBlOwo2WPTPp7X9/edLEeTqRIRJ8sIhKkBcDxu2YfTRk89R\n7GXq0az2IiVHmz6Roh1HaiyWms78rZrCgxXxX5CYyK5GlQfWsRAJN//KOIGQ\ne5vttBOiKeoDtOILmAb4jETblJhwbQmMRtRYRR2DZGEiFQSqW5wS7IU1l674\nETzFCH8ueesCfEVHMTWVQdOGH2XRzrOBiyWjIV5J8/MxY5SxAyDfIVGQc2WS\nrTmN\r\n=y6OO\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node plugin\n* SDK for building custom flow-node plugins for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node plugin\n\nGenerates a new flow-node plugin named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd api-builder-plugin-fn-mynode\nnpm install\nnpm run build (optional)\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes;\n```\n\nNotice that this encodeURI example is returning a function, `getFlowNodes`, that returns a promise. This allows for the generation of the flow-node to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been returned from `getFlowNodes` instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [Models](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/models.html), or registered\nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(flownodes) : <code>function</code>\nMocks an API Builder flow-node using the flow-node generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| flownodes | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the flow-node is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the flow-node's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow-node is asynchronous, i.e. returns a promise, the promise must be resolved to get the flow-nodes defined in the plugin. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst flownodesPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet flownodes;\nbefore(() => {\n\treturn flownodesPromise.then((resolvedFlownodes) => {\n\t\tflownodes = resolvedFlownodes;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst flownodes = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new flownode and prepares the `NodeBuilder` to accept the following flownode\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the flownode and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the flownode.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node flownode and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flownodes against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid flownodes.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The service configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis 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](https://support.axway.com/en/auth/general-conditions).  Your right to use this software is strictly limited to the term (if any) of the license or subscription originally granted to you.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"builder11@axway.com"},"repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"2.0.0-3","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"3.0.0-8"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.0-13_1529325310511_0.8878871361327174","host":"s3://npm-registry-packages"}},"1.1.1":{"name":"axway-flow-sdk","version":"1.1.1","author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENCE","_id":"axway-flow-sdk@1.1.1","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"d7ca853155e20982cd0b15e0c17d63e4c53422f2","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-1.1.1.tgz","fileCount":18,"integrity":"sha512-MFvUqHBbQAV4g1i2MC0FvP+nM2Q+k2g4z+kAfYkkBeGbid3jo3g74SoiHSdetpuf9lEVSktegPcvC8jvEMVUQA==","signatures":[{"sig":"MEUCIF21QrvDrmHXfKIMkciwLmBQ8M7iDxLmO8Hmk9gjmlOAAiEAmblrQWdv+jHquv8I9sTiU63UO2GXc4P9HXKfzyjQTZo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":44821,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbJ8UhCRA9TVsSAnZWagAA+gAQAIuNMDi/Pp855spE1wYp\ntpCSN2OS5ju53V9nCKdBCx9NuNe9FQ6z6Y2XCsvC0qCxyhyJCw5Xv+zYo9/K\nSdqzVh2GZ0dqALiAzM+bz1UV9tQJDJVxiY1nQdjOqYGeqGzsg8yhFdzZI3UW\nH0217Cl87Ivn0FBJEBGJ2rY9GloL7+SDcwEuvda8h3fCUkPQvCLBgvqHMp8a\ngerF5gEfcCxrLTp3zzmZYrHoOSefVxhplXxZvhHnG6JFuefUOqRFGpVeLK8z\n8+iFCMBwUbP0ugKq7BDJSXdm/zZVp5qrRx/Jn1xrRAfqNGq85rlirpOFUlur\n9x1d2WseFEMe16x3IUD6Bwz9U4S3Pf6nphEcY/ts8XkFidXlsJnHaa8VPuCv\nwFQ32aZES/QbHmwVt8H8ZHCoPk9EbnOy8TjTrjz9Zhjn6Vw1DmfQ/qpUuDG9\nmce0YfxHx5gxXMS/2/H52SgyS2QCggJFX/ApblfXbIfjrlmRdyBgfFbF+0ii\nH0d/rM9VASXTyvFSw3TLjfV5rpMEZUNJfXIFWwjbarJRAiot4fF/OL/n+CM8\nZAR6/dknmHGmxT0Lar3VZvQ1cum/STbTam7wFrAZql9g2r7Qx5kUu/3Xg0bh\nDswxEO9Cug93rFAo7Vt7B8DGCgfNMb48PaxRYVRfZO5umxKGbB8BuSQHwBkt\nVG1i\r\n=wMc5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","files":["bin","dist","templates","README.md","LICENSE"],"scripts":{"test":"rimraf coverage && rimraf .nyc-output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary node_modules/mocha/bin/mocha --require babel-register ./test --recursive -R spec","build":"npm run build:dev && npm run build:checkdeps && npm run security","clean":"rimraf dist/* coverage/*","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","security":"npm run security:retire && npm run security:nsp","build:dev":"npm run build:lint && npm run build:dist && npm run test","build:dist":"npm run build:readme && babel -d ./dist ./src","build:lint":"eslint .","test:watch":"rimraf coverage && rimraf .nyc-output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary node_modules/mocha/bin/mocha --require babel-register ./test --recursive -R spec --watch","release:npm":"curl -X GET http://registry.ecd.axway.int:8081/artifactory/local-npm/$npm_package_name/-/$npm_package_name-$npm_package_version.tgz 2>/dev/null > $npm_package_name-$npm_package_version.tgz && npm publish --registry  https://registry.npmjs.org ./$npm_package_name-$npm_package_version.tgz && rm ./$npm_package_name-$npm_package_version.tgz","build:readme":"node-readme && mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && rimraf README.hbs","security:nsp":"nsp check --output json > scan-nsp.json","release:major":"npm version major && npm run release:publish && git push --follow-tags","release:minor":"npm version minor && npm run release:publish && git push --follow-tags","release:patch":"npm version patch && npm run release:publish && git push --follow-tags","build:checkdeps":"dependency-check --no-dev --unused package.json && dependency-check package.json","release:publish":"git add -A && git push && git push --tags && npm publish","security:retire":"retire --exitwith 0 --package --outputformat json --outputpath scan-retire.json","release:prerelease":"npm version prerelease && npm run release:publish && git push --follow-tags"},"_npmUser":{"name":"axway","email":"builder11@axway.com"},"deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/axway-flow-sdk","type":"git"},"_npmVersion":"6.0.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"10.0.0","dependencies":{"ajv":"^5.2.3","dot":"^1.1.2","nomnom":"^1.8.1","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"devDependencies":{"nsp":"^2.7.0","nyc":"^10.1.2","chai":"^3.5.0","mocha":"^3.4.2","eslint":"4.3.0","retire":"^1.3.3","rimraf":"^2.6.1","istanbul":"^1.1.0-alpha.1","babel-cli":"^6.24.1","cross-env":"^5.0.1","axway-flow":"^2.0.0","babel-core":"^6.25.0","node-readme":"^0.1.9","simple-mock":"^0.8.0","babel-eslint":"^7.2.3","eslint-loader":"^1.9.0","babel-istanbul":"^0.12.2","chai-as-promised":"^7.1.1","dependency-check":"^2.9.1","jsdoc-to-markdown":"^3.0.0","babel-preset-es2015":"^6.24.1","eslint-config-axway":"^2.0.3","eslint-plugin-mocha":"^4.11.0","eslint-plugin-react":"7.1.0","babel-preset-stage-2":"^6.24.1","eslint-plugin-import":"^2.7.0","eslint-plugin-jsx-a11y":"^5.1.1","eslint-config-axway-base":"^2.0.0-0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_1.1.1_1529333015314_0.6584833735310496","host":"s3://npm-registry-packages"}},"2.0.0-14":{"name":"axway-flow-sdk","version":"2.0.0-14","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.0-14","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"489778af0a73de00b88e9f8c06683c54324a6720","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.0-14.tgz","fileCount":16,"integrity":"sha512-EmW4b4Yvz84ROUb9U41QSXF03Yj7rJ9Jye5wpNKCShOYbco3SOAaRKPYEhPmIcb7rcMO0jOcBnB64NK+O7TmeQ==","signatures":[{"sig":"MEUCIEnIyo81k35opVKbBIy4HlEh66fQrRdX2fmZ2U8FkECAAiEA9W1UijJonZJQof/kQCHP51RRVG+2DYALDNT7wMk/0t0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":82092,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbKM5OCRA9TVsSAnZWagAAbKQP/3bHwCShi77uxpq26C3t\n3Hz+7dEv34hFd7jVN2fILhAcxVx2m2EXFV+hMYiTXHY6qOUpP/oz45zuTbmO\nG866i4g+bWwmp7kaQFnbmhiAn3UY8Ix2TuNk5hZGAMo0ABNRwKA5ASAUqo2q\nTbUJuL3so37Sgr+KmrUj12GcIilPh4ripr98NhNSGisb8OIYeCvLWxg2K3hf\nxcb+D+sOeZpM0Rtx5Mw9MEVgA8DcolSFDjqxPQqc6zOIn1ELJ0/HFrsBcgK9\naKOIheGk6oiNEdfJ6qzUyleYmjrSVPJrnXVQL3+YaAejYbrpNYTTtdBKXWvq\nCD1SCwkm9S1LS+rIJG7B2z8nGktLzPhRcWVviFFUWmn9pWAL47Zvo/mHdnVf\n/xWRli4JJX55VAZPv6FsPUsYfA2wAjvgeDAARt+sjXm+EDwDSxQa3LCWdBkK\nUyX6fjQDQrT7wueBRtBueB4C3I2EZghQWrkU4EkMzGY9IMcPamhPqBR4+DAJ\nckEJ+MPO3GyFVvpvaoTI8rWdXzdHTFF0YyP/jNbMbrAQDU1OEOnvzwdN0nDv\ntk4nLGxLnrI/6vgkI2fMZvYXS10WB+DqQY8fczvcY2P0PvhCwl5vQRIuvGJp\nIF3gPCN0KX7G+Q+hkqpMdVuT48n2qx9+yhdLslkD3ePqvH5zPZx3enQGYQTv\nx6iT\r\n=CY4N\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node plugin\n* SDK for building custom flow-node plugins for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node plugin\n\nGenerates a new flow-node plugin named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd api-builder-plugin-fn-mynode\nnpm install\nnpm run build (optional)\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes;\n```\n\nNotice that this encodeURI example is returning a function, `getFlowNodes`, that returns a promise. This allows for the generation of the flow-node to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been returned from `getFlowNodes` instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [Models](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/models.html), or registered\nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(flownodes) : <code>function</code>\nMocks an API Builder flow-node using the flow-node generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| flownodes | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the flow-node is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the flow-node's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow-node is asynchronous, i.e. returns a promise, the promise must be resolved to get the flow-nodes defined in the plugin. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst flownodesPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet flownodes;\nbefore(() => {\n\treturn flownodesPromise.then((resolvedFlownodes) => {\n\t\tflownodes = resolvedFlownodes;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst flownodes = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new flownode and prepares the `NodeBuilder` to accept the following flownode\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the flownode and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the flownode.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node flownode and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flownodes against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid flownodes.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The service configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis 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](https://support.axway.com/en/auth/general-conditions).  Your right to use this software is strictly limited to the term (if any) of the license or subscription originally granted to you.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"builder11@axway.com"},"repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"2.0.0-3","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"3.0.0-8"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.0-14_1529400909867_0.12337335330822619","host":"s3://npm-registry-packages"}},"2.0.0-15":{"name":"axway-flow-sdk","version":"2.0.0-15","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.0-15","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"c2e0c209e72bd2ad252b679ec9fe653a4767ce7f","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.0-15.tgz","fileCount":16,"integrity":"sha512-KAgAyGotjnb3H1LKuEiFUmFWEvD5b57WHIIubciDbBmNVmWLcjaBkTrd3dBUW03DQAHI7CUU1iaWbBxro8o4Mg==","signatures":[{"sig":"MEQCIH/0TE/tWwGyvy9UB9AQVad3K8ggLOauG7OAhA7YJukGAiByZqr8awj9IdH97c6PzRaTvIoYq9bb05eyLuViUjtrsA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":82092,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbKimGCRA9TVsSAnZWagAALUgP/2aXdjXZLGwcReb2QhYJ\n8CtjSUhGXPiO1TwOeetQK8O0DIN+4h2ATXP6abklbm6239r2jmYYbRKYQYZ0\n2gdZQAAHYlbfX72KolDzWGShk27XFSQKWocyTGxQ4LoYJsoqT4QvLHbvHdck\nWtr/m30S6lI2X+Cyf2ohhRR1PHSjAe+zmBSk8lM/71M+Ix8/VZjgQMr2lvmq\n0vHZQvCgvj9X9R0byfF/EKPC0FZMCH2HLMH6C+lkxQKQJhCCCHcnVznXIqPd\nNLywIwnF0tlO3YfvYnhyjVmu8lHZeQI+aipfmTvapSrbn+WaDkQj2lEuttYW\njmYqBYsJnSz6a7Hk5L+1O9dWdHbGE4HIKT7GRGEeA6B4UDRdZuYytSwA7oOO\np3lBAkgy0WJyrZHfmjBYzXoQG3jkf0ZPPc9SVoLjFvzZSrUS0dBCJ+8FHIQ5\nn+RZFeYLoCiwCHRqINwGbU1EjADBspl8c1Zm8uRJf5mD5UKAKcsZ0S65WTAu\nItwcAen56GnGIv70gcKIwMWX3KjS0XuDznBduVTPJu1+Tq2Frxky3ZbFMeDi\nNnGeyokCoNiHnn0v+F22uMRt/j0a0CQUGR+eTSUevCzE9dQnuV11ajE2ZDWZ\nvpmhHZ/rixPNhkY1t7VhaKx1JpldPjhTZHhGkXKYjVuz6nymUKaN6PJosr/X\nNi8o\r\n=j6wl\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node plugin\n* SDK for building custom flow-node plugins for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node plugin\n\nGenerates a new flow-node plugin named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd api-builder-plugin-fn-mynode\nnpm install\nnpm run build (optional)\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes;\n```\n\nNotice that this encodeURI example is returning a function, `getFlowNodes`, that returns a promise. This allows for the generation of the flow-node to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been returned from `getFlowNodes` instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [Models](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/models.html), or registered\nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(flownodes) : <code>function</code>\nMocks an API Builder flow-node using the flow-node generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| flownodes | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the flow-node is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the flow-node's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow-node is asynchronous, i.e. returns a promise, the promise must be resolved to get the flow-nodes defined in the plugin. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst flownodesPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet flownodes;\nbefore(() => {\n\treturn flownodesPromise.then((resolvedFlownodes) => {\n\t\tflownodes = resolvedFlownodes;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst flownodes = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new flownode and prepares the `NodeBuilder` to accept the following flownode\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the flownode and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the flownode.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node flownode and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flownodes against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid flownodes.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The service configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis 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](https://support.axway.com/en/auth/general-conditions).  Your right to use this software is strictly limited to the term (if any) of the license or subscription originally granted to you.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"builder11@axway.com"},"repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"2.0.0-3","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"3.0.0-9"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.0-15_1529489797864_0.9803107346975528","host":"s3://npm-registry-packages"}},"2.0.0-16":{"name":"axway-flow-sdk","version":"2.0.0-16","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.0-16","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"56ae14e42977322ce1c65404a385ad4aa328f4c9","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.0-16.tgz","fileCount":16,"integrity":"sha512-466nS07MClDw2k2KopmrVJx8pqWbClk5j2VRn6O6B8lnFdkw5VL29ujeCGfcJ7vwCqAIUnYeYHBZ9627zVnWXQ==","signatures":[{"sig":"MEUCIAZ6fM/T5J4+pY3wsxthyH2W6kgIiPkKJu92dZKO6d+6AiEAtMdTLXLDiXLJBGjjk1OgeDPoT5pQUgeFS3GRdKuxbRI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":82114,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbK4gvCRA9TVsSAnZWagAAw1kP/jTGVu19suoUgjqo0FBr\ny75Rsum/De5L0OwoSvigav23TLwo5vweTevBm4AOUp3ca4EDv2nph7LyIPsW\n1pbw+t1cOYbw749GnyDu+32HkCg0ED9GyVl517vd7Sd8BCkAugyef/Fr8m+Y\nexWg+Pv45hdzuO0qetdZb3jfSeO0it5gVZT28pFHYo9R6N7X5YMpGbKY3Aql\ngnkKHDC/GudSa2Tkwwl4R/AS9EBHGB8G+4ZyBqjaupzeX0hNLRuBah1zHEfS\ngvn/GKIYoP+A5ttlkT4RrGxZixDG8Q06T4cNn6cwLabaafWANn6idfjFF05e\n0V+IH24dvj4iH4tfh4Ax65ugaE9huPjUd8190iUwXYnpKba1t89FgvSqXBYi\nhyngdaD/TdUJieUp/ULMe0X1xmTzYUN4Q7RYqX0fkqExA8DOu7+zzmc7pEYB\n5nqUdaFkzJkUd01NwRKBG/UNekiQOhjUI1jRQjnSunCx3dESqTc5Vbnkd5Nm\nHrSeHma7ngHAKiJH4onydn+ZRL78E1CWqc9iG/Vb6tryVXPxTN87Bj7apEgs\n5h6hz94NINdGbg9ag8I5FyzUx/cTX8a8my8hu0eph8f+AaElht04U3xOlcvq\nmAZbYSC0ly4AjxqPp9vc+XklUWID/PFXwee2s//wClpH7W1viHxE0BVkLsMo\n557c\r\n=80Qv\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node plugin\n* SDK for building custom flow-node plugins for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node plugin\n\nGenerates a new flow-node plugin named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd api-builder-plugin-fn-mynode\nnpm install\nnpm run build (optional)\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes;\n```\n\nNotice that this encodeURI example is returning a function, `getFlowNodes`, that returns a promise. This allows for the generation of the flow-node to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been returned from `getFlowNodes` instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [Models](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/models.html), or registered\nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(flownodes) : <code>function</code>\nMocks an API Builder flow-node using the flow-node generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| flownodes | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the flow-node is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the flow-node's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow-node is asynchronous, i.e. returns a promise, the promise must be resolved to get the flow-nodes defined in the plugin. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst flownodesPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet flownodes;\nbefore(() => {\n\treturn flownodesPromise.then((resolvedFlownodes) => {\n\t\tflownodes = resolvedFlownodes;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst flownodes = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new flownode and prepares the `NodeBuilder` to accept the following flownode\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the flownode and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the flownode.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node flownode and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flownodes against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid flownodes.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The service configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis 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](https://support.axway.com/en/auth/general-conditions).  Your right to use this software is strictly limited to the term (if any) of the license or subscription originally granted to you.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"builder11@axway.com"},"repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"2.0.0-3","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"3.0.0-10"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.0-16_1529579567040_0.5163472526536441","host":"s3://npm-registry-packages"}},"2.0.0":{"name":"axway-flow-sdk","version":"2.0.0","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.0","maintainers":[{"name":"axway","email":"gmatthews@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"a50a4109083059fa40733154c258b0f584efdbd4","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.0.tgz","fileCount":16,"integrity":"sha512-29FRa+TP/2LdUxMcKpnowihzwH3ZrSRhkv//Brdo7x50HFCFo3ei1DajTrkf+33Hz7g1qqOgP5KAHwbHP48Y+A==","signatures":[{"sig":"MEYCIQDvhJuzOsv6Ghq1KV6ZkwIyOccz7lp/GB32rB9CeaC2XwIhANyvqYYvftKbrLKuZ+U4fcK/16HH1AOZ8jh3QLMfEaQM","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":82103,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbM2OTCRA9TVsSAnZWagAArTAP/Ao69i9MfA9/qNb8/hrB\nk8ljsNbcgce+iPGCOdqPagC7BayhzdvhUQTkIfjy7caOofphMQt7tJAxERvI\nUz0m7fckul+rL7jnv0pT3hEmqNvx9upS8HXJGmyieK4sjSZluly07fSUadoc\n9pNvFyTSeLlRAMbn2Autj7zvRsXqGEG/SUSy8Vmheo1X9/dbPbNGs4buWSO/\nXANFdUrpP9BZEyC5JDqC6ic8JqGCw1z7w/jbtAfp210BB/M8qKT8xgLJ+hkE\nDhY9hWeTIZnSBgGGdcoWiMsZI2y6rSsLfQbaqsIiQ7sig5US0zP3d/dfcIxv\nOMYPNbVET9P0OrIlh74lZwRE2oY1jk3VAf+L00cEx/x1RA7zWDVzPOjUsZmG\nL/AVa4Axcdc1jp2+dDWnV1iHHWhwVYUWRG0c9o5iJixcxfVPbZ3b4Dgu/65u\nCWZnBmTOXyM71l8WVjgahha0b38xFb4yZa6wJWhXNxkimUu+CGPCEoGh3Zxe\n/pRr5BqcsGDnFCUphCNQ3V/SkIJS2LYEsFFL633UFUDWF+t0HmdCxfsDmoEg\n6wnamMmYY72MKqqZ2mo8EHQcfetm+dgokjg7P44savpllQeyyjp12FbXs0rE\nrnCihdODIxCX5/H4uetBNa6VKGrd0QTPs3FS5JJoV3oWqMLZe0JAkkcsEpxT\nwhpt\r\n=fk+N\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"axway","email":"builder11@axway.com"},"deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.9.3","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"^2.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"devDependencies":{"axway-flow":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.0_1530094483779_0.5855413686133337","host":"s3://npm-registry-packages"}},"2.0.1":{"name":"axway-flow-sdk","version":"2.0.1","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.1","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"pboev-axway","email":"pboev@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"b7c7fe2dc5a52b616b0b0b460c74d27d4e344fde","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.1.tgz","fileCount":16,"integrity":"sha512-NoS2itXQJL31iYPJMc+WEnMLsm0ZferJDMyd8IgxN/kKsQ4zm3XMvHN5XrLDYEfOy+9t7FgWREIYC/ATAD4geg==","signatures":[{"sig":"MEYCIQD5Nn3bi9xLsB+KrGVhtgznz1mssBaEcNPFXmZcTo7rUAIhAPNDJqd236Jujuw/0uyWitLKW0JdDUOUMWpARvC3B3CA","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":80080,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbROk6CRA9TVsSAnZWagAA98sP/3nQ3zg3kkL3lzvyV1GC\naM5qpfzqsI3/zJUI0ViIfPyiAUtYn3sow3oYIOgV4JdQNX5MdQA6ltoU0aAg\nyDdXVragetBFOX0/vv4A+yc0rGJnhEKavi5lmJRWHr+qlTSLvU2ARxEi4EHL\n2FxR6GlllNkfCuPn/KrUHanhE7RHsvx579V3vdSJ/Azcernx1vNof97L0Cxj\nTN9e+Jp/3igtlGORE8mZ6ELjt0jMJWlls6AKiWrfLxXWmifmjX7+ZLT9/ZIQ\nVbpfbWEqOC036KG1tqnj2x46XcVqR+vnAo6UnxTS0D4/xO/FeRVCvuYREIsE\neAo6N3IEE/QgSiIuyfPGxif6Emjy+AygxCaN2PxJrrpJtxHy8GJiwefZ6taH\nZxDULMkEMll4G2Udf8SxHgQByps3xe4zcFu1wM+r70FohNXx23167AMNHpX9\n5dDjMBYuglqBYo4X06WKTBVEgcnCn4vM1eXCOplvSTi9E4xG8hiAm25zGHMr\nN1PBxKWzEKB3bBK9jqaSYlFkRyLB41T24I4/1TiP9eCLADtV+xxaBe+LFXIF\nKFkqK+4+OCfzfEOTqDEXj32UIrI/uvYWbooVEKe8jvnZA0Ji2P0EorQq+Ebc\naNL/ek8c3w9O8+8bL4Yq9QRc3LPA9QA+Qm4XXN+2jzBSx5z2E+YusX/j6WCe\nvekp\r\n=+4Qq\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node plugin\n* SDK for building custom flow-node plugins for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node plugin\n\nGenerates a new flow-node plugin named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd api-builder-plugin-fn-mynode\nnpm install\nnpm run build (optional)\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes;\n```\n\nNotice that this encodeURI example is returning a function, `getFlowNodes`, that returns a promise. This allows for the generation of the flow-node to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been returned from `getFlowNodes` instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [Models](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/models.html), or registered\nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(flownodes) : <code>function</code>\nMocks an API Builder flow-node using the flow-node generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| flownodes | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the flow-node is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the flow-node's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow-node is asynchronous, i.e. returns a promise, the promise must be resolved to get the flow-nodes defined in the plugin. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst flownodesPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet flownodes;\nbefore(() => {\n\treturn flownodesPromise.then((resolvedFlownodes) => {\n\t\tflownodes = resolvedFlownodes;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst flownodes = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new flownode and prepares the `NodeBuilder` to accept the following flownode\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the flownode and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the flownode.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node flownode and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](module:axway-flow-sdk~handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](module:axway-flow-sdk~handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flownodes against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid flownodes.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis 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](https://support.axway.com/en/auth/general-conditions).  Your right to use this software is strictly limited to the term (if any) of the license or subscription originally granted to you.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},"deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.11.3","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"^2.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.1_1531242809914_0.05744295388626264","host":"s3://npm-registry-packages"}},"2.0.2":{"name":"axway-flow-sdk","version":"2.0.2","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.2","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"pboev-axway","email":"pboev@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"8e8c5d7faa9fe5ce10ab2732ea2b6e097230fd9d","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.2.tgz","fileCount":16,"integrity":"sha512-dxH2VEPsWRZ5ZW+SXWZnWX3AAue/xdLyMxZqGvPFOTldRxdQBTt5CokRpwwr70fboVlKiei5tpGU+2AAqQ5DXQ==","signatures":[{"sig":"MEQCIH4O+8Jc0A4ERBwjV01fE6l/vLAVOnyQoPSCEpCR8E4vAiAKI+eLLzUoXDcUYE258O21Xbq9pLNZdUY+R4oapXubmw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":80080,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbRQ7YCRA9TVsSAnZWagAAvC0QAICgArtv+Xm/MuDguFna\ndwF5j8u0/N5BZ/ND2xKOy1ZX4cOjAWZBNEdkJaC7OTMndiTlxFyjTWdoa2yt\nrUf1C+mWO8QWEeaNxdXpUNsnN1/Ile8Hq1HrtKSVPB8X4LvWZTOSXbxJQNVT\nOYa9wVoJtGth+bcFamVH2Q6XgurHW3OZK5lRig/vLAcbAQUU6rFjritbb2o0\n53njzGSfkRfgjTdrSWM5FQ4PEL3LIaL30ss3GD+/Jb8apogPuJiBk8JsRSfS\n6KsLIop8bSSO9iggJzgRgfeAuYHE49mIv8SfJUrVkEsQjrpOWfcF0Jh7QxKg\ntfS8Z3LJz6tn1h/3EyYyhVT+ZUrdZbKPrjaKMTmd4HKwpIB9Mxdna11eivdi\nLJZpLz0l9rQCtmRk2yGjccaHIiS7/WRmiocnJG1wzRCffyr7vwNtpafGdGi7\nr5J1+glv6PTO8z8qpIhkQY7aZ77O/qLqG6HE4vIHhQymfagK2gnjBH7gHFHd\niIo+Lc1wdI+VHRPq0UCOwDBA1SBfeykBgK2ihS4lLR9ZI66WiSvBJDQG3xx+\nZH3E0N3nEh/9sUS95Gd5VzeCSCvEIlQFPm8r57ejaC5lnZCzoHOlo8kl2IAa\n8sgTyvye1OyNXByKPpQ/HO9b3qCZJuT+QNBOGseKOgAIlc07zOYfTRIRNzvg\nidkL\r\n=/lRp\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node plugin\n* SDK for building custom flow-node plugins for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node plugin\n\nGenerates a new flow-node plugin named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd api-builder-plugin-fn-mynode\nnpm install\nnpm run build (optional)\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes;\n```\n\nNotice that this encodeURI example is returning a function, `getFlowNodes`, that returns a promise. This allows for the generation of the flow-node to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been returned from `getFlowNodes` instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [Models](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/models.html), or registered\nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(flownodes) : <code>function</code>\nMocks an API Builder flow-node using the flow-node generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| flownodes | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the flow-node is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the flow-node's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow-node is asynchronous, i.e. returns a promise, the promise must be resolved to get the flow-nodes defined in the plugin. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst flownodesPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet flownodes;\nbefore(() => {\n\treturn flownodesPromise.then((resolvedFlownodes) => {\n\t\tflownodes = resolvedFlownodes;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst flownodes = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new flownode and prepares the `NodeBuilder` to accept the following flownode\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the flownode and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the flownode.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node flownode and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](module:axway-flow-sdk~handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](module:axway-flow-sdk~handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flownodes against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid flownodes.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis 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](https://support.axway.com/en/auth/general-conditions).  Your right to use this software is strictly limited to the term (if any) of the license or subscription originally granted to you.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},"deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.11.3","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"^2.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.2_1531252439966_0.48373623623474504","host":"s3://npm-registry-packages"}},"2.0.3":{"name":"axway-flow-sdk","version":"2.0.3","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.3","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"pboev-axway","email":"pboev@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"a799695f8af99b5f571201b9d3cd2d21037c5114","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.3.tgz","fileCount":16,"integrity":"sha512-mW0MKiafjMxd+l7T9u9hNrl7QoG8Is/iYh0d0RZE/uhiE4CSGniPymgjAfTXNhUx96ZKrAY2L0ap4h6gVxnp3A==","signatures":[{"sig":"MEQCIAYup583P1exCQzONlJLVBn81t61YcStAbaD01BrpwZAAiBt98psWNtd/Pf6FBd4wSihHwA1K6BULLaqybl2Fio3hQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":80080,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbRR7HCRA9TVsSAnZWagAAqh4P/RsuIVFx6DcBTyH3rD5W\ninC/BtpaLTBavc6UbjwK0pzd59m6n5wD0wNXsDEC+5yWPVjKDdc8vA0ZQjw/\naOI6WOz+P6fIiyQa2N1J+YJsHZNDPWsH8cRTMOXaAhzgDWKAnqWgcltCfmI5\nfb6FwEoiNjO82CQ1t7mQTGeNxHgw2mgjTfRwOetxLX8Vlt6Shop1BGtd2CZ3\nZBDWpvIoZ9FgVCCKYnBIEZQ1LrMpMtoGusMGn1MEy5niKmHLyJt1WMax7NOP\n796EIwaSUtGrad1qmSTBZ4hkppk9QZFT7w3e3dLMzpXlIdJj/UODvrkaQSM7\n5tHygtqaQoW/sb5uSgZJifFh6xNy42qc9EypuFXNCwyBMYR11gnCod70ctHi\nSXaDBzdDuDvNFKDInmLrCYH7sflgBYSmx1zxJDHv6i/2QfK39wDsHI4o6JGA\nL5jJ/EKbIeqTopnUTq+Y/oqCiPTXigzOme5seywM0KP4EDWTJXBOrlcvKx6t\nOU0woYOnth0v+cTSNEDui+YYCDyWJOF78WIJWzmW4kiqkFRC9aha/p5dcp65\nGjqBtUCc2keAI/NcAna/nRbnvWiNom5yIeHmv1YwGkm+K2fIqJSnQ7UIb8lf\n58kivo9Rd6yMwF/jmxb8lhdamLdG1oBGYI77X7OWTbePpwEHbXd1lfNSe7bY\nDrM7\r\n=eYvy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node plugin\n* SDK for building custom flow-node plugins for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node plugin\n\nGenerates a new flow-node plugin named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd api-builder-plugin-fn-mynode\nnpm install\nnpm run build (optional)\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes;\n```\n\nNotice that this encodeURI example is returning a function, `getFlowNodes`, that returns a promise. This allows for the generation of the flow-node to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been returned from `getFlowNodes` instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [Models](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/models.html), or registered\nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(flownodes) : <code>function</code>\nMocks an API Builder flow-node using the flow-node generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| flownodes | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the flow-node is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the flow-node's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow-node is asynchronous, i.e. returns a promise, the promise must be resolved to get the flow-nodes defined in the plugin. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst flownodesPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet flownodes;\nbefore(() => {\n\treturn flownodesPromise.then((resolvedFlownodes) => {\n\t\tflownodes = resolvedFlownodes;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst flownodes = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new flownode and prepares the `NodeBuilder` to accept the following flownode\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the flownode and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the flownode.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node flownode and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](module:axway-flow-sdk~handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](module:axway-flow-sdk~handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flownodes against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid flownodes.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis 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](https://support.axway.com/en/auth/general-conditions).  Your right to use this software is strictly limited to the term (if any) of the license or subscription originally granted to you.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},"deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.11.3","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"^2.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.3_1531256519596_0.4526792804152624","host":"s3://npm-registry-packages"}},"2.0.4":{"name":"axway-flow-sdk","version":"2.0.4","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.4","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"pboev-axway","email":"pboev@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"160560c575b16de1d1338c58f6928b97f7cec430","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.4.tgz","fileCount":16,"integrity":"sha512-Het39s3L9j9ClX9UuxSaAKfqX97A/CnY/+rhQ1cIazvtVLz0BGKB+lmI1hBhTZZrmX1rUY6D8jRViyxQZ19bSw==","signatures":[{"sig":"MEUCIHrQIvqTb0fauNTgVLLXhe2aE1EKFVzz3yNj8skl2LkHAiEAng2LE0Yo5r7dfuNse43a1yxxUvpbwsOZAyk3XFFS6+s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":80080,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbReNICRA9TVsSAnZWagAAnX8P/RzMLR12bPuslFs6dJ3G\nvXKAcD49Hxb05pA3aKPvJA88fl0UlYYwXJBktg0lmGydm2TllmaIyle4ndhY\ntHbH7EAa6GI6I/aOFjQ5zBx7uqn6jQYLoNThO1iVHK+C0dHITlhzZYK5IkyM\nl+O0bO/DFGCD9KFTNwohgYcO2vpLmsNKyM0nswFVp6H4zF2i3UMRbBR2p/Gv\ncUAAe8Q4QWhZe2yx1Tng3gxmwzFQi3B+DUxJf+ScvX7dKyBgPfjNAeD6KXiX\n972NUaTJ4DWmMd5DYcdZKQBpLGkKyb/1+QnbiFzZ9yMacRfUl5EGic8wbwyH\n1qezrUhBm3Pk8VNvesbDH/h4xoC5u1p3IpRYeBFtjHRVupRP4r2Lqg7ovLsH\n2zDQ4LljbY/tGzI7KrNFEaRdJgMMDiC16CgRNXKe3YrxTB3Z0D5D7GBdMCYw\nfvpc9jeXVxkHRjTS9LXqFvB2/BiMtZfUyXl+MIu2kjAtFZ3K+7m+2q1/Tcer\nswdtvHoFHKOtiCoDSy3tkshMnceop+CH6bPQlKVJyuumzqOsrnc6H83xa2sm\nhTEkbXfMwiLXT79c/xBWOpqrdUKokoYlFvWEWnGkPPge5SDLl65tRCN9BFJX\n1vMPx620Vglmqn2wtpctCasAVJbdQHcg4kPHSKMl8n1LxbmHJmKEBJiMm2Lg\nkqrn\r\n=ARhW\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node plugin\n* SDK for building custom flow-node plugins for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node plugin\n\nGenerates a new flow-node plugin named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd api-builder-plugin-fn-mynode\nnpm install\nnpm run build (optional)\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes;\n```\n\nNotice that this encodeURI example is returning a function, `getFlowNodes`, that returns a promise. This allows for the generation of the flow-node to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been returned from `getFlowNodes` instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [Models](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/models.html), or registered\nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(flownodes) : <code>function</code>\nMocks an API Builder flow-node using the flow-node generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| flownodes | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the flow-node is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the flow-node's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow-node is asynchronous, i.e. returns a promise, the promise must be resolved to get the flow-nodes defined in the plugin. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst flownodesPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet flownodes;\nbefore(() => {\n\treturn flownodesPromise.then((resolvedFlownodes) => {\n\t\tflownodes = resolvedFlownodes;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst flownodes = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new flownode and prepares the `NodeBuilder` to accept the following flownode\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the flownode and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the flownode.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node flownode and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](module:axway-flow-sdk~handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](module:axway-flow-sdk~handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flownodes against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid flownodes.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis 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](https://support.axway.com/en/auth/general-conditions).  Your right to use this software is strictly limited to the term (if any) of the license or subscription originally granted to you.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},"deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.11.3","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"^2.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.4_1531306824079_0.7392038721210155","host":"s3://npm-registry-packages"}},"2.0.5":{"name":"axway-flow-sdk","version":"2.0.5","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.5","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"pboev-axway","email":"pboev@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"71632bc6b7d83cc51248489a43973f76ca784bb3","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.5.tgz","fileCount":16,"integrity":"sha512-FdHpJJr7DzzfK/GIhqMl7tXgCGLZE1zrlPtEQJSCWDzIRXKwJj9I+uonL8DtsbKy0GNpNcYGxxLgrY2uaQ9GDA==","signatures":[{"sig":"MEQCIEB5PbODAYUJXdKroE0c6KYfCYYoDZmk/dlzpzkNV9JVAiAPmsadMOQ+/G8lwqn7vVD8hDznVCvac0Ou9Wpkfn3k5g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":80080,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbTz0iCRA9TVsSAnZWagAAeOgP/3G6HThJdMPasAtulkdS\nMWmvtuiimvG4cSDX8yPr0cPzt/c2hHV18sX6jguADksoVMoBxLB2xdidk5Gj\nh+JbvnQ+m9H5Wrcif6xz65yVWMv1MnqkFwyPdsCxe3obj/t/QA5XnCipiKfb\nQteW38XQOl32HBTHNb0uSSjeuhGG9eNPe7bdYidBNmwtGF8zFF01JOb3NuXb\nz26+NLs6EJd0leQWGv//YmRlgR4KaTO3SIpn2zXc8ZyF1uy1YKL/zgJ5yUE8\nG7lD/wM4eMBqgtXTEVE+klSYo+wWYlazyrrt1ez0BXX1Ki0I9k6/YxUNhlLY\nZxGEmqqZx2Hpdp/HPgK1oy6uiaps5wwgOXvRpLYH6gyoFpkKNFaTinVQWrV2\nNVObSrKf9GSO1ZsXlux6fC05+2Ywos9+xaLV6Qp2Ue0FqwCWSVHiYGTeoNA5\nSTRg6qMwTIpNS8cTWlSvcgIKGH2zmu4NH1IH/0HHaG/hj4ItzHiBx4TbXF4h\nvRkXlTjH0QWPQsNryUiLCMPm16VyRftagCk3zfg4iY2UU4lqC+DJ4ic9wywo\nFCXmLVG7EC5s9rO3SHU9WReyrtT3NVbWdbLlZloJzXEO5ndXAcrN9k6d74dr\nx4JNdZS7vpripKiwN1qoDByFhXAJAezlr7UaVP2Y68DM67gke5GnB5+UKkfm\nBihc\r\n=0plj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node plugin\n* SDK for building custom flow-node plugins for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node plugin\n\nGenerates a new flow-node plugin named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd api-builder-plugin-fn-mynode\nnpm install\nnpm run build (optional)\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes;\n```\n\nNotice that this encodeURI example is returning a function, `getFlowNodes`, that returns a promise. This allows for the generation of the flow-node to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been returned from `getFlowNodes` instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [Models](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/models.html), or registered\nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(flownodes) : <code>function</code>\nMocks an API Builder flow-node using the flow-node generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| flownodes | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the flow-node is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the flow-node's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow-node is asynchronous, i.e. returns a promise, the promise must be resolved to get the flow-nodes defined in the plugin. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst flownodesPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet flownodes;\nbefore(() => {\n\treturn flownodesPromise.then((resolvedFlownodes) => {\n\t\tflownodes = resolvedFlownodes;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst flownodes = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new flownode and prepares the `NodeBuilder` to accept the following flownode\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the flownode and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the flownode.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node flownode and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](module:axway-flow-sdk~handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](module:axway-flow-sdk~handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flownodes against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid flownodes.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis 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](https://support.axway.com/en/auth/general-conditions).  Your right to use this software is strictly limited to the term (if any) of the license or subscription originally granted to you.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.11.3","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"^2.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.5_1531919650382_0.15269751666481723","host":"s3://npm-registry-packages"}},"2.0.6":{"name":"axway-flow-sdk","version":"2.0.6","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.6","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"pboev-axway","email":"pboev@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"13d712cbbf7ed0c444a2aff8b045e9b06f3a68ef","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.6.tgz","fileCount":16,"integrity":"sha512-gDAKKCHtZAbWbXwjMIQ6Jnh89a9Qulz4eo4E919DHNjWvo0N92wXPGTXzz80rQRwmtMfp4FCOt4jGfn7j7h8HA==","signatures":[{"sig":"MEUCIQCEf8CDcTtyO5+LiQzMvzQgWqEDmFQ72ZaTItUDHku8WQIgBuCw7qa2eOhbUetrnUUY7zKNc+SN/0lw3wKe3a/CsE0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":80080,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbUGLLCRA9TVsSAnZWagAAkd4P/1mCeH/zBhLLbrf86KRJ\n6jzgVxSgF6qj88jUpcJ65t7TwcVKUDYy0Laie/xvxOf3FrBNjizN0JnBrAZv\nZO/V2twTrAC8xu81rtFfzP205nqku+82Uf3TUhWabp6luq2a7TO9KnZYAl90\nn0+BX/wJ55Mfe6GJm/oDwqgFzlnrYDDke0CeUrDzPpzmjvWnnT6ugdGxkAaL\nenLT7mn/QXPjr5v03BatJZsdFEaYcS7OMLVywdTcSUQHngJzVYX9uA3MPJhU\nIVRfjNzrUf4lxjnUI+lynBh2F1fGto1uOv69bFFbS0KAO9uCJ9e81MXsehNS\n72YZi/+2CN4bM3AonPkuuM8ZcDQtk16XT1+BuSwrI8cuCZjME9nubfu4eZod\nk/uuf844MiA2nDiUqiZZpypFWuspWq9Smj7ctipdRP/ALjILlV++RDgd0+03\nOjjWdMDUF03PZvURIMwJc7A6Y6xGZ8bSgHYX4b0ZLFwd7uh8L49PkN3dAF4q\nINIu/OWbRl6BRM6+G9O3kzHJhD2nHIKwR3/XKFoZl/CwRPlz+uZSn0bwJziT\nYHQ3WY5f9djWIAC720IB+DRmTdTY6xfSCWZ3UekiVV2ysIxoCTCbtIIzugYu\nlr/SZ7bGf4pMa0ZCLtzQfbFSQo/OG7wtMIiYj2FPRuai3V/4UZ5Nr/gj3Av7\nS1dG\r\n=Jr4u\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node plugin\n* SDK for building custom flow-node plugins for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node plugin\n\nGenerates a new flow-node plugin named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd api-builder-plugin-fn-mynode\nnpm install\nnpm run build (optional)\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes;\n```\n\nNotice that this encodeURI example is returning a function, `getFlowNodes`, that returns a promise. This allows for the generation of the flow-node to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been returned from `getFlowNodes` instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [Models](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/models.html), or registered\nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(flownodes) : <code>function</code>\nMocks an API Builder flow-node using the flow-node generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| flownodes | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the flow-node is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the flow-node's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow-node is asynchronous, i.e. returns a promise, the promise must be resolved to get the flow-nodes defined in the plugin. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst flownodesPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet flownodes;\nbefore(() => {\n\treturn flownodesPromise.then((resolvedFlownodes) => {\n\t\tflownodes = resolvedFlownodes;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst flownodes = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new flownode and prepares the `NodeBuilder` to accept the following flownode\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the flownode and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the flownode.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node flownode and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](module:axway-flow-sdk~handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](module:axway-flow-sdk~handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flownodes against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid flownodes.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis 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](https://support.axway.com/en/auth/general-conditions).  Your right to use this software is strictly limited to the term (if any) of the license or subscription originally granted to you.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.11.3","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"^2.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.6_1531994827661_0.026290290254439963","host":"s3://npm-registry-packages"}},"2.0.7":{"name":"axway-flow-sdk","version":"2.0.7","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.7","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"pboev-axway","email":"pboev@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"adb13fa322021d2b2296b5edd1c4dbcbb7365ffd","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.7.tgz","fileCount":16,"integrity":"sha512-KQu3D0SWmjc/+SYawIVuGDKRDgbdfPvu/GpctUXQ5fd4gHjsnKW4U6KclgsNaHQv6I5PWiS2kDgQvhxOtkJJXg==","signatures":[{"sig":"MEUCIBCc7N7+Tk+1xsbpARymtmZd4wgpBG/3wC1U5p7rU5MlAiEAwI3w2NlM4WJYhiEbr4DpNf0jjAEqPTUV3v1Kikqm1iI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":80080,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbUeAACRA9TVsSAnZWagAAai4P/2oE5TKb+fgGPfLkj6wI\n2/i2Ic0TInCO0bkA1N4TkujMIaLom1BuWc1XD2EopXnThvQRd6DdChKWU76w\nxqcCQ8O2E3gcCw3cEwqhM1Pd/lZsqdRcMCgS4dGPBea67V1SRCQ62CypxxKj\njqZraE3MOF62Ql8OVXOHP7BWal17FbC+C/92dhLjpf883ZVm2RNmtq6dWDD3\nRHypNNt47X3Kuj4AoNlhsPqqxcl37+3U9cDYbb87j+42ShOXoACk53HSmgKO\n0Eqen1/xpHxmftoE6psNwtNOMBtTs1Gsgsi+aWg8zL6Jbb+eIMFa++m4S5jj\np/J1xJ9/lyVQmg18Nx6NuZXTTz7T6CJZqeNVgUe+47b4EAslq7knEdwnwYGI\nCqJ1RfjlRcQ7j05JhwUselBlAqOrE/4SEZdGwb16G+lkXm0LQiJygSwxTCou\nAuLO4vIXNHCKXo7tE3R52KtRAO1I1Itskv1Xifx37y0lcTTS+ROh0sUHruvG\nB2lndhL46oNmc9kQOe5cJnxC6r/J2sCDr3f7VLVz70jTlZNGIx2/CWgzhH6l\nA131sm2/PidvnHJyZj/TCijqktbmTon6LXgeSyg6OvSukl9YwpUvjeh7zjFB\nChe5ASXjK63vsrB17Vv/djYyJS0q1q6lIKZyHwGHIO+ksoqdQsw072oFOr7q\nBSzC\r\n=rksS\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node plugin\n* SDK for building custom flow-node plugins for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node plugin\n\nGenerates a new flow-node plugin named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd api-builder-plugin-fn-mynode\nnpm install\nnpm run build (optional)\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes;\n```\n\nNotice that this encodeURI example is returning a function, `getFlowNodes`, that returns a promise. This allows for the generation of the flow-node to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been returned from `getFlowNodes` instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [Models](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/models.html), or registered\nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(flownodes) : <code>function</code>\nMocks an API Builder flow-node using the flow-node generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| flownodes | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the flow-node is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the flow-node's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow-node is asynchronous, i.e. returns a promise, the promise must be resolved to get the flow-nodes defined in the plugin. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst flownodesPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet flownodes;\nbefore(() => {\n\treturn flownodesPromise.then((resolvedFlownodes) => {\n\t\tflownodes = resolvedFlownodes;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst flownodes = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new flownode and prepares the `NodeBuilder` to accept the following flownode\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the flownode and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the flownode.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node flownode and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](module:axway-flow-sdk~handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](module:axway-flow-sdk~handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flownodes against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid flownodes.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis 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](https://support.axway.com/en/auth/general-conditions).  Your right to use this software is strictly limited to the term (if any) of the license or subscription originally granted to you.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.11.3","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"^2.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.7_1532092416553_0.4227444563473355","host":"s3://npm-registry-packages"}},"2.0.8":{"name":"axway-flow-sdk","version":"2.0.8","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.8","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"pboev-axway","email":"pboev@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"817d106ff43301b74becc0007d111fa8118a08d5","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.8.tgz","fileCount":16,"integrity":"sha512-pkTDRAlTm7YUIYgkLwNnTJKMYMbEoHhR70T74AAGk4x0i0kctz+dDhRmfcLVXpgeanK/F7k7saivbQYMkf3ASA==","signatures":[{"sig":"MEYCIQDmp0ddNumyKER/96U0WYsuZaufMzmCVR52qZtwjazYgQIhAKty44/j9LSoVILb0RkXwgoKJblj5sv63X83kZAQl/AN","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":80080,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbVbtpCRA9TVsSAnZWagAAgogP/iUEl/dNYrJgBaLYAjVx\niePSAOSTHXJilthDOtzKlIUmnkVl4E+w5g+IjQn28eoBiLsqZ5x9D9Aa2yWH\n7ttJRsHRDebiKRS7QrbIASH1Ibi53HIkoqFJlAvnd8ZYaI4rh1CLfgfuyf3z\nKWSeFJlQmClnM/qrQGp3Fh5U+tVtszlzPnnxW7KfCSrqQe0L4s0WV9VLPg2k\n+qBPI8zOD0VGNPNU1xodZKo4h5u/xp8ikE+KeUMrCrf4joynSINoMuA69PN0\nIREPD5SdBPmG53ElIFdZqeBLiAVjyb4kdhbxBVMy9vaJJ9LjqCwr+hSnG8x+\naILfLn3wXLkxBYRe77xHpvihNUQsNrSZjVH2hnNPvY5WiGGZ1Sh2zZI6rteB\nKdhAMvjS0nFwSyOGS8nG6kxp6LmiBmiJfApTLHjYayc8+l75hB0CrxKgYcQw\nOx/s8YzDCenec0kSfWDJeIGmI0zuFKegjoIBnNGiMbAoIS7XnSkDMdVQ2rJI\nZVmjcGpV20fDPZ8JUCXNGvRhkrYZElfT4YeehmdsmT9oJBiPPmVNbrvA5Vie\n9QZgkaf6hTAaSxT+AUT2k/UpSmUoGHd09A+5AMIVx2yYQq1i72THU3Vza4tP\ndqDz33zqDq6Z08mxr+JNx0sqco4K78BkYrYYQvMKbyfdLMvKxYwgPgHQFsSv\nN9An\r\n=juzc\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node plugin\n* SDK for building custom flow-node plugins for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node plugin\n\nGenerates a new flow-node plugin named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd api-builder-plugin-fn-mynode\nnpm install\nnpm run build (optional)\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes;\n```\n\nNotice that this encodeURI example is returning a function, `getFlowNodes`, that returns a promise. This allows for the generation of the flow-node to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been returned from `getFlowNodes` instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [Models](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/models.html), or registered\nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(flownodes) : <code>function</code>\nMocks an API Builder flow-node using the flow-node generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| flownodes | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the flow-node is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the flow-node's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow-node is asynchronous, i.e. returns a promise, the promise must be resolved to get the flow-nodes defined in the plugin. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst flownodesPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet flownodes;\nbefore(() => {\n\treturn flownodesPromise.then((resolvedFlownodes) => {\n\t\tflownodes = resolvedFlownodes;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst flownodes = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new flownode and prepares the `NodeBuilder` to accept the following flownode\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the flownode and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the flownode.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node flownode and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](module:axway-flow-sdk~handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](module:axway-flow-sdk~handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flownodes against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid flownodes.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis 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](https://support.axway.com/en/auth/general-conditions).  Your right to use this software is strictly limited to the term (if any) of the license or subscription originally granted to you.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.11.3","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"^2.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.8_1532345193395_0.36301745660616414","host":"s3://npm-registry-packages"}},"2.0.9":{"name":"axway-flow-sdk","version":"2.0.9","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.9","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"pboev-axway","email":"pboev@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"73c947fdb534576efc0e38e4a685bdcceb17236c","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.9.tgz","fileCount":16,"integrity":"sha512-98pQqzPNBjSBWMAePPheHvjXem0SJuA0kHbcO8PmA1Na2fBw5vKGlKXHPIPhuURhkZGBEvpFGVeWFv+H1jmm2A==","signatures":[{"sig":"MEYCIQDbl5yuo7ikNeojU2xguzBIa0J+xGoNI3ct9GwarJ8/GgIhALfSV8G1BoSJgOjzevkYwCMpmTCHz8fu9dOiL7jK/Uqw","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":80080,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbVcE2CRA9TVsSAnZWagAA9G4P/1M3CZ8Fw8iJEbRze2A6\n5WHKAOny298u4N8fckoqKsQtdIxnrmr/KlBAWHwYAb6a1fafRv3+bTd3lm10\n0AQCiSMXzwsT+vN78O20Q0fCgaaZgdQ5r2JQw+zEg1EqA92hiWHdar/rNbya\nCb0mSt9sFffz2nDvnZCGQnKCnQl4Tss+cxvKydP1NKx109GRQZfNhdD16vUm\nUzS/okUKnwtlk8z5qamDKK7wlfRQsWv0ZeVigkkb4bKAPV/uYB22TDibXfz0\nGmZy9/Eke81gxifPwU5eCfdfO8YXXggpqRdRgkzY8R1ag41JTbroc8s4cEX9\nPYa7JbC1PTe/6QwBR/bvRYfkcyg/Te39PPGLnVwzGj2/urMHFNl28SM+s9F0\nZ1GVh4IJkrWeER4QNvjcrsubfKhwiqDyC1cSfGMirRgyicjm179+KlN3214z\njxO1mHvU57ojECe0w6NIUr2MPzBjh0NEdxhJHQ4B8UYr5vJYVfWb3FC6TK1H\nF+K/RjJgenSUYDaXzs4h+AFjhTmRVTK1YmV26rFMC2/yXwUkQF7S1eUwJuv0\nGnMLNMjz/GAgKm9FhMZpPFIgRcHqaKbLIP2Rc9p3uuXvq9bAaF3FPbXR9tfB\ngYoaR3OBMR6yDpGO55NtkU1H9hTUEOC81VmB+MxmztaEuylRMS8wLyMXufDl\nSMAt\r\n=4d+S\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node plugin\n* SDK for building custom flow-node plugins for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node plugin\n\nGenerates a new flow-node plugin named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd api-builder-plugin-fn-mynode\nnpm install\nnpm run build (optional)\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes;\n```\n\nNotice that this encodeURI example is returning a function, `getFlowNodes`, that returns a promise. This allows for the generation of the flow-node to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been returned from `getFlowNodes` instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [Models](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/models.html), or registered\nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(flownodes) : <code>function</code>\nMocks an API Builder flow-node using the flow-node generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| flownodes | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the flow-node is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the flow-node's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow-node is asynchronous, i.e. returns a promise, the promise must be resolved to get the flow-nodes defined in the plugin. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst flownodesPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet flownodes;\nbefore(() => {\n\treturn flownodesPromise.then((resolvedFlownodes) => {\n\t\tflownodes = resolvedFlownodes;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst flownodes = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new flownode and prepares the `NodeBuilder` to accept the following flownode\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the flownode and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the flownode.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node flownode and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](module:axway-flow-sdk~handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](module:axway-flow-sdk~handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flownodes against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid flownodes.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis 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](https://support.axway.com/en/auth/general-conditions).  Your right to use this software is strictly limited to the term (if any) of the license or subscription originally granted to you.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.11.3","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"^2.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.9_1532346677872_0.26188061207027924","host":"s3://npm-registry-packages"}},"2.0.10":{"name":"axway-flow-sdk","version":"2.0.10","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.10","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"pboev-axway","email":"pboev@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"8ffd5f627d60555f29daa9dc049dcf5b0e182f26","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.10.tgz","fileCount":16,"integrity":"sha512-InxThPvUvhErZ3M8alSmbEsSckrNl6Z0FtGz2k9UJ/kfiUyBAOyHBeBcbejhUUcKOKUETK8X4BJq3F5HLpSr+w==","signatures":[{"sig":"MEYCIQCCVBQtDy5nkNclXdhBQahHvwt6Ta+XszhEVwQNwTFgAAIhAO/iwcvZb/E3JXuBxKzTD78iKQskoGebf7sDm712MRH5","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":80188,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbVca6CRA9TVsSAnZWagAACogP/1rOTRECiudw+ZlfUNZa\nJ0lG/lVQkodPAduY25eHJCcKBDntTe/9UTbOFDJKXn0gt2YBDJzQeIqeSrAd\n9KUOvztY/BxEY3OUhxv9G98xeiifRWohlyLt7uj8BhgAPFlB8eM8zeYvhGku\neClSWzrVbvUXBReOG20sVVdiJSLfFOTFJMrBzaTgxInx+4Rxc6YLKcPZt4td\nytEPReXeXK512HvOLB9FXGAS2+X29/WPDSE68gsvkZjNuhyuqB5ySt8zqtXN\nGdJ3nTIWRgWYQrCEJZViql71LED/j4da5ckSShdrdq4JN6C2nBY86j/j+jKu\ncJTvv6GPSAaUDJnGVnD8aemr2CXXKY3AXtrUOYzvAzCtdx9e/ECS5lmUNxZZ\n6Il8GAFKzbwGDjSbNUoRdMbMsRNT2rq8Gs9CC6CoZtLU2UrJr0dwuOYjOVpX\nrI3M+Imo3MVSyPXVKvrGq5625/EloT/nd/+MWsDX47JU8us95H7tG9c2Vo65\n7RVvkZHlkEeBiVscRJcGI/pjIN0pE8FiZ065lWOqFQNv3bX/PyaDmYoNLQ+s\n7+K60Dx/vwqtYuxHcQ2ql25Z6CU0fu73cUDl9xQPLmkHs/HyGnHzFLqyKxdK\n2Pw7aor+WO8tBVwIH1adfh8k4G6YkA1AmOqDA1pZ42fft2atcdc2UfWuIXyh\n3t5H\r\n=UbOc\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.11.3","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"^2.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"devDependencies":{"axway-flow":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.10_1532348090100_0.16854232969918814","host":"s3://npm-registry-packages"}},"2.0.11":{"name":"axway-flow-sdk","version":"2.0.11","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.11","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"pboev-axway","email":"pboev@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"61f087e846863e59ff57a056cce79878338317ea","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.11.tgz","fileCount":16,"integrity":"sha512-BOPn37zWlf/+8tHvkJxXq3QPgFVVlmQvVZRURsg13dYLRroIAsKKr/lRvElnZCZ1GwBv/PkgVuO25WtiTvZEjA==","signatures":[{"sig":"MEUCIQDrrEwiUxYr0LnlpT2SEiinbQYaLYPWSx4cMtFYWngvfwIgbDWK0icy/mT/wH115h2mE8ush8eYtqHj6N/H2cmOd1A=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":80188,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbYv5qCRA9TVsSAnZWagAAeJMP/2rb95WC9DDnKg7mY2+l\nS3lhZF86WCK3ulIg4LnYdmQ+iHaMJJQ5LHtHsUIApK7PiSnHzBXaaBNWVngS\nd370wJAUeG4Vj2t07KcR78tzAKx9PkfGJ9w2f1wCwxLPUoNWdU6HySxxt4zY\nYVotWmKMXpiKAfhuygfWzN3AZnJil/w9YflF3za1s3sARwJ1R+r8PjKQrN23\n8Ei+WJP03MeIkZBgICiN6R+rjAmEreiTkrXYQ/jC23ukG18OujdrTaqwwu0T\nb2lPu+V4d4i3AgKHmwu9EfskJJGtlRAVS/b/5cOTSxTDqZzPSj9Da2i6ePL4\nbjrkOOMZqYdkgnW0fiWEjSejlaQAx5D7h3lcQP9aritIu1ZyFgH3R+bC1iK0\nkeSnGUvTBOuBqJIvXvKMnzL4dyS8wUqt1ij9oTMLTRjm+n99CnnMHr91dXSh\nQuYDeGNDrAKHmHsKglCpkDzPK7cKO/YW8FLWGZ3NAFHwvBa7MnKc2Oq6tcWZ\n+/CEGn0i8O7tzvIHjxPniWS33kUbR9cuqty7UadYUaB9LZKt/0BumknTa+nO\n/Qu8Jd6vrtmKT+09owXv5h8pZD5rpUouLMhggWAfOo2vQ643xdCCMzLWVOdu\ntma6UXMDTqLN/a9sZM9xieKqP+8OnTib0uhIFkaWwbBbRYe0zTGKse+k+z+T\nd8Hr\r\n=wfdQ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node plugin\n* SDK for building custom flow-node plugins for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node plugin\n\nGenerates a new flow-node plugin named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd api-builder-plugin-fn-mynode\nnpm install\nnpm run build (optional)\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes;\n```\n\nNotice that this encodeURI example is returning a function, `getFlowNodes`, that returns a promise. This allows for the generation of the flow-node to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been returned from `getFlowNodes` instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [Models](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/models.html), or registered\nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(flownodes) : <code>function</code>\nMocks an API Builder flow-node using the flow-node generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| flownodes | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the flow-node is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the flow-node's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow-node is asynchronous, i.e. returns a promise, the promise must be resolved to get the flow-nodes defined in the plugin. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst flownodesPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet flownodes;\nbefore(() => {\n\treturn flownodesPromise.then((resolvedFlownodes) => {\n\t\tflownodes = resolvedFlownodes;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst flownodes = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new flownode and prepares the `NodeBuilder` to accept the following flownode\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the flownode and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the flownode.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node flownode and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](module:axway-flow-sdk~handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](module:axway-flow-sdk~handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flownodes against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid flownodes.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## Changes\n#### axway-flow-sdk@2.0.9\n- RDPP-4757: Changed SCM repository and associated internal cleanup.\n\n## License\n\nThis 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](https://support.axway.com/en/auth/general-conditions).  Your right to use this software is strictly limited to the term (if any) of the license or subscription originally granted to you.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.11.3","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"^2.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.11_1533214305873_0.21906546000672833","host":"s3://npm-registry-packages"}},"2.0.12":{"name":"axway-flow-sdk","version":"2.0.12","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.12","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"pboev-axway","email":"pboev@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"9a4882aa129da617c4df8764084ef7f539e0cfef","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.12.tgz","fileCount":16,"integrity":"sha512-FLiP5BUOUE6iZEdDF5PH9ezEjOvm7sSvO3tXoeBokLuHZTDnbkBNEmLq8gpkVHr396Mq6RIST5iKkoijpavr9g==","signatures":[{"sig":"MEUCIBpjcHH/qT7mC/FZGLyVfhHsVcQWrDEIwZlyt52IMvENAiEA2cBdYoQhjO96KvP886FtTlQpkMz/TVbpWvbvZFY8E3M=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":80188,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbZCA5CRA9TVsSAnZWagAAOT4P/jdaG7sJODjO0uIx4jf0\nchdny9BqcbaklvZGou9ebIIsfWmyS5ZQip97vj7QGudQZiNuqRUVmNiPkJSB\n8w43F4Y6KBZiyE7jtzhmeAEToWu0HZ+WldQYLlAx7aNpyzgFPAGIlPuhgkvY\n+6JgYV7LX1cbwvamRp8npA7o3LXblf9LgdIaKgpErPsvgn6o8ED2D2g1kqTo\nSvgqMz0qqFR4C/fmqWXAXo/LFoi8NSO0XOBFsmiP+LOSe9G4NlLQUWvIVqPn\nbpitiKh5CS7V95mpqCqIAi6lwOPfAeAMiXpuHAJpXJoXiFVnZpVfrbd1zAl2\nKwVIVDElJi7cwEFa56hxE5dOx7Bectphjn4to/5X+oMeHW/BRdEy1SCTmLUS\ngPbUor8+JETJOBA01C2FxKmjGdrsoFF5tZ/LaeiXUODTps0PMJ5qdSD1ZeUo\nIN3AkziojKOPKklDpJi98w5s0BISWn//bIYiskAn7ZplB+TlP8g5sY+xHBBF\njT7EhkocMVJ6Og6Dnzcniww7JQxPmQBLLCoKkDOI54SjAIiqMfurSi0Ba8p9\nyaSFu4ViQKGUNRvwz2KOOHxDd6A/u53tdHOrJlxZ58ek4E5ViQIY6wO5HRWw\nxIyNBxKBD1bCWMjX8AKufShYOXKg3/qGWy8UPYHfSs6MDLGmOU6a38f3r+Wv\nJAY9\r\n=hnjH\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node plugin\n* SDK for building custom flow-node plugins for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node plugin\n\nGenerates a new flow-node plugin named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd api-builder-plugin-fn-mynode\nnpm install\nnpm run build (optional)\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes;\n```\n\nNotice that this encodeURI example is returning a function, `getFlowNodes`, that returns a promise. This allows for the generation of the flow-node to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been returned from `getFlowNodes` instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [Models](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/models.html), or registered\nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(flownodes) : <code>function</code>\nMocks an API Builder flow-node using the flow-node generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| flownodes | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the flow-node is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the flow-node's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow-node is asynchronous, i.e. returns a promise, the promise must be resolved to get the flow-nodes defined in the plugin. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst flownodesPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet flownodes;\nbefore(() => {\n\treturn flownodesPromise.then((resolvedFlownodes) => {\n\t\tflownodes = resolvedFlownodes;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst flownodes = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new flownode and prepares the `NodeBuilder` to accept the following flownode\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the flownode and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the flownode.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node flownode and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](module:axway-flow-sdk~handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](module:axway-flow-sdk~handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flownodes against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid flownodes.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## Changes\n#### axway-flow-sdk@2.0.9\n- RDPP-4757: Changed SCM repository and associated internal cleanup.\n\n## License\n\nThis 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](https://support.axway.com/en/auth/general-conditions).  Your right to use this software is strictly limited to the term (if any) of the license or subscription originally granted to you.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.11.3","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"^2.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.12_1533288504642_0.8359039573318776","host":"s3://npm-registry-packages"}},"2.0.13":{"name":"axway-flow-sdk","version":"2.0.13","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.13","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"pboev-axway","email":"pboev@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"7088b27272f496523b1d3c4bbf09177897875bf9","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.13.tgz","fileCount":16,"integrity":"sha512-mKIOh3/x+RfHxHT8t4N+YcUz0mMmdu7puNHrmQ0ygiyaTbdQ18+NcDwv1RAk6tfJQmm3glry8ylzo/sio41sIw==","signatures":[{"sig":"MEUCIHd1C08WNRgv/g6LlLKJ7rMGXGdirIyK9zX7+kJJfnL3AiEAm0wjL8ILjjHofa4IM2j5F/AC2uG4tsX8mdPjvsqHtwM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":80188,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbZCw9CRA9TVsSAnZWagAAX+IP/3kDa9GJfGNKSGLQOWit\nwH6CjW3MinTK5KBAQYo+h5zkPxYhmhxAO20HvbGgYftZ5ZqpM17IfG13awS5\ntSKd9GIxEdK27RXuBWFUQuU2MfB+JxEAt8sOIwIztBirIa9SRx0tlHun54MX\n2siC8NY7Y6Uo1tZyPg1XqDcgfg3BGSSAZgVV+VyreWhyjwIBZktDj12TqU1M\n5zK4pGGxisuwB9BnsZRSiom6BrAtumw3vI9ZnpN3qAj/MivyCfdHZt6B+WPo\nVucoLjhhgjE1mDpuj6BFg994uGQtSMGRPnYTksr6tscyq5btT/ozAGr2yX44\npEIcgEI3PCjDMReAvHXIF84rDKfZoLxDzesxoGlDfhwJsE/wVyktWUuttJkk\ngScAl+tqjofHu/klP9mktzJkNeZWSsKj4MfaSzQ1O3nTHs7mE4fNOj1krktL\nVBeJfxX2aiovu5cG/FhLANAz1dubchsZD0ktiwL3Q8yzaW282soIxYAQ3h2f\nrJQaIczzrSjqYr+Qcyjjv+PZo6h8wb05gUHu5e/A5xWSj9Fwr/Q0HgNLKw9T\noBERoOVQKFrYZNeD/450DSNlz9+qyoKmb+Mu7iWildd1Va4Pj3BwYNz0+1MN\nDL0IGT4c2ACEbBqOuTC3TWvfGC0vpDC8eLgfj7CY+KcwxNCjg5hfW/9/Fcan\nspAz\r\n=Hfh9\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","files":["bin","src","templates","README.md","LICENSE"],"engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.11.3","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"^2.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"devDependencies":{"axway-flow":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.13_1533291580916_0.8692028241865644","host":"s3://npm-registry-packages"}},"2.0.14":{"name":"axway-flow-sdk","version":"2.0.14","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.14","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"nkeranova","email":"nkeranova@axway.com"},{"name":"pboev-axway","email":"pboev@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"87feb304fd768940f08d1ffbb72092c6c98e387e","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.14.tgz","fileCount":16,"integrity":"sha512-T2C5QtLNOHqA4isKlX2DE9UYeTtEWnSq6pZPd7SH8XpM3OMCo7r3fOwYfZOu4o8SeaeDfy89nSbfU6h8YUr7+w==","signatures":[{"sig":"MEYCIQCOXW/iGWr9Eni3p44GZENwQjuUVbrOdSIws5qKXacaIAIhAO3iTLubezvfx1mYAmMhsz8+MiaNY9JuSccExTuS/Izt","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":44950,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbkSnyCRA9TVsSAnZWagAAg84P/3nAyroBbMVJwWn0qCzl\nM7IQbMCTPmq89y2gkgwIigE05lCZQRZYv09xcYU7vYclJW73IetqTcBKta+E\nfbuyOmDBc3jzbeZ9ET9D3BRY4iTgOFKyEK7JDo5OIUDSx2lA8S3jR+CETLbs\nvzgUWBx+idgT5xLFsuf1HcEiYr/zaHEKX5yjqggmYWFqNBAqIFsP1NpwkcnJ\nsAlqxhuAtfnoWQtNxLBvtnpwQB2LdFLUFBD3bzTbZduAaC4Zn1Mp0ePWBMJi\nDOCeP9Ji30dVPGwZUqDksxv2R78O3BPm/tiZHDdOgBf6ICDA8LrjLzrsIMtd\nj5LdWjEXoybdzIlB2ab5MCb35pmrFrP+PxZcQmattfVX2tWLSiSywnDn9HfR\n9cfd5PpnfAhyw4jM8YiJOSnrHBfCz1jkYHRjjwKImXtkAo8GXdhCaFK5WiST\nII+s6XUYhkxeJs086j0jAR1vXrS2jvLS1J3OqS3DDjuQXaIZf2Ap13LwNzFg\nkyxZK9RKLTHF+aHDAZN3uBkELwiqK1ZiM+1Fhxty77G2hR+u8Lk6NJ011Q8P\n+1wokRPaYKLtBMpSVC8zbc8o5EfiXwxVbMivp9j1H4wN78Z2fKKaWPXbYU/R\nRl15K0jvASyG6hujvl/qu0TYF1ZoxKhr6TMXPESxuAs8CL/0rQVvo02iiB+Y\nZMIn\r\n=dVJ6\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"5.6.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.11.4","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"^2.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"devDependencies":{"axway-flow":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.14_1536240113262_0.649732716765991","host":"s3://npm-registry-packages"}},"1.2.4":{"name":"axway-flow-sdk","version":"1.2.4","keywords":["amplify","api-builder","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@1.2.4","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"nkeranova","email":"nkeranova@axway.com"},{"name":"pboev-axway","email":"pboev@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"nyc":{"lines":80,"exclude":["dist/*.*"],"branches":80,"reporter":["lcov","text-summary"],"functions":80,"statements":80,"check-coverage":false},"dist":{"shasum":"9fbd4afbf5336772d3a4a23fc609a403f88ffa75","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-1.2.4.tgz","fileCount":16,"integrity":"sha512-2vfsQHJMaxyx73yl2SVctpB+E1YD/lY1lgQJqYvZkKY38nt5mU0OVEyTfhodyh4ckLRe5IlPeEN07GXyX5RQVA==","signatures":[{"sig":"MEUCIH4nPoJW5EP8fPaOvpUk530FKfzhNQokbCvkolU80TxgAiEA5OmE6UGFl/pZuLyGebKPG0aS9920Wom6FCnaBwZxlPI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":46044,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb0eoOCRA9TVsSAnZWagAAvpoP+wUmKlHiXrVH6LjPsae9\na9mlXzV2CQpngu9oKgBG0WVFrRU45NoP4V3b+fHBatRrlTMPpDT7pqTSWS6c\nMlsLPem7mYQAWmVd1CIlzRhqiELbVkhLDYVD8B1r7Bwv3UpSbm2F1uP5cE5j\nEZsM3JAcyBhfyS9yTrd6mnvMG8M8HgUPADNQsF1pfWdzN9VUqSAs9FGhvAzw\n6LEvZLuFil6fnt6MsXBzA3MrAadzeqbjcK8NrwBrMIshPYtdraWC2WTvgisA\ncXhnfQQd9ZVlsLjnhUopGgjRWkYYAumuji3Ig9Q/YL5gIgcT4mos4QIcWrv8\nzglEks5msZiyK16PDJTJgCmNpt3e3wlwZaW3w0ArqD0d5E5KFrSt3FRx4tk6\nbnNOJVZM3lgNW9JEzZHq1V1mwi61gIe8gZQlFfI7BM986M2BgDaRTBYSRxBd\nqb65vkthBgOwffnm4as94AZPWCXNt8I9vlQK8VfMhgHzTmh7TvjEOrfh3Ayg\nXaYqW8ljZqe3mtQswv0BJD2ht3HhBW4TJaydQCDLKVGIgW9j9nfKY5JQM3OB\n/ge046HaReaKmGCfZT1MA6zpAMM9ufCbrIFotQ+atl3gNMpKPo2ChCI7w8cj\nQyjx/faCxRgxxViS+CkzpuWu7f/ewHHjX4ed3mLhZPYOFLkEmulP7P8f/IBR\nhAqh\r\n=+6Pc\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","_from":"file:published/axway-flow-sdk@1.2.4.tgz","readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module)\n\t.add('encodeURI', {\n\t\tname: 'Encode URI',\n\t\ticon: 'encode.svg',\n\t\tdescription: 'URI encoder'\n\t})\n\t.method('encode', {\n\t\tname: 'Encode URI',\n\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t})\n\t.parameter('uri', {\n\t\ttype: 'string',\n\t\tdescription: 'The URI to encode.'\n\t})\n\t.output('encoded', {\n\t\tname: 'Encoded',\n\t\tdescription: 'The encoded URI.',\n\t\tcontext: '$.encodedURI',\n\t\tschema: {\n\t\t\ttype: 'string'\n\t\t}\n\t})\n\t.action((req, cb) => {\n\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t});\n```\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, options)](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, options) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| options | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis code is closed source and Confidential and Proprietary to Axway, Inc. All Rights Reserved. This code MUST not be modified, copied or otherwise redistributed without express written permission of Axway. This file is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement. Your right to use this software terminates when you terminate your Axway subscription.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc mocha ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage","build:dev":"npm run build:lint && npm run build:dist && npm run test","build:dist":"npm run build:readme && babel -d ./dist ./src","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},"_resolved":"","_integrity":"","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"6.4.1","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.11.1","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"1.1.2","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_1.2.4_1540483597319_0.6988272018538937","host":"s3://npm-registry-packages"}},"1.2.5":{"name":"axway-flow-sdk","version":"1.2.5","keywords":["amplify","api-builder","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@1.2.5","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"nkeranova","email":"nkeranova@axway.com"},{"name":"pboev-axway","email":"pboev@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"nyc":{"lines":80,"exclude":["dist/*.*"],"branches":80,"reporter":["lcov","text-summary"],"functions":80,"statements":80,"check-coverage":false},"dist":{"shasum":"2f9458e8999bf0b926703341a909e515c180e3a3","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-1.2.5.tgz","fileCount":16,"integrity":"sha512-PW+VVkJgF9IjHG4tyg2fr7AATPLHq3044mIGEenk3WP9trcqlgDOhuxKUqTCvK5g/ZSjdlPhcLfP9Ze8TS72dQ==","signatures":[{"sig":"MEQCIDh7Xapr1HbmXbd8jSIWQmYDEXp6ylGKhfrr6ZjRe50rAiAHjC51mhFOALf68gP4C5Gf44sID3LrpZO6cxSO8F7O9g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":46044,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb2Ys7CRA9TVsSAnZWagAAqmIP/1RudseP7pJAGWcFO3rO\nZXGZTvhy59oy82Du0BFr4gWr0IflyIkHvZT/tyGz0rek5o3fkdKItbtDX9UQ\nws+3nRokj+E/EEFR18wvpzAd9+2WmO0ql0LVIl7C5/ZlJFVCi/rGnDa3fV6A\nKV4YSwoHV8EqMrIBrKHt8LNk0r8XQ+TST/4lKdROMwkTGrzjC3uOT3pRG+Ip\nzgrtFwYpOjOvR+h4J648xCuH4sx7L7rpTt+OrEBLZI32qLyBgPZEq3eesgDC\nI138BNhx2P7CbsSExaWtrMf/g6aGnoIXWFBMslM+Qq4zG0YyonMT/a3U8Awk\nZeXnNlG0aKaZTAsDdw446WMf0mIop52pkLipN+Dyo8KHfICZmU/rnRvsAyvW\n8V7vFQRCdrC9kCcqRz1Pxe/Q8MsmbV8Rm1JAlrJ33ntEe+uAH7BENLfYyFxe\niu8ze3uFS+q44q92WyIQmgFMJbTtIL2aDTo/V2KpL5Hx4BRx+v8jWGhtfbDd\nzsJMtGLz32lgr8p41YnrKcLZgX/YaDGSni+u839Ju9N37dLGeWAuTf8JowDf\nqexqSpacA63UHGgYU6oTu8TRnY7r4fyrD918InjOP7aixIIGdHR2Q5OtjlXz\nqdUWkXQ1A8dpmDrgbRfjYEt7NzhTU9o9ushmdLe0//NrEBe3RwsgKmloeA0D\nTL44\r\n=CT6C\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","_from":"file:published/axway-flow-sdk@1.2.5.tgz","readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module)\n\t.add('encodeURI', {\n\t\tname: 'Encode URI',\n\t\ticon: 'encode.svg',\n\t\tdescription: 'URI encoder'\n\t})\n\t.method('encode', {\n\t\tname: 'Encode URI',\n\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t})\n\t.parameter('uri', {\n\t\ttype: 'string',\n\t\tdescription: 'The URI to encode.'\n\t})\n\t.output('encoded', {\n\t\tname: 'Encoded',\n\t\tdescription: 'The encoded URI.',\n\t\tcontext: '$.encodedURI',\n\t\tschema: {\n\t\t\ttype: 'string'\n\t\t}\n\t})\n\t.action((req, cb) => {\n\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t});\n```\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, options)](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, options) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| options | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis code is closed source and Confidential and Proprietary to Axway, Inc. All Rights Reserved. This code MUST not be modified, copied or otherwise redistributed without express written permission of Axway. This file is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement. Your right to use this software terminates when you terminate your Axway subscription.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc mocha ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage","build:dev":"npm run build:lint && npm run build:dist && npm run test","build:dist":"npm run build:readme && babel -d ./dist ./src","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},"_resolved":"","_integrity":"","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"6.1.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.11.3","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"1.1.2","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"2.2.5"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_1.2.5_1540983610907_0.19166728521603882","host":"s3://npm-registry-packages"}},"2.0.15":{"name":"axway-flow-sdk","version":"2.0.15","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.15","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"nkeranova","email":"nkeranova@axway.com"},{"name":"pboev-axway","email":"pboev@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"bc812777038c6479ddf44a34ea114b21f905d4dc","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.15.tgz","fileCount":16,"integrity":"sha512-62vxGNcQObHpCb86GaAIfdm3uVKEgd10xqVbDWSslnIjx/ZayK/NxHNeCmlSsTakm87LUQ2W/m3FXUqPjiIgcw==","signatures":[{"sig":"MEUCIQDBmrLM9Jgc93Vuym8uSp3xQLHXbm2VRf0N39SMsP0qGgIgKGY/JH6Pb5m+bjGy0ZkthhcEsWKs5qjmCA5BGJwZf5k=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":44971,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb6rqMCRA9TVsSAnZWagAAuiMP/jgnfGaaRQXnv4qOWbp0\nF/oK2Oy3z7w/oQl1wl1cSUDjn1rywiTxXy/Wf+PTnW0W+wquVsKOgtn5w6el\nxYpb7BAH7LcE4LoldfoWkxXuE/KEHuI9PERS/KPFteK4slRxtdeZrivldhUJ\n/VsfXFk60vbUMovU5VZXhildxDzDQuV+PGfaVpklyq6otlZMQb8CzcTAy+19\nSoHxZkGVJ3YaFCUckPkFnzQtpBjusiWunoXQsDTY+7dEe96PIPE8FvIaqE1M\nBLiuL+U/cvrEeEnHp7RPE8JiiMEwiieAFRB6aRgnhED+TIHVFgIvdYSPE+Kg\naNU2c2qKypBGBCTDps1yfCiiCRWfEEh3wardlIF1mLGKeCoTKyWLBvFVZPRG\nk2PLz3X+RaA/+qR4MOXAMlOH5ThcL4QpcAuNAxTPKH+TYJ3LCaM6SLyDcGGv\nXlMLQEN2KvxBQ6WyQ694ObU4yHJ+RDdygPoUNoiibuuLg/mBRXhkIZFHA2Cm\nxwkDthwkWfkHDXtn2fNouKG+0f2pq8LG8PCY8h4LzO3hW9wYchRSjQxy7C2D\nuqsbaZGNlPMeWJ8OFxWc0TcszPB9nC4NQnjKiBNLFC4lNgm48HQ3q6LmGhzU\nATyfbkRHUSoh/kHYioGjC0iq7J4QeqX4sclQtTLlCfJsG/Rx51HZhCZBtVxU\ni6Es\r\n=iefv\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","_from":"file:published/axway-flow-sdk@2.0.15.tgz","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"_resolved":"","_integrity":"","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"6.4.1","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.12.0","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"^2.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"devDependencies":{"axway-flow":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.15_1542109836331_0.7378109452074879","host":"s3://npm-registry-packages"}},"1.2.7":{"name":"axway-flow-sdk","version":"1.2.7","keywords":["amplify","api-builder","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@1.2.7","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"nkeranova","email":"nkeranova@axway.com"},{"name":"pboev-axway","email":"pboev@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"nyc":{"lines":80,"exclude":["dist/*.*"],"branches":80,"reporter":["lcov","text-summary"],"functions":80,"statements":80,"check-coverage":false},"dist":{"shasum":"b78270b7201e2788a8536a29857f5a550fd0d4c2","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-1.2.7.tgz","fileCount":16,"integrity":"sha512-u+tEzmqWplwyO8BbqQZkELAp8Ga/BNqAco0A+TQpmfCe3z0UZg0BtPNS5ahf9WjG0/CD6OEYUroapGZSuCugBA==","signatures":[{"sig":"MEUCIDstAtiVjrcrXt+t4X6UtNBfNSgdhJmAPLMSpH7qmoSqAiEAoX17OK8gqNPcOsbq7xstt3IqFVplhU5Q2PngXU9VBCI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":46044,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb6vNfCRA9TVsSAnZWagAAH8AP/0Y2gxEABCD02C4T2pVb\nJUo/apY3T9lVFGC6na88gt9Hw1CUM/J+MGVD/TyIk/srRXMILjFaNIUeLZfF\nQFE8Wa6Ky6wi7eAESVU4yOF2B0EghW+8Ac813FJCMx3pL6YIqRoxBlmJ9bbI\n1O651aRsP5Z7ag6ieiwXlBUttKGXJIkr3lCAQ1OHF6jwkgNHJcBsk564S9kC\n73C7RKHA9OPqHVW7LPGXfjBa91LY6wxri9QPb4Zgtg5TyZA2xrX/KhDg3ays\nzqFu8yDUnDthHlWsO91lsD3M2CfDcK2o3F5f3LVcm/w/Xf27EVNGHFH9w7+B\n0Ykxkbf6ZGiT3hzJNGG4AiPwSuYmbWeLYDM9L3n0Hx63zq2pu8Jf/MnJE1B6\n9Bwzb9Isszk0nnBQ+WtSSuM8N2XtvXbi9udUN5nxt6PfEeX31yfGJ7+21Qs4\n46mNxxlSD6d8+sVv6NeY2LvRNo6LMo+Gguqa5buS1fjGwSDSqYXfGrF6Jzh7\n82JxK9IPQQNQAaui6BzRYVL8g1jReFAiMv+soNTlTxYSC8B8qvpu0MoQhFRX\ngJuWgbgBjEQKXniP4rC4AOOcK2HwN3t/KUMYGyYq/dz1F2rbI9D+nvKy9X8V\n65+2EAddjtkvh8tpasCkmD5KMHDag8oWFoIkaQls+YatHzthO+AROcz1gZtS\n+XEx\r\n=kMsq\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","_from":"file:published/axway-flow-sdk@1.2.7.tgz","readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module)\n\t.add('encodeURI', {\n\t\tname: 'Encode URI',\n\t\ticon: 'encode.svg',\n\t\tdescription: 'URI encoder'\n\t})\n\t.method('encode', {\n\t\tname: 'Encode URI',\n\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t})\n\t.parameter('uri', {\n\t\ttype: 'string',\n\t\tdescription: 'The URI to encode.'\n\t})\n\t.output('encoded', {\n\t\tname: 'Encoded',\n\t\tdescription: 'The encoded URI.',\n\t\tcontext: '$.encodedURI',\n\t\tschema: {\n\t\t\ttype: 'string'\n\t\t}\n\t})\n\t.action((req, cb) => {\n\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t});\n```\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, options)](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, options) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| options | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis code is closed source and Confidential and Proprietary to Axway, Inc. All Rights Reserved. This code MUST not be modified, copied or otherwise redistributed without express written permission of Axway. This file is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement. Your right to use this software terminates when you terminate your Axway subscription.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc mocha ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage","build:dev":"npm run build:lint && npm run build:dist && npm run test","build:dist":"npm run build:readme && babel -d ./dist ./src","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},"_resolved":"","_integrity":"","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"6.1.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.11.3","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"1.1.2","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"2.2.7"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_1.2.7_1542124382832_0.8977014504587328","host":"s3://npm-registry-packages"}},"2.0.16":{"name":"axway-flow-sdk","version":"2.0.16","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.16","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"jvos-axway","email":"jvos@axway.com"},{"name":"neon-axway","email":"cshantakumar@axway.com"},{"name":"nkeranova","email":"nkeranova@axway.com"},{"name":"pboev-axway","email":"pboev@axway.com"},{"name":"vchauhan","email":"vchauhan@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"b5da154d3c018f85c39d0801da2cc4905abafde8","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.16.tgz","fileCount":16,"integrity":"sha512-Hfcqxj8l80zbWq5r6/zyTwo+In+8rchRE0xiudu5lHH5uxNTc70bFC+Os0GgJdrPKOMfR1PNJ0wFpMtEHYxmpg==","signatures":[{"sig":"MEYCIQD4IKwYQRa3Pci4s36pIiCZn7B2engomzR06KjA+xwKRQIhALifNboqAqyTDKj2AY1S4WtQtEBxuPNbefAiU5AqfaKW","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":45027,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcSyn9CRA9TVsSAnZWagAA6GYQAKQX1FSo2yRcDp5AqU/s\nfWA2UBsVpoyBY3mQu2DwQ2vnbELEQpkZY8cnAIkH7nLXEHS6WoK4nsgFrPGW\nuep0n7iDeTGdv75zFX1789xscxWEUEw+yZ3h4JD/JQSLwpcYkLMDDqS3mMc5\n7sR05LnZqx+VvyCCtKxgZDtnoqhUebGaHfrYPbcL0DoB4mbkn1Fpu4HDGqw8\n0yDl/0hAmpn6wpF8iC2rdoYtuYBzINLC3fGrzhz5peC+5oInB8g6UeC7Neis\nUL5j5bRdtsrA8f7PtucS6SyEnJYt7nr+xpOKIuHjCKQ94vP5cBIIyBLtAVeH\nC3Tdthw5422U8ov6KGpJLZxYrD2+ud7+n/fGxJEIgpVSv80CLDgcm2QPI+ha\nw1mRVcat5NQCNOAVo/RFczJOGwxyw448iBWCb6RzaZztBgxWLzeQIKWS0ub3\nH/JkMwMHZ7NlSWbDkvWFK9QD5YsXdf4osYkwZCmm8quIN6tcwanCTlZwOmvq\n6TPGVlJpxgcSV8aO7I50rRz24B1DUehRfsF253ub2tgZN2eYTq8+cHRdtgcr\nT4hm9M3eCjXEkHPY3L4aznX+fwLaoIVfhHKmEC9eSO07EtasoWxGu3V0gFd8\nkuydDcDl5Vi7TJupJQLB7nCqqhx8PkC3MBQlKCODOuonQ/MnJjkUWsWOjzYm\nve4I\r\n=1++N\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","_from":"file:published/axway-flow-sdk@2.0.16.tgz","readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node plugin\n* SDK for building custom flow-node plugins for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node plugin\n\nGenerates a new flow-node plugin named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd api-builder-plugin-fn-mynode\nnpm install --no-optional\nnpm run build (optional)\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes;\n```\n\nNotice that this encodeURI example is returning a function, `getFlowNodes`, that returns a promise. This allows for the generation of the flow-node to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been returned from `getFlowNodes` instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [Models](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/models.html), or registered\nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(flownodes) : <code>function</code>\nMocks an API Builder flow-node using the flow-node generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| flownodes | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the flow-node is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the flow-node's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow-node is asynchronous, i.e. returns a promise, the promise must be resolved to get the flow-nodes defined in the plugin. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst flownodesPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet flownodes;\nbefore(() => {\n\treturn flownodesPromise.then((resolvedFlownodes) => {\n\t\tflownodes = resolvedFlownodes;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst flownodes = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new flownode and prepares the `NodeBuilder` to accept the following flownode\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the flownode and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the flownode.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node flownode and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](module:axway-flow-sdk~handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](module:axway-flow-sdk~handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flownodes against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid flownodes.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## Changes\n#### axway-flow-sdk@2.0.9\n- RDPP-4757: Changed SCM repository and associated internal cleanup.\n\n## License\n\nThis 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](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.\n","engines":{"node":">= 8.9"},"gitHead":"0606cfaa67a01249e643baa202faeab60e2d3f99","scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"_resolved":"","_integrity":"","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"6.4.1","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.15.0","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"^2.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.16_1548429820912_0.41033506586641466","host":"s3://npm-registry-packages"}},"2.0.17":{"name":"axway-flow-sdk","version":"2.0.17","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@2.0.17","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"jvos-axway","email":"jvos@axway.com"},{"name":"neon-axway","email":"cshantakumar@axway.com"},{"name":"nkeranova","email":"nkeranova@axway.com"},{"name":"pboev-axway","email":"pboev@axway.com"},{"name":"vchauhan","email":"vchauhan@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"e51db21c6310df6ba491780c8445387cd693fe53","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-2.0.17.tgz","fileCount":16,"integrity":"sha512-xXQqkzOezZzUrNbLdU3RTrCzYZ+MKQGAFBcPetP5K8r+MQrKPbB7T7a1aYn+ZfUGeA0N9QZ53tSlWTyqltNHWg==","signatures":[{"sig":"MEUCIDKhAjIRGPrc4P7ULh01yB14b5356w153znvKPkXLSJqAiEAxZ4bgLAgqJlb36T6YWRkh+DVlGOp0GcKdTwZRMlDbEQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":45027,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcSzhaCRA9TVsSAnZWagAAt4YP/2d3uqafr7WkZ14AXLah\nBlNYq3jheAbIu2vPZ/QpSwBs0iLulZCpRyn1Yj28vX05leQug7zHzm/vUMpI\nV9BmPeQXD+mLSpfR+uOcDwWO3BUH3JMpi6Q+AQd+nK/4jDZqF/EikcvpqNIz\n2ykr2e4tgjzHwgdz3whdGoKgdl0On4bfVviDrV6Gv5OrIf/zwM7cctCB7gGL\nj7NE8matlS1JDSWLDwTJPOMH7+lEnDHtGoWrlYTQzsA1GlbJ68ZiG6uEG4QS\nprKAcLhGVYEqkMqEugp1r2OfSEjssGhN4khzPA69ZZ3hJtlugujfPNlPFs/k\nTBdgg99sUcWP99oOEj1mPunBhiRlJyrImOdfEL33buELI9aTLAnP2Z50ChI/\nyLtH9LWD0yzp/bIEUk2zrYMskpTbBKGScS7n4WgabhYSI8VmLSz6K/35BGUN\nX0q7RcWzCanqcSE4w3JqbzARg33YUOUGJwqCI3C+onzKi2pT1N63SZsh2M09\npR5VVvXeybghfAritXcfxeLCyl1XBjA/7gswOZTrMit3IfOzESs826GMRgmU\n5yGnUPVZGKaa2vt+g6rCuNeGiqpzzvEh6skf6osSMz/8UMqtKPVPfMoiVoPl\nYIeFYwtHwpceloVEEYAXOLCEMqHCFCdQKDeRvbQOg/4z/8ASbKbqASg37bF0\ndPnd\r\n=kRgJ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","_from":"file:published/axway-flow-sdk@2.0.17.tgz","readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node plugin\n* SDK for building custom flow-node plugins for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node plugin\n\nGenerates a new flow-node plugin named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd api-builder-plugin-fn-mynode\nnpm install --no-optional\nnpm run build (optional)\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes;\n```\n\nNotice that this encodeURI example is returning a function, `getFlowNodes`, that returns a promise. This allows for the generation of the flow-node to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been returned from `getFlowNodes` instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [Models](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/models.html), or registered\nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(flownodes) : <code>function</code>\nMocks an API Builder flow-node using the flow-node generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| flownodes | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the flow-node is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the flow-node's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow-node is asynchronous, i.e. returns a promise, the promise must be resolved to get the flow-nodes defined in the plugin. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst flownodesPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet flownodes;\nbefore(() => {\n\treturn flownodesPromise.then((resolvedFlownodes) => {\n\t\tflownodes = resolvedFlownodes;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst flownodes = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new flownode and prepares the `NodeBuilder` to accept the following flownode\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the flownode and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the flownode.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node flownode and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](module:axway-flow-sdk~handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](module:axway-flow-sdk~handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flownodes against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid flownodes.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## Changes\n#### axway-flow-sdk@2.0.9\n- RDPP-4757: Changed SCM repository and associated internal cleanup.\n\n## License\n\nThis 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](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.\n","engines":{"node":">= 8.9"},"gitHead":"4acfad047f2c6a2274d7ab9192764a4f6ccc5581","scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"_resolved":"","_integrity":"","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"6.4.1","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.15.0","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"^2.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_2.0.17_1548433498162_0.5329276668564229","host":"s3://npm-registry-packages"}},"3.0.0":{"name":"axway-flow-sdk","version":"3.0.0","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@3.0.0","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"jvos-axway","email":"jvos@axway.com"},{"name":"neon-axway","email":"cshantakumar@axway.com"},{"name":"nkeranova","email":"nkeranova@axway.com"},{"name":"pboev-axway","email":"pboev@axway.com"},{"name":"vchauhan","email":"vchauhan@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"78c51e7adced016343ba0250d5fcdd13dd75a7f3","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-3.0.0.tgz","fileCount":16,"integrity":"sha512-hUqgDF77tQKDsHiY86kcRK+TcEs9OOJflgl42QBlxS64DOgFziiAZzkC81QjLccC9EVoO8r4mnC6EIt5ZfQJew==","signatures":[{"sig":"MEYCIQD3YDW2V0MySb5LWukshpRnIIWNevxfFk9WI+nTki4augIhAKHV3nrnRWA8OwEE8G+fnvUdVQK+pFUyoOMVaRrb2YJz","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":47142,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcUxMnCRA9TVsSAnZWagAAF8MP/jYAM4GMMtW/UjQgb9Fz\n0mxmJUZWMZtDtv30RlPb3lXkaxi8pDUKb26DqhJg1aW1js0RfaINhjS0FGWd\nKSpFdfNQk8ymdcE+SbkiimdAFTQV+BEcYnZGl9HI5x9N/iIToz8yZzLovqNn\nQxVWzP02eQrB0RpIdCV9HLdrNEQReU3hyVCNrB6iqOg0nafxngguVCbR4oo2\nZupaHW5jKBZbLqgqZ4syTELYIz6+VPta8YVVny8PQx95trxhRcRtrwtyJ4rY\noWrbeAvuFZ/vMD4t1qtGEsgjpBCol4qaQgVpenKRL9MD4koqqjhHTUJ7m7ig\n44kW6wrQXopZ30bWH2QwSoJNlZNVC4T1wcVMpJo46nTRaMOOg/erwTYtHfNZ\nmX1P4vaH3X619wIzgW+CW/ESOMemgqhya4kTt5yO8C6w7VK9Jxqb/uoRs37x\nKTUQw4NMC8FwhfrZnDzKuqMDxX37jAcxPE+E8IeAA5Njiv9vamRT9Q4kyPox\nbid/QDywoKnPMaY+nqCfL+RlasomOttRohtnt/7uKxH45dZM275Sc8GelVwr\nNFG5xNTux8oX/T2qdaWQNSLna5L6GKnYkiVhASbGv05TozwHHbp86cYwzolN\n3So3JMd+LN/jZzvXrR7ZPkZgbwl3YCn+0y1NOkWf8DQoLUKaqzTqQLfzuh6+\n/5vY\r\n=/xsU\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","_from":"file:published/axway-flow-sdk@3.0.0.tgz","engines":{"node":">= 8.9"},"gitHead":"14870247a219c1d73855e722f063954e46913c49","scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 80 --branches 80 --functions 80","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"_resolved":"","_integrity":"","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"6.4.1","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.15.0","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"^5.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"devDependencies":{"axway-flow":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_3.0.0_1548948262658_0.8364582762986348","host":"s3://npm-registry-packages"}},"1.2.9":{"name":"axway-flow-sdk","version":"1.2.9","keywords":["amplify","api-builder","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@1.2.9","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"jvos-axway","email":"jvos@axway.com"},{"name":"neon-axway","email":"cshantakumar@axway.com"},{"name":"nkeranova","email":"nkeranova@axway.com"},{"name":"pboev-axway","email":"pboev@axway.com"},{"name":"vchauhan","email":"vchauhan@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"nyc":{"lines":80,"exclude":["dist/*.*"],"branches":80,"reporter":["lcov","text-summary"],"functions":80,"statements":80,"check-coverage":false},"dist":{"shasum":"33f20e210b7e723653e64458ce7eea59b7d0a16c","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-1.2.9.tgz","fileCount":16,"integrity":"sha512-QH08ax5+s2uz5/PM/dJjIbiuxpullvSjDnoPsTWaPW2+pwKuyeAzpCcn6BgCJ5QRvic8AUnopmi/CCqqCk8a/A==","signatures":[{"sig":"MEUCIApErOdOS2+NUJKWEhft9YSTpREesbFSb3Z/85I4qv2XAiEAlGMgJojhIiGAaRyK16MgGKE+h9PgNcjPqRbafwx8IJ4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":46044,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcVCZMCRA9TVsSAnZWagAAMFkP/Rrwuixl8NVERdkxoHq9\np8mwB5qlYhangoOd5KqXTtHjLaLmWKIjrrMH/j9GIZ7WQU5LEhQMtFy2aAO/\nCDpXejc2XzGeCNl60/1WNgKF2JsbSpcXiySNbKnS7YmO9TmcSlVxxTFoxIYY\nSjA7a6LErE0NJ7wLQugL3vWA/f0z/JsuluD6Y4bpOZXKKIURnX9+GFXSiRou\nlqGnoafo3LHDyCfxpAqEgnCmALxNpKsY386YvLAKMExxdSZjmUZ90h2QBC7G\niCUJnaNvI4HzxDqND+CLrnLuqaIdgDtQe31sY0e4eeiXXGGTiQXilOnKHxAV\n2jfLL9dWhqqTSTFq3blhLa7nGtjHlHYhRGVBZF7vqQ2RGI1VMkPrlzz1wEw1\nWrKy6nrfAvyuYbfLxPNMFZ3KGJm6RHZhgoMC4plOGreTYO69EVZHbtmTYfHw\nyUJ685YL0DA5fT4qnWLUZgHPpJDvYVMVvP7/M70aP9YIXoqvDZQcx6I7MYuO\nMhDs2j1x57DxY/NAvx1WTkNSfxq2xCLczvQEPsmFzOsxrjZrycDnK0nU36T1\nkBs6BN4O1yHpIMGuNNUZVUz2ytqcNUdsiv9HIxFUjWfi7338QtTDiIwHVhO9\nwIMuzqJKof8oH0iozLV3wCmupzx1leSZoHrOON/TIIlF+10cCk6cyY3OdlHJ\nfaAp\r\n=gRrT\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","_from":"file:published/axway-flow-sdk@1.2.9.tgz","readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module)\n\t.add('encodeURI', {\n\t\tname: 'Encode URI',\n\t\ticon: 'encode.svg',\n\t\tdescription: 'URI encoder'\n\t})\n\t.method('encode', {\n\t\tname: 'Encode URI',\n\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t})\n\t.parameter('uri', {\n\t\ttype: 'string',\n\t\tdescription: 'The URI to encode.'\n\t})\n\t.output('encoded', {\n\t\tname: 'Encoded',\n\t\tdescription: 'The encoded URI.',\n\t\tcontext: '$.encodedURI',\n\t\tschema: {\n\t\t\ttype: 'string'\n\t\t}\n\t})\n\t.action((req, cb) => {\n\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t});\n```\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, options)](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, options) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| options | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis code is closed source and Confidential and Proprietary to Axway, Inc. All Rights Reserved. This code MUST not be modified, copied or otherwise redistributed without express written permission of Axway. This file is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement. Your right to use this software terminates when you terminate your Axway subscription.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc mocha ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage","build:dev":"npm run build:lint && npm run build:dist && npm run test","build:dist":"npm run build:readme && babel -d ./dist ./src","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},"_resolved":"","_integrity":"","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"6.1.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.11.3","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"1.1.2","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"2.2.9"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_1.2.9_1549018700261_0.2327501018896505","host":"s3://npm-registry-packages"}},"1.2.10":{"name":"axway-flow-sdk","version":"1.2.10","keywords":["amplify","api-builder","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@1.2.10","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"jvos-axway","email":"jvos@axway.com"},{"name":"neon-axway","email":"cshantakumar@axway.com"},{"name":"nkeranova","email":"nkeranova@axway.com"},{"name":"pboev-axway","email":"pboev@axway.com"},{"name":"vchauhan","email":"vchauhan@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"nyc":{"lines":80,"exclude":["dist/*.*"],"branches":80,"reporter":["lcov","text-summary"],"functions":80,"statements":80,"check-coverage":false},"dist":{"shasum":"e8f33a0a97537848c98e49ef5cc864e36579adab","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-1.2.10.tgz","fileCount":16,"integrity":"sha512-FlKH/M+v1hXU/c4VvCxpzTZdygExhy9y6kxCS1JCdBafVcKjgxsJgXjiicBFaRdSeeQxfoY06zT4os4I6LfmKw==","signatures":[{"sig":"MEUCIG4VTYb0VN2fG/Y1+wJVTWzVK+kaSFkLMIOKCfOLPEnUAiEA41nTpyuUk972br4R+ALg2SPDVzNjih5VFWL1ZBeB8C0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":46098,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcYZbjCRA9TVsSAnZWagAAJzQP/jP8vQwbHOvJg3xYCDck\nMO0NTx9WoafltS0DtPpL5Lmvtyw+Dsa5gn3Gnb0Z2MSEZzJSnVf9pGjKUaS/\n1rOJuakcrqCsJtz7IWVsc/lGfzSI7OVc7Neb75R8LOGwBUThN/f4xs+hcpma\nXf2QgFaM2Ij50fwoGaoM3XC5jQS1wuiP6SnVWKXlVwDsrKWVoysy3DYEH0fY\nPvfd4V8pXxtXASMPpaUtqivQhndmnVGdtgdqTBSwlpoQgq6Sj3Ef0VCQEO0W\niw7IQlyh8YqZdqRajfHYHv377FENReSJrbDIHChYNgyfcv1m/ghSt6uy3pBK\n+LcfPM7oxrWLwuvsCv7pTqz9Ro987ti7HdEXSS/DE1bRvy+NKs4//cyilrER\nRM/wOFrAxnb9VYl9RXLNa5ErkMXWOKo/AUiO5zUAVDqZAu4bBpAqk52dqQyP\n3hpoMJc/miMRY7bhdUipPc5mEUwm9WzzvmiPCptsCrbpj6aDhsmrCO2E9Wyp\n6S1E39asIgaN6+IIda2tcNIYXQAWR2M6Ap87l2JBC66wNk3dIHjC/Km+kVIb\nGWm6tGvHn0DxVY2s3igM+ZHmiyJ5WEJWNp0Kfc/+Jd3AuCWjt3qMQ6ccoYB3\nrUe9moEOjh64LyVgn1w0o/EHZGceb7SlVUmH/wkt1wCdyiO+3sWyUGX270Rj\nGNCj\r\n=Gyca\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","_from":"file:published/axway-flow-sdk@1.2.10.tgz","readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module)\n\t.add('encodeURI', {\n\t\tname: 'Encode URI',\n\t\ticon: 'encode.svg',\n\t\tdescription: 'URI encoder'\n\t})\n\t.method('encode', {\n\t\tname: 'Encode URI',\n\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t})\n\t.parameter('uri', {\n\t\ttype: 'string',\n\t\tdescription: 'The URI to encode.'\n\t})\n\t.output('encoded', {\n\t\tname: 'Encoded',\n\t\tdescription: 'The encoded URI.',\n\t\tcontext: '$.encodedURI',\n\t\tschema: {\n\t\t\ttype: 'string'\n\t\t}\n\t})\n\t.action((req, cb) => {\n\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t});\n```\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, options)](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, options) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| options | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis code is closed source and Confidential and Proprietary to Axway, Inc. All Rights Reserved. This code MUST not be modified, copied or otherwise redistributed without express written permission of Axway. This file is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement. Your right to use this software terminates when you terminate your Axway subscription.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc mocha ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage","build:dev":"npm run build:lint && npm run check:used && npm run build:dist && npm run test","build:dist":"npm run build:readme && babel -d ./dist ./src","build:lint":"eslint .","check:used":"dependency-check ./package.json --no-dev --entry src/index.js","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},"_resolved":"","_integrity":"","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"6.1.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.11.3","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"1.1.3","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"2.2.10"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_1.2.10_1549899490603_0.7158997357154433","host":"s3://npm-registry-packages"}},"1.2.11":{"name":"axway-flow-sdk","version":"1.2.11","keywords":["amplify","api-builder","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@1.2.11","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"jvos-axway","email":"jvos@axway.com"},{"name":"mdimitrova","email":"mdimitrova@axway.com"},{"name":"neon-axway","email":"cshantakumar@axway.com"},{"name":"nkeranova","email":"nkeranova@axway.com"},{"name":"pboev-axway","email":"pboev@axway.com"},{"name":"vchauhan","email":"vchauhan@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"nyc":{"lines":80,"exclude":["dist/*.*"],"branches":80,"reporter":["lcov","text-summary"],"functions":80,"statements":80,"check-coverage":false},"dist":{"shasum":"a5a1de7fb0e9ac90e415b45d454d6766baf63f06","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-1.2.11.tgz","fileCount":16,"integrity":"sha512-KAM8e4JwlWdSOtgWcU07xPSm6y6sqn3C6q3iPN74oHaMcF8rKh5/qaUevPM9Kp8rsIOC6UJ7SnTFrZi58+ac1Q==","signatures":[{"sig":"MEUCIQCY+zbEkmPp4LGTX1AZffgziaLosBDBWqPgOIMWfyNRzgIgJjS1sOQa6V31v+mOEvij0E9KNnxQIFY1PBgS855OJlE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":46098,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcZwYkCRA9TVsSAnZWagAAwPsP/0JqIJbC/5/5XW9CCaA4\n+MbBR6DfCEBwfwYNa55XHQgX5HrXOc+80uo8loLe/wZEhkY/6QWYADNwixzy\nO0zDEqLdK4iZjklAQiN7x4H/eJZCEyTlPaC4zjIHkBMbR3hhCxttaxIlW68u\ndgxAjcQNwhYqwMGGeY6gBFE3JA3/rOGSaDfqWRJcunOQBqkyfaJwl6kj4rWd\n7xT397JGUvPD/J2L3C5r7Z8xJlm25oUk+hXigLMeAeuwwX76oh9xDjkxlMe3\nOKd1aFFN+/R9VonJnRNJ9TWEfJGmzusJtzOd5Vm5L84D9o/ihYI8PpJQWmwW\nCtzmW2qpdYvd0u96PyJxIhLXsAfJn1SDaEeBVhhsmGSv+mq9gC4Dh9uLGRnl\nwR9shpQePAKJ/gmYDA40q6aomifpGLDMhkKTOreC7jJR8DajD8dIsUlgpGjF\nz6e5WlMSI6NJC0SSobMjqHwbR0R+sB7AERIFHLfU8YrRLz56eclKDydfIPm/\nTjAVPEXKSfneRDdC3JDOc8h3qMjpHaLg3AqKDO1Jjb1NZPCydjSfVWf6ARPf\niT0HJ8XLNcCSRUbh9oZt2MSdJSAxMajWR2CV/g2AjKHYJR+ZpBisQTDINTwr\nXWfiAj9xprLe+zqYuVbpXS6KWyLuVnMlgVpVfXMqDB8K2pWh45ZfCTdj2LNE\n4/02\r\n=5RFk\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","_from":"file:published/axway-flow-sdk@1.2.11.tgz","readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module)\n\t.add('encodeURI', {\n\t\tname: 'Encode URI',\n\t\ticon: 'encode.svg',\n\t\tdescription: 'URI encoder'\n\t})\n\t.method('encode', {\n\t\tname: 'Encode URI',\n\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t})\n\t.parameter('uri', {\n\t\ttype: 'string',\n\t\tdescription: 'The URI to encode.'\n\t})\n\t.output('encoded', {\n\t\tname: 'Encoded',\n\t\tdescription: 'The encoded URI.',\n\t\tcontext: '$.encodedURI',\n\t\tschema: {\n\t\t\ttype: 'string'\n\t\t}\n\t})\n\t.action((req, cb) => {\n\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t});\n```\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, options)](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, options) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| options | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis code is closed source and Confidential and Proprietary to Axway, Inc. All Rights Reserved. This code MUST not be modified, copied or otherwise redistributed without express written permission of Axway. This file is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement. Your right to use this software terminates when you terminate your Axway subscription.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc mocha ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage","build:dev":"npm run build:lint && npm run check:used && npm run build:dist && npm run test","build:dist":"npm run build:readme && babel -d ./dist ./src","build:lint":"eslint .","check:used":"dependency-check ./package.json --no-dev --entry src/index.js","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},"_resolved":"","_integrity":"","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"6.1.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.11.3","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"1.1.3","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"2.2.11"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_1.2.11_1550255651898_0.4931557555970394","host":"s3://npm-registry-packages"}},"1.2.12":{"name":"axway-flow-sdk","version":"1.2.12","keywords":["amplify","api-builder","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@1.2.12","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"jvos-axway","email":"jvos@axway.com"},{"name":"mdimitrova","email":"mdimitrova@axway.com"},{"name":"neon-axway","email":"cshantakumar@axway.com"},{"name":"nkeranova","email":"nkeranova@axway.com"},{"name":"pboev-axway","email":"pboev@axway.com"},{"name":"vchauhan","email":"vchauhan@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"nyc":{"lines":80,"exclude":["dist/*.*"],"branches":80,"reporter":["lcov","text-summary"],"functions":80,"statements":80,"check-coverage":false},"dist":{"shasum":"38d02ab93b9add678d64fd01a4c3cd7382c71a51","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-1.2.12.tgz","fileCount":16,"integrity":"sha512-IcP7Ouox/x49xxsikHVIWojc9oM5UqdLJ6tty3Th6Qdf1mbg7flxVvBujNxWl8rXn1gn7FDagSbpYdqf4ZATrA==","signatures":[{"sig":"MEUCID/BNicDfURnq3UIWK1yTrenLPa7r9f0RwNtBiVgIGHLAiEA9a0lO12aFHahr2j/vyrgHXvv01KCxkV/jwg4QyTObsw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":46098,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcdHIMCRA9TVsSAnZWagAATYwP/1Pqond078x4sm/1xZgD\ncJnRwZxnzicIKFtxG0UGtnIscTeiOZI9sSLxEXugbVWzYvAPfttN2jT39Yo0\nLRzBEpYmS8Wd+16IQenFzbvwS4yRRbn2J3CAcj1P2tUAmKyWyuL9RECh6RVX\n28lY9Ak9nFUIVZtCIpIDqlWSKF0kb1QY3i/FxFUtuVVHhFxNxF/Sk3KlaHiV\nhiqRYJ4VvRX4l5V/ppM10tQujMRJIkAwpBPFDkq5AI1Tgc8EvovEnoaKuOxW\nmuEG3qYfltapSWvQKZU4jNi47swkWZd0TvCYJGPrIRv84dT5WxGFGiyiXACY\n3/c9KjZ+W+Aibb8ZC/8YrmTA9iG83Kc7pIQhwD+2ie2jP4sG8flcpi/0snTw\nhxSGodIHZs7FWVJB+y32nUhZe3Aiwz814ULThm4bdrzjj53plPNb6JSWLZhX\nZCrl7gF1NqFyoYD9+kr4aNkYebCzdltAdeOeG/fyYuHNViO8I++7IdEtUcH0\nPNYizB7fGeOlt8whkFYvDb50/23hLih8Gau+uMWT2lpuUeALLKV+tEjAdyEJ\n0qZiFTscX01gjpIgHi2kpIO9k44spO7d3Eu7d1R+0WDus+JMFJEfp5X34p1p\ngnMng2z89gjN+33elo2y3hqu0YD3BRVvh81aJhdTuIz7e1FCousgapEQj/pY\nUoQ5\r\n=nQz9\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","_from":"file:published/axway-flow-sdk@1.2.12.tgz","readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module)\n\t.add('encodeURI', {\n\t\tname: 'Encode URI',\n\t\ticon: 'encode.svg',\n\t\tdescription: 'URI encoder'\n\t})\n\t.method('encode', {\n\t\tname: 'Encode URI',\n\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t})\n\t.parameter('uri', {\n\t\ttype: 'string',\n\t\tdescription: 'The URI to encode.'\n\t})\n\t.output('encoded', {\n\t\tname: 'Encoded',\n\t\tdescription: 'The encoded URI.',\n\t\tcontext: '$.encodedURI',\n\t\tschema: {\n\t\t\ttype: 'string'\n\t\t}\n\t})\n\t.action((req, cb) => {\n\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t});\n```\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, options)](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, options) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| options | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis code is closed source and Confidential and Proprietary to Axway, Inc. All Rights Reserved. This code MUST not be modified, copied or otherwise redistributed without express written permission of Axway. This file is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement. Your right to use this software terminates when you terminate your Axway subscription.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc mocha ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage","build:dev":"npm run build:lint && npm run check:used && npm run build:dist && npm run test","build:dist":"npm run build:readme && babel -d ./dist ./src","build:lint":"eslint .","check:used":"dependency-check ./package.json --no-dev --entry src/index.js","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},"_resolved":"","_integrity":"","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"6.1.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.11.3","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"1.1.3","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"2.2.12"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_1.2.12_1551135243848_0.2696828841575205","host":"s3://npm-registry-packages"}},"3.1.0":{"name":"axway-flow-sdk","version":"3.1.0","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@3.1.0","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"jvos-axway","email":"jvos@axway.com"},{"name":"mdimitrova","email":"mdimitrova@axway.com"},{"name":"neon-axway","email":"cshantakumar@axway.com"},{"name":"nkeranova","email":"nkeranova@axway.com"},{"name":"pboev-axway","email":"pboev@axway.com"},{"name":"vchauhan","email":"vchauhan@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"69e4035a05ff6f67773e78a7b31a022589006d82","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-3.1.0.tgz","fileCount":16,"integrity":"sha512-0/ck6zXEgXulhUp+NduZmsX10PaaykT5M1HrK7g9wEi6XB9AGYbRnU4qam4gZgFBPoczsT4d3yfjMhut2D8OQg==","signatures":[{"sig":"MEQCIEF4dvq7xLmVG73RjXO41bMFY8KhznlQsOoRVh8rp7DgAiB+9jHxdMuhlajOMuLVryV1MunxEjKsxlteJsKddvFDgA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":48962,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJchlXqCRA9TVsSAnZWagAAVjoQAIrXPOLoueaF7KjIdBjB\nbfhW/8x5pgHTI84bZN9x+YigMuuaKVbbMkNxDHG/ltJhhEehr8cajG5wAopH\nkxF/uKeND230ucw6lEaUgSBBu9M+uSlE9GCFusuotJSwVRT3OCFVyrgq2PuE\n/AxxHxsS84xPCJKB1aANoDQ+28TmNp+Mds5JaCPTMdK+qNi0Om8jy5qEhGrR\nj9YzU6kJTFleG2S5eG1CcB7+jk3YKypCwNqf/DZhofqP9dy8zJ1l5dqR+Fzc\n8/FY5Gz5xK4OBUhA+Yu+Hc9j07Sc3YwKnTzRMM2mte30ldXeeidRhGTWitp0\ncoAR95gz3H0Ax3s5jAqS+IZSc3/fiPeVPQq4LcYaf3HhPzxocKoY42P1ztgQ\nfQL28RfZZV7N5oj5+KtrBaeru1pXueU3K4Vlx+4eZSNod3E2Bc6gAiTNug7t\ntr9jugtD1WEnOAkSIY1aJeDnQCCkLyESnhCstP9bZzpp81rNRgeh36oibaGA\nKZuLTL57Z0WXzIekwHrG8pVhPN7g/JsuRAZOj8Jug7ESSQpyrhjN3UYd1VpQ\nmiyNJA2GKPRkfwjcKfD+e2PWIm+xhpFhE5+7g1zfeDyXcPVDfH/AyO7YCMFn\nFU0RrI6NC7vebd8BDW1z9G6Fm9SFXW1xn64HNMXsb4WFEjUszzvPBqByNcVA\n3s+v\r\n=mgoV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","_from":"file:published/axway-flow-sdk@3.1.0.tgz","readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node plugin\n* SDK for building custom flow-node plugins for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node plugin\n\nGenerates a new flow-node plugin named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd api-builder-plugin-fn-mynode\nnpm install --no-optional\nnpm run build (optional)\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes;\n```\n\nNotice that this encodeURI example is returning a function, `getFlowNodes`, that returns a promise. This allows for the generation of the flow-node to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been returned from `getFlowNodes` instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [Models](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/models.html), or registered\nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(flownodes) : <code>function</code>\nMocks an API Builder flow-node using the flow-node generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| flownodes | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the flow-node is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the flow-node's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow-node is asynchronous, i.e. returns a promise, the promise must be resolved to get the flow-nodes defined in the plugin. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst flownodesPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet flownodes;\nbefore(() => {\n\treturn flownodesPromise.then((resolvedFlownodes) => {\n\t\tflownodes = resolvedFlownodes;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst flownodes = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule, [options])](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.group(name)](#module_axway-flow-sdk..NodeBuilder+group) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule, [options])\n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| srcModule | <code>object</code> |  | a node module |\n| [options] | <code>object</code> |  | The options for the builder. |\n| [options.validate] | <code>object</code> | <code>true</code> | The enables parameter validation.  Disable \tif you need to use refs. |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new flownode and prepares the `NodeBuilder` to accept the following flownode\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the flownode and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the flownode.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node flownode and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n**Example** *(Disable validation)*  \n```js\nsdk.init(module, { validation: false }).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { $ref: '#/definitions/foo' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+group\"></a>\n\n#### nodeBuilder.group(name) ⇒ <code>NodeBuilder</code>\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| name | <code>string</code> | A unique name for the parameter group as it will appear in the UI. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.group('Advanced')\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](module:axway-flow-sdk~handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](module:axway-flow-sdk~handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module, [options]) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| module | <code>object</code> |  | The node module. |\n| [options] | <code>object</code> |  | The options for the builder. |\n| [options.validate] | <code>object</code> | <code>true</code> | The enables parameter validation.  Disable \tif you need to use refs. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flownodes against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid flownodes.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## Changes\n#### 3.1.0\n- #5600: Support schema references by disabling validation when building flow-nodes.\n\n#### 3.0.0\n- #5436: Breaking Change: Minimum supported version of API Builder is now Jakarta\n- #5436: Moves advanced HTTP options into a new group, \"Advanced HTTP Options\"\n\n#### axway-flow-sdk@2.0.9\n- #4757: Changed SCM repository and associated internal cleanup.\n\n## License\n\nThis 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](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.\n","engines":{"node":">= 8.9"},"gitHead":"b47efa1af61f664e6677858f224f864248ebf126","scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 95 --branches 86 --functions 97 --statements 95","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"_resolved":"","_integrity":"","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"6.4.1","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.15.1","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"^5.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_3.1.0_1552307689929_0.2822978179201998","host":"s3://npm-registry-packages"}},"3.1.1":{"name":"axway-flow-sdk","version":"3.1.1","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@3.1.1","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"jvos-axway","email":"jvos@axway.com"},{"name":"mdimitrova","email":"mdimitrova@axway.com"},{"name":"neon-axway","email":"cshantakumar@axway.com"},{"name":"nkeranova","email":"nkeranova@axway.com"},{"name":"pboev-axway","email":"pboev@axway.com"},{"name":"vchauhan","email":"vchauhan@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"9a7026d4beeb676f698ebb4fc262ddf3ee46f63b","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-3.1.1.tgz","fileCount":16,"integrity":"sha512-YuD2l4Xs/S3iNIQ6eTv/GAivaRj/ZxUeQuaHhBv5JDbdWYCm1LP0/Ikwl3xAfuZB16i7t7XUiDD7Pr02wGJyQQ==","signatures":[{"sig":"MEUCIGmP9shNaY+Rj7Oj1I/squPXUkvm9F5k7ePnfWTTfypcAiEAggqr7z+oJiOz+OQS/oSeNU7+9m6TvIRFshijpdJt4g0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":48963,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJciPH2CRA9TVsSAnZWagAAbGEP/2L3pWqsQwNxKGKLwA1p\nrFE4IIHJdLhB4qWB0F8DKymXhqmhJPpqEQ4IW4fkwN9WZKni3YFQ6Zv3+yxG\ni1nnGFAlp9ezhMABZ8jN2+nPYb7C3s6QkN0haiCVVu43SjOnS3D98oTu5mGR\nJXSp6jHlxr4QZM+2vBsfdjdxXItPXOgDDC43FH5vmO9AfPC9DiwNJgW8K5VF\n2bMQPcE/rPzU57g3BgQXGGKxWbYlpnOr7QiQgddWPVtmIZJax7k6fAzkxsvC\nIPfcLdxk/lsd0hHOa32QakzGNhdEi1uTgo8M9kGMo+Elg/fQm085JjEJaG3D\n+aYvFtcbw/tzV/ylGqmV0if/zTLA/M284Ej5w+d3ORIJFbQ4DTKe+h/lEtDP\nBAaszPi5bD+6+ZDOQ9QOO+XalsTsGGBO5pl0II5byY+dBaSL4Rtf0n+/0blC\nAtMebLz/aKPbl43g/HMOW1bzGvuYVWqTBu3qHzaSQLixCmnaf/R50gadVjYg\nDOzIYK5/cf8VNJccTjAjfPzgzVCQmNAkt0t+Oe4dipvTzhs+HYCJqYcS12FF\nkwmax7hPgIlNzB2AQyntALqcE0aKiAqQYUUz5mv6h1tyXOA7EO4DFYw/3bvq\n+rsJGa9FNULVXGamqalpUMKqtbhQUxfY5d2ESZUGn86FEs+/HpblbwPPhFEJ\nfcAq\r\n=bNDJ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","_from":"file:published/axway-flow-sdk@3.1.1.tgz","engines":{"node":">= 8.9"},"gitHead":"a081a7234a36cee162d99fafaa23415de60a934a","scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 95 --branches 86 --functions 97 --statements 95","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"_resolved":"","_integrity":"","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"6.4.1","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.15.1","dependencies":{"ajv":"^5.3.0","dot":"^1.1.2","nomnom":"^1.8.1","axway-flow-schema":"^5.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"devDependencies":{"@axway/flow":"^6.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_3.1.1_1552478710088_0.5816844959657512","host":"s3://npm-registry-packages"}},"3.1.2":{"name":"axway-flow-sdk","version":"3.1.2","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@3.1.2","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"jvos-axway","email":"jvos@axway.com"},{"name":"mdimitrova","email":"mdimitrova@axway.com"},{"name":"neon-axway","email":"cshantakumar@axway.com"},{"name":"nkeranova","email":"nkeranova@axway.com"},{"name":"pboev-axway","email":"pboev@axway.com"},{"name":"vchauhan","email":"vchauhan@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"dist":{"shasum":"7517e5cfd81bb452099fa3a31bcb6ea1dedabde3","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-3.1.2.tgz","fileCount":12,"integrity":"sha512-TpCLAa3bj6O/3I+QXtCEDAcmSkUK0wqwQxAMZmsQK40R5xGC/pJnhn2CXhBeZvYkagl6WfispqnnSPVFCmiNxw==","signatures":[{"sig":"MEYCIQCYZ1BrmAkxTRY9YFrWKXRXDA6IcPfuwLYgVaIFgX4/YwIhAKa1ikpg+gk+jzOLEhbcvvL84XP1wHU95Kw1ncGl5Ea1","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":46575,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJczCihCRA9TVsSAnZWagAAC9sP/243KiNsCA2kBF7EfGUp\nv77N8uEn63T4wefDwy8FJCpmzG489TAea+qkWPPTxCkNSfo/EafdsaJBeLyr\nqTN5iZon3LB+/l0anuSQnfn3Mt2AOxsilRh/ezsOgvM6YvTGXlnQh4huzzN9\nje1h2/rOXs77ROaaMog/aotZAmB28L8c70Pl31rB2fTZud6jaFpHJg7IHqxl\nsCosAl5XDS1e36sA/l+nnkLk112Ek19PEIYBAg1xkXZ7sFuUK7YE5Ut4561z\nhHVnqGcBYu3LVY0+eGqrL2z0xZ3zJUZmrOCjyTecnAex4Z8VByqoyYvn33Ii\nVJMCM3wJAMvhvsGi4WXC+bCiq0CS7SdpIBimXnSn5Q4+GLd+rjax1oxADV35\nW8MHOPXQXDvnhgwnxp3mObKoY/QgXH5NM1SKatxOtqwkSs11JcfyY5CqKhEG\nPGCS5CQ0OWrpMl/sxDj5KDlKnlqhH9JLS6l5C4HH8kBrJbif6S6arh0mO252\ny6YzTGu9uGmCHgPipHSe5xyZGGeYY3A8ZKTb3Y0ayEAs+sY8imzD1lFSPn1B\nP8gjifo0n4I1x5kTkdP72ZgNiKfbFZmVqWHSRcVX4fGuPP+9lqWWiwM82saW\nsxxXLsq/j9FHsU5Kvx/yVYsmMLhon5m31qGKv0TmdVQL6uKFMr5A8MqXdNL7\ni1Qi\r\n=lPqQ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","_from":"file:published/axway-flow-sdk@3.1.2.tgz","readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node plugin\n* SDK for building custom flow-node plugins for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node plugin\n\nGenerates a new flow-node plugin named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd api-builder-plugin-fn-mynode\nnpm install --no-optional\nnpm run build (optional)\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes;\n```\n\nNotice that this encodeURI example is returning a function, `getFlowNodes`, that returns a promise. This allows for the generation of the flow-node to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been returned from `getFlowNodes` instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [Models](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/models.html), or registered\nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(flownodes) : <code>function</code>\nMocks an API Builder flow-node using the flow-node generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| flownodes | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the flow-node is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the flow-node's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow-node is asynchronous, i.e. returns a promise, the promise must be resolved to get the flow-nodes defined in the plugin. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst flownodesPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet flownodes;\nbefore(() => {\n\treturn flownodesPromise.then((resolvedFlownodes) => {\n\t\tflownodes = resolvedFlownodes;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst flownodes = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule, [options])](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.group(name)](#module_axway-flow-sdk..NodeBuilder+group) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule, [options])\n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| srcModule | <code>object</code> |  | a node module |\n| [options] | <code>object</code> |  | The options for the builder. |\n| [options.validate] | <code>object</code> | <code>true</code> | The enables parameter validation.  Disable \tif you need to use refs. |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new flownode and prepares the `NodeBuilder` to accept the following flownode\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the flownode and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the flownode.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node flownode and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n**Example** *(Disable validation)*  \n```js\nsdk.init(module, { validation: false }).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { $ref: '#/definitions/foo' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+group\"></a>\n\n#### nodeBuilder.group(name) ⇒ <code>NodeBuilder</code>\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| name | <code>string</code> | A unique name for the parameter group as it will appear in the UI. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.group('Advanced')\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](module:axway-flow-sdk~handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](module:axway-flow-sdk~handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module, [options]) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| module | <code>object</code> |  | The node module. |\n| [options] | <code>object</code> |  | The options for the builder. |\n| [options.validate] | <code>object</code> | <code>true</code> | The enables parameter validation.  Disable \tif you need to use refs. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flownodes against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid flownodes.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## Changes\n\n#### 3.1.2\n- #5742: Internal change to replace `dot` dependency with `ejs` when generating new flow-node plugins.\n\n#### 3.1.0\n- #5600: Support schema references by disabling validation when building flow-nodes.\n\n#### 3.0.0\n- #5436: Breaking Change: Minimum supported version of API Builder is now Jakarta\n- #5436: Moves advanced HTTP options into a new group, \"Advanced HTTP Options\"\n\n#### axway-flow-sdk@2.0.9\n- #4757: Changed SCM repository and associated internal cleanup.\n\n## License\n\nThis 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](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.\n","engines":{"node":">= 8.9"},"gitHead":"464b406181a2399aeec80b0fc35bff5cd156773e","scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary mocha  --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage --lines 95 --branches 86 --functions 97 --statements 95","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"_resolved":"","_integrity":"","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"6.4.1","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.16.0","dependencies":{"ajv":"^5.3.0","ejs":"^2.6.1","nomnom":"^1.8.1","axway-flow-schema":"^5.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"@axway/flow":"^6.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_3.1.2_1556883616480_0.45450426398672117","host":"s3://npm-registry-packages"}},"3.1.3":{"name":"axway-flow-sdk","version":"3.1.3","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@3.1.3","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"jvos-axway","email":"jvos@axway.com"},{"name":"mdimitrova","email":"mdimitrova@axway.com"},{"name":"neon-axway","email":"cshantakumar@axway.com"},{"name":"nkeranova","email":"nkeranova@axway.com"},{"name":"pboev-axway","email":"pboev@axway.com"},{"name":"vchauhan","email":"vchauhan@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"nyc":{"lines":95,"branches":86,"per-file":false,"functions":96,"statements":94},"dist":{"shasum":"33e02e08bea2a2b6364a9eadb5bbeeebd607a941","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-3.1.3.tgz","fileCount":12,"integrity":"sha512-Ewy86EkEs7o2dh8ytZxnywONBQX/8uCLfC/qcdwRGcmNoho+idzgouUtMbc5+ZosB6TREPDV8Nk0bjq3krp7NA==","signatures":[{"sig":"MEUCIDIjJUyvNbWmUKWrttFmSbOBKcsVMTJFhElkpeps0PVcAiEAthD/0NDh3V/wsTIulCepHi4eF8oYpjpHAwLInp30TQc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":46501,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc1cYuCRA9TVsSAnZWagAA8Y4P/izmDB6cBONMSG3+PIi+\nbQK2cXWymM2e+QePSr7Bjzk4kGXbm9tMaJuvcg81N3sDH0rhOimxXy+dUqn2\n5aOfeap35Yst2eUrDgNt+UE21aJcuEpNBnfHJUfABasJOUXHTQqaFezr0YMR\nPi5YSTWgkcM6BpC2//61gF1U1uWw3RTs5mOk6Gb9M4roe25cO8183+LUJboQ\n1e+NRVj3OkkPOfijG1VWz/43IDpeyNp1TA0XWsk6SlgkhcvSHUxFej7AHCTz\nfrR+5QjMNicYW++iXmT+5fi3JUzQERNTMH/bLnoa7IAgZAjPlVmp+FNn5gOR\n64iTCmVrjfpmXSFeqCHYiPiZ/8auq1GTZoZ33TTc0ZqyuIxlYGMTOCu4f1Eu\nWV0bQen+s1hhjnx+prLLYma2ZZ+v+K5xZPqKHWTkuxsJSc75i49QxHXPizpJ\nzFovqQsdOhFktlAv2ygiQGPZJxGaFg1AtBtnI7o5sriPRL5qHop3svDt7tPf\n/1KQuYwIfYqskpFRbhlRxfSTlo563UPQknz/6XpgGXcAK6G9JzwtYv6uB6GT\nSwU5QwmNGaVct3zzCjTbY2nmepUuVAxJHIVo66QsJVG6KbEpwtj53Kz0cd+z\nGJB0AHUuOwLWiyfIqYJPCpu6y29c96vJ7YtofB7YR8Ki0h4Pvu2tYj4WSTuc\ni4fE\r\n=bkAE\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","_from":"file:published/axway-flow-sdk@3.1.3.tgz","readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node plugin\n* SDK for building custom flow-node plugins for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node plugin\n\nGenerates a new flow-node plugin named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd api-builder-plugin-fn-mynode\nnpm install --no-optional\nnpm run build (optional)\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes;\n```\n\nNotice that this encodeURI example is returning a function, `getFlowNodes`, that returns a promise. This allows for the generation of the flow-node to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been returned from `getFlowNodes` instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [Models](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/models.html), or registered\nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(flownodes) : <code>function</code>\nMocks an API Builder flow-node using the flow-node generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| flownodes | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the flow-node is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the flow-node's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow-node is asynchronous, i.e. returns a promise, the promise must be resolved to get the flow-nodes defined in the plugin. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst flownodesPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet flownodes;\nbefore(() => {\n\treturn flownodesPromise.then((resolvedFlownodes) => {\n\t\tflownodes = resolvedFlownodes;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst flownodes = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule, [options])](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.group(name)](#module_axway-flow-sdk..NodeBuilder+group) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule, [options])\n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| srcModule | <code>object</code> |  | a node module |\n| [options] | <code>object</code> |  | The options for the builder. |\n| [options.validate] | <code>object</code> | <code>true</code> | The enables parameter validation.  Disable \tif you need to use refs. |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new flownode and prepares the `NodeBuilder` to accept the following flownode\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the flownode and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the flownode.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node flownode and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n**Example** *(Disable validation)*  \n```js\nsdk.init(module, { validation: false }).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { $ref: '#/definitions/foo' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+group\"></a>\n\n#### nodeBuilder.group(name) ⇒ <code>NodeBuilder</code>\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| name | <code>string</code> | A unique name for the parameter group as it will appear in the UI. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.group('Advanced')\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](module:axway-flow-sdk~handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](module:axway-flow-sdk~handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module, [options]) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| module | <code>object</code> |  | The node module. |\n| [options] | <code>object</code> |  | The options for the builder. |\n| [options.validate] | <code>object</code> | <code>true</code> | The enables parameter validation.  Disable \tif you need to use refs. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flownodes against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid flownodes.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## Changes\n\n#### 3.1.3\n- #5707: Internal cleanup to code coverage during build process.\n\n#### 3.1.2\n- #5742: Internal change to replace `dot` dependency with `ejs` when generating new flow-node plugins.\n\n#### 3.1.0\n- #5600: Support schema references by disabling validation when building flow-nodes.\n\n#### 3.0.0\n- #5436: Breaking Change: Minimum supported version of API Builder is now Jakarta\n- #5436: Moves advanced HTTP options into a new group, \"Advanced HTTP Options\"\n\n#### axway-flow-sdk@2.0.9\n- #4757: Changed SCM repository and associated internal cleanup.\n\n## License\n\nThis 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](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.\n","engines":{"node":">= 8.9"},"gitHead":"1ab8dbf479681b58af7d05ab55f9550686cf7ab2","scripts":{"test":"nyc mocha --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"_resolved":"","_integrity":"","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder-plugins","type":"git"},"_npmVersion":"6.4.1","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.16.0","dependencies":{"ajv":"^5.3.0","ejs":"^2.6.1","nomnom":"^1.8.1","axway-flow-schema":"^5.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"@axway/flow":"^6.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_3.1.3_1557513773331_0.9382480872034098","host":"s3://npm-registry-packages"}},"3.1.4":{"name":"axway-flow-sdk","version":"3.1.4","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@3.1.4","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"jvos-axway","email":"jvos@axway.com"},{"name":"mdimitrova","email":"mdimitrova@axway.com"},{"name":"neon-axway","email":"cshantakumar@axway.com"},{"name":"nkeranova","email":"nkeranova@axway.com"},{"name":"pboev-axway","email":"pboev@axway.com"},{"name":"vchauhan","email":"vchauhan@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"nyc":{"lines":95,"branches":86,"per-file":false,"functions":96,"statements":94},"dist":{"shasum":"7b252e15c9c444bfe101089634508d1e50a47bc6","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-3.1.4.tgz","fileCount":12,"integrity":"sha512-D68hKpT03D8aF+A+AXfLWdtuR5dKu0Mzvgb5BZDKv2/r90jfagzL/xSplKF0MmDGoTLTWnzSE8BClc1vef7g+Q==","signatures":[{"sig":"MEUCIQCWePZFEA7naJZkQYxzh19du/oJ5jzJFEOdgcxXe6SohwIgX6mC6yjF0O4x7WloZ/Hz7FYqA7AcwAWT+18samP7XWg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":46604,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc2ZEkCRA9TVsSAnZWagAALKkQAJPydeB3Y1Dq1OmlDmZZ\ndu861Xz7Hc8p2UpZPlHtytKekbPoAHFDp38k0kXbBOfTNuJvMuaOIHIz18h1\nfPLqOivCV6qQOjz8ldMZUMyMijZOUVireto7uOxodTGlKpq8OWkYho3tXgYW\nQC7SAcEqSxtzdv1PlApHBxo+fQgnbleF0ltr3i+efv/s6M4Kp5Ip/df+Pw3v\nKhGb0M3D5aJ12b4V76LY3lKtE2yYWDMhnm9aP9LUfzJieJ5LSRAlIvKFTno2\n1LNgICj78vlUTf+zJs28DvfI9KreMXhQy+dcZs6Hn2VAAJn8zBnNuFa3Fl35\nchiRLc4r9nCyVOETYyAnMgen7cn+vYx21IKwgFJqYjFO6O1GhKVxGhVti/QX\nnZXBAd6QXU19imryDXALyNCG7dWDWUkMzf68xPCHH1smnKRnMDliNrE3OehZ\nNsxRFT0F6Kl4BLpDo5GErNZKqJGf7gt7Km7PY7KK/DpihcgbrpIXnqhGJ+Dd\nIA6hMLUDHCbggcJT4j6Qp+dhTMAM7jdC0UbXY2+E0mTeC2M0AQ0BHXnieMWY\n9Sl1xl8V9zUvZojB+/S3N6N9eiuEk+lnhONTaxHlpPi9P4D0VuMvZ+hJCFcC\nJLnjAqwPoCiW0UEk8ecc8EV80Re9XgPqNk1As3IYyNp/JYsltv+9kHZI4NSU\n0Sx5\r\n=BGRV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","_from":"file:published/axway-flow-sdk@3.1.4.tgz","readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node plugin\n* SDK for building custom flow-node plugins for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node plugin\n\nGenerates a new flow-node plugin named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd api-builder-plugin-fn-mynode\nnpm install --no-optional\nnpm run build (optional)\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes;\n```\n\nNotice that this encodeURI example is returning a function, `getFlowNodes`, that returns a promise. This allows for the generation of the flow-node to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been returned from `getFlowNodes` instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [Models](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/models.html), or registered\nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(flownodes) : <code>function</code>\nMocks an API Builder flow-node using the flow-node generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| flownodes | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the flow-node is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the flow-node's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow-node is asynchronous, i.e. returns a promise, the promise must be resolved to get the flow-nodes defined in the plugin. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst flownodesPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet flownodes;\nbefore(() => {\n\treturn flownodesPromise.then((resolvedFlownodes) => {\n\t\tflownodes = resolvedFlownodes;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst flownodes = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule, [options])](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.group(name)](#module_axway-flow-sdk..NodeBuilder+group) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule, [options])\n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| srcModule | <code>object</code> |  | a node module |\n| [options] | <code>object</code> |  | The options for the builder. |\n| [options.validate] | <code>object</code> | <code>true</code> | The enables parameter validation.  Disable \tif you need to use refs. |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new flownode and prepares the `NodeBuilder` to accept the following flownode\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the flownode and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the flownode.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node flownode and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n**Example** *(Disable validation)*  \n```js\nsdk.init(module, { validation: false }).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { $ref: '#/definitions/foo' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+group\"></a>\n\n#### nodeBuilder.group(name) ⇒ <code>NodeBuilder</code>\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| name | <code>string</code> | A unique name for the parameter group as it will appear in the UI. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.group('Advanced')\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](module:axway-flow-sdk~handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](module:axway-flow-sdk~handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module, [options]) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| module | <code>object</code> |  | The node module. |\n| [options] | <code>object</code> |  | The options for the builder. |\n| [options.validate] | <code>object</code> | <code>true</code> | The enables parameter validation.  Disable \tif you need to use refs. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flownodes against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid flownodes.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## Changes\n\n#### 3.1.4\n- #5709: Internal changes to update eslint rules.\n\n#### 3.1.3\n- #5707: Internal cleanup to code coverage during build process.\n\n#### 3.1.2\n- #5742: Internal change to replace `dot` dependency with `ejs` when generating new flow-node plugins.\n\n#### 3.1.0\n- #5600: Support schema references by disabling validation when building flow-nodes.\n\n#### 3.0.0\n- #5436: Breaking Change: Minimum supported version of API Builder is now Jakarta\n- #5436: Moves advanced HTTP options into a new group, \"Advanced HTTP Options\"\n\n#### axway-flow-sdk@2.0.9\n- #4757: Changed SCM repository and associated internal cleanup.\n\n## License\n\nThis 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](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.\n","engines":{"node":">= 8.9"},"gitHead":"c62cb1347c50bc90ae0361829d5a6b3973e15044","scripts":{"test":"nyc mocha --colors ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"_resolved":"","_integrity":"","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder-plugins","type":"git"},"_npmVersion":"6.4.1","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.16.0","dependencies":{"ajv":"^5.3.0","ejs":"^2.6.1","nomnom":"^1.8.1","axway-flow-schema":"^5.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"@axway/flow":"^6.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_3.1.4_1557762339816_0.01970176283271141","host":"s3://npm-registry-packages"}},"3.1.5":{"name":"axway-flow-sdk","version":"3.1.5","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@3.1.5","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"jvos-axway","email":"jvos@axway.com"},{"name":"mdimitrova","email":"mdimitrova@axway.com"},{"name":"neon-axway","email":"cshantakumar@axway.com"},{"name":"nkeranova","email":"nkeranova@axway.com"},{"name":"pboev-axway","email":"pboev@axway.com"},{"name":"vchauhan","email":"vchauhan@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"nyc":{"lines":95,"branches":86,"per-file":false,"functions":96,"statements":94},"dist":{"shasum":"97770da7e62feb0281a20e66cd6ede8361db9d00","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-3.1.5.tgz","fileCount":12,"integrity":"sha512-IQ86kIOnx30G13wMfSw+Sjnlvqcm32ag7tQtx+qY+xpHttYuY7kIlzvpp7c6ZsM408HIvex41+CNnui56MQfCg==","signatures":[{"sig":"MEQCICqEuzS6LZreJ04sOWv0ac7KQjMf37pzM9wyca91mERsAiBeSdpPXfoCUrVCpqBZEYKo/j3PINtOd5hSOOjRcQaBlQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":46624,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc3BJNCRA9TVsSAnZWagAA9JQQAIxpZWNRF02pmCVOqwdP\nWZPvOSMzPPEngLctcJfLNZKYHrYUZ35w11e9dicVbAvwblCO/tosQD9Cmv8h\nyXmP8X9sD1oV+bxm8yQhKOz2KVFLMrOSvWU9/AKpO3jtEWdQCE57mZovmyGz\nuradc+Y/0jFN2Fe1hA996vyZOowpxUxC58vJLJBDIsRtxCNjJ28sHmc8TkGb\nZeIBzC/3fGejlS/DLsP+EnTrj/NAhpbSXDwbsDDtfBU9a6H2eslLPYv2Ja1k\neLFXqyHhcquk8Nid10pLHry0aoQ3gSHxMOAXEV4HhwebyT9K5kEDZD6GsrKu\nv0uxXuZGb/21CzI8GRLgA51pMBjqGB3LQRZhGG5XPJa12ycLBLrOBINK5pOs\nvP+/6dBA6SQnRCvopm764ZkCbgngrLhwUBcnTX/sGc5MPuWn1EbRqfm+DFby\nRKXp9B667IkASBSZIPjxNdc+Xuzd62lap7meaTQD01d+5RiXdwZJ00DXWCrI\ncgmDf+uMfWPtwNKeLHP+Gy+O7SvbxFlC9R8Zp8haMOfCfxR+SsQbVZ+KBnOy\n4/cxmtm27P+M4Bfxyv5jIEW/5Np/ugTx9+ZuQC1dXJBENIBrtGgH9boRc09T\naVPxjw2JYHj32IQolIuYmxb9nPDCb41dC5MsdAEAP3H+x/BJe2PqIEI+9mZf\n35bv\r\n=m0jJ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","_from":"file:published/axway-flow-sdk@3.1.5.tgz","readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node plugin\n* SDK for building custom flow-node plugins for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node plugin\n\nGenerates a new flow-node plugin named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd api-builder-plugin-fn-mynode\nnpm install --no-optional\nnpm run build (optional)\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes;\n```\n\nNotice that this encodeURI example is returning a function, `getFlowNodes`, that returns a promise. This allows for the generation of the flow-node to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been returned from `getFlowNodes` instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [Models](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/models.html), or registered\nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(flownodes) : <code>function</code>\nMocks an API Builder flow-node using the flow-node generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| flownodes | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the flow-node is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the flow-node's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow-node is asynchronous, i.e. returns a promise, the promise must be resolved to get the flow-nodes defined in the plugin. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst flownodesPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet flownodes;\nbefore(() => {\n\treturn flownodesPromise.then((resolvedFlownodes) => {\n\t\tflownodes = resolvedFlownodes;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst flownodes = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule, [options])](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.group(name)](#module_axway-flow-sdk..NodeBuilder+group) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule, [options])\n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| srcModule | <code>object</code> |  | a node module |\n| [options] | <code>object</code> |  | The options for the builder. |\n| [options.validate] | <code>object</code> | <code>true</code> | The enables parameter validation.  Disable \tif you need to use refs. |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new flownode and prepares the `NodeBuilder` to accept the following flownode\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the flownode and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the flownode.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node flownode and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n**Example** *(Disable validation)*  \n```js\nsdk.init(module, { validation: false }).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { $ref: '#/definitions/foo' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+group\"></a>\n\n#### nodeBuilder.group(name) ⇒ <code>NodeBuilder</code>\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| name | <code>string</code> | A unique name for the parameter group as it will appear in the UI. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.group('Advanced')\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](module:axway-flow-sdk~handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](module:axway-flow-sdk~handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module, [options]) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| module | <code>object</code> |  | The node module. |\n| [options] | <code>object</code> |  | The options for the builder. |\n| [options.validate] | <code>object</code> | <code>true</code> | The enables parameter validation.  Disable \tif you need to use refs. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flownodes against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid flownodes.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## Changes\n\n#### 3.1.5\n- #5708: Updated mocha configuration\n\n#### 3.1.4\n- #5709: Internal changes to update eslint rules.\n\n#### 3.1.3\n- #5707: Internal cleanup to code coverage during build process.\n\n#### 3.1.2\n- #5742: Internal change to replace `dot` dependency with `ejs` when generating new flow-node plugins.\n\n#### 3.1.0\n- #5600: Support schema references by disabling validation when building flow-nodes.\n\n#### 3.0.0\n- #5436: Breaking Change: Minimum supported version of API Builder is now Jakarta\n- #5436: Moves advanced HTTP options into a new group, \"Advanced HTTP Options\"\n\n#### axway-flow-sdk@2.0.9\n- #4757: Changed SCM repository and associated internal cleanup.\n\n## License\n\nThis 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](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.\n","engines":{"node":">= 8.9"},"gitHead":"04ab4f59b25e7b734fef0c63ee6e9b5508ba7ce9","scripts":{"test":"nyc mocha ./test","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","build:dev":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"_resolved":"","_integrity":"","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder-plugins","type":"git"},"_npmVersion":"6.4.1","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.16.0","dependencies":{"ajv":"^5.3.0","ejs":"^2.6.1","nomnom":"^1.8.1","axway-flow-schema":"^5.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"@axway/flow":"^6.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_3.1.5_1557926477141_0.6297215799628577","host":"s3://npm-registry-packages"}},"3.1.6":{"name":"axway-flow-sdk","version":"3.1.6","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@3.1.6","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"jvos-axway","email":"jvos@axway.com"},{"name":"mdimitrova","email":"mdimitrova@axway.com"},{"name":"neon-axway","email":"cshantakumar@axway.com"},{"name":"nkeranova","email":"nkeranova@axway.com"},{"name":"pboev-axway","email":"pboev@axway.com"},{"name":"vchauhan","email":"vchauhan@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"nyc":{"lines":95,"branches":86,"per-file":false,"functions":96,"statements":94},"dist":{"shasum":"d4a17f7703da8be715b67d79096a8d7c4dea67cb","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-3.1.6.tgz","fileCount":12,"integrity":"sha512-wXI7wifvXLuQMjkt49I/X7Mywms63ox33Q8aMYHQ5jlnXUum9ZyYMv0ah45/scwBh8q/Xt7d6EQQJZlpj7xSnw==","signatures":[{"sig":"MEQCIH6lxqsg3BRS+DHoeRsAxxLfjgueITaym+KsNoBqZEXcAiAe4y9mEl5+uAO6VBznNkH1vBMIb84GhEaRydcJnuIJPw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":46539,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc3CBRCRA9TVsSAnZWagAA2lYP/iZzY4Ojv4DRS1yo8ewY\nAbfK3yBh5fDPkGTastGLeIo8m/IBiIYCQbrCQJ+8XfairPmJTVKm5COvHl3g\n9w2ZNu755M9MouLXzqks3sJU5SihfXmW51V5gr1cQyLvMT2WXFD+Y65KzCFW\nNUxhsR9maGhidnBjqs2SQgsrV7a/dM3kHtkOStWl8Gl3G2+5Xxf42o9GMEMY\nWIQ9sTiU+attCEL4SRehN92oXZsKPNnSrL322mR7AUXYt6fKT7PtN46tFTMM\nrhCGhDmcwH+mqAUCxSWvvHjFbb/ZbluRi1M7L/aot1yt6MrD0QojBGDzWJ/5\nztpRjSOxroh1+DjWS5nsDDgYLeHdEVPIjk/TMJPhFf2WjDWzHb9pnGiCUVNx\n/usH+dCANtn9lE26EYXtcM8mA9z1GqtFux/3rKWgiygbkvBDIzkeKMltDeeH\nKphCZV6q+iVCjrb+wPZWY2gpto/Jki3PAUJSANP5uJhkrQwe4HNf+grC7/03\nY3QiS1OClGtYSvhVl5Ekymyce5Fm4vJujXHnKSVhesvTkah/k9p5NGscEXgh\npQ4px/3jhFFLJKvnYgI1gdB+5NKtJ9siQEHRNgtXVs0C+uzpCRTPJDdXC/9y\npeVvPHWf78u9vJn82bm9Uj7Zz2lf4q/BprZ7R9KGYU7yT4e6LhvuT2FbyKTH\nhSyb\r\n=qHAy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","_from":"file:published/axway-flow-sdk@3.1.6.tgz","readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node plugin\n* SDK for building custom flow-node plugins for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node plugin\n\nGenerates a new flow-node plugin named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd api-builder-plugin-fn-mynode\nnpm install --no-optional\nnpm run build (optional)\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes;\n```\n\nNotice that this encodeURI example is returning a function, `getFlowNodes`, that returns a promise. This allows for the generation of the flow-node to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been returned from `getFlowNodes` instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [Models](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/models.html), or registered\nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(flownodes) : <code>function</code>\nMocks an API Builder flow-node using the flow-node generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| flownodes | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the flow-node is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the flow-node's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow-node is asynchronous, i.e. returns a promise, the promise must be resolved to get the flow-nodes defined in the plugin. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst flownodesPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet flownodes;\nbefore(() => {\n\treturn flownodesPromise.then((resolvedFlownodes) => {\n\t\tflownodes = resolvedFlownodes;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst flownodes = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule, [options])](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.group(name)](#module_axway-flow-sdk..NodeBuilder+group) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule, [options])\n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| srcModule | <code>object</code> |  | a node module |\n| [options] | <code>object</code> |  | The options for the builder. |\n| [options.validate] | <code>object</code> | <code>true</code> | The enables parameter validation.  Disable \tif you need to use refs. |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new flownode and prepares the `NodeBuilder` to accept the following flownode\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the flownode and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the flownode.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node flownode and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n**Example** *(Disable validation)*  \n```js\nsdk.init(module, { validation: false }).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { $ref: '#/definitions/foo' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+group\"></a>\n\n#### nodeBuilder.group(name) ⇒ <code>NodeBuilder</code>\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| name | <code>string</code> | A unique name for the parameter group as it will appear in the UI. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.group('Advanced')\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](module:axway-flow-sdk~handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](module:axway-flow-sdk~handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module, [options]) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| module | <code>object</code> |  | The node module. |\n| [options] | <code>object</code> |  | The options for the builder. |\n| [options.validate] | <code>object</code> | <code>true</code> | The enables parameter validation.  Disable \tif you need to use refs. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flownodes against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid flownodes.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## Changes\n\n#### 3.1.6\n- #5708: Internal changes to get rid of generating readme if unnecesarry.\n\n#### 3.1.5\n- #5708: Updated mocha configuration.\n\n#### 3.1.4\n- #5709: Internal changes to update eslint rules.\n\n#### 3.1.3\n- #5707: Internal cleanup to code coverage during build process.\n\n#### 3.1.2\n- #5742: Internal change to replace `dot` dependency with `ejs` when generating new flow-node plugins.\n\n#### 3.1.0\n- #5600: Support schema references by disabling validation when building flow-nodes.\n\n#### 3.0.0\n- #5436: Breaking Change: Minimum supported version of API Builder is now Jakarta\n- #5436: Moves advanced HTTP options into a new group, \"Advanced HTTP Options\"\n\n#### axway-flow-sdk@2.0.9\n- #4757: Changed SCM repository and associated internal cleanup.\n\n## License\n\nThis 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](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.\n","engines":{"node":">= 8.9"},"gitHead":"6e926ec9eeedefb580722a7f7d862d8e95d8903d","scripts":{"test":"nyc mocha ./test","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","build:dev":"npm run build:lint && npm run test","build:lint":"eslint .","check:used":"dependency-check ./package.json","test:watch":"npm test -- --watch","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","build:lint:fix":"eslint . --fix","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"_resolved":"","_integrity":"","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder-plugins","type":"git"},"_npmVersion":"6.4.1","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.16.0","dependencies":{"ajv":"^5.3.0","ejs":"^2.6.1","nomnom":"^1.8.1","axway-flow-schema":"^5.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"@axway/flow":"^6.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_3.1.6_1557930065198_0.4327085565251376","host":"s3://npm-registry-packages"}},"3.1.7":{"name":"axway-flow-sdk","version":"3.1.7","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@3.1.7","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"jvos-axway","email":"jvos@axway.com"},{"name":"mdimitrova","email":"mdimitrova@axway.com"},{"name":"neon-axway","email":"cshantakumar@axway.com"},{"name":"nkeranova","email":"nkeranova@axway.com"},{"name":"pboev-axway","email":"pboev@axway.com"},{"name":"vchauhan","email":"vchauhan@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"nyc":{"lines":95,"branches":86,"per-file":false,"functions":96,"statements":94},"dist":{"shasum":"b0c5e5d94f66bbb0c6d10ef64d7db3d1c97e5cf6","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-3.1.7.tgz","fileCount":12,"integrity":"sha512-0qtcYM4XgumZzBMUdMGe2za2/FAZQStlKhh6V8CtSDQPBx1BOAYIvFNthGwuLa+yIBMiVC6qdO1T/n7jHi1Wnw==","signatures":[{"sig":"MEUCIQCj0LvmioupVG5W34C99y6ZZlQUBsyDbhpOMeeCT8kdBAIgDN8lpaRg5EhAdu6ACJ9XSc+bxr5IAnJiOszpgEkwQ1Y=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":46358,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc5VtlCRA9TVsSAnZWagAA9BsP/iKdbDfUspzIQndlXbN7\nL2Nmkx1slMNHmP120vOKrtlXU24M6FPcctt1CcP/cCrHLhUpq6j1S+Iv8Vkg\nVFSq5jTqz3p4SUDCoywi0hoIqFRxT19d8UiL/txezp43QVyytAyK2lbSDggm\nTJHecRTz4dPUbqzDEc+UE6q8I89EbdEVvo70Y60R7G6iTrkUJ/oS7U9TKdxu\nyE0UOf6VYuOY24fnDXS9Zx+BjmINuNCu6mT0m/U7fLbuNjywM4lvAinyeYpV\nm/FSdrN7PkhGdtrRa3L0Rw2Je2aPsZuhmFBu/e/5dwp+JP/PI/52pRwAjis+\nHfxo3vE2GFc/BYRqxu7bYROqA6pKbSVAbn5DLrU3Xk70chQq8CfQbXGBnAfj\nws0l/IqV25gnb2KqkBMZfs0+dW8B21pCKyfKN9C87hY7aJO0fe4PjUxQaTZK\nJgJCng8eHkloKSsXZOJaSrJFLtfygPxHuRq1wulW9yaozdY/hYM0zijcJ5VD\npHJMaLEb7LVa4XVyDf3X+RZ8QHcm0fNEXUlAcuGvI9GjErrFgtl377DcqkKV\nCQGSFH6RLrhnsR7eSlOZqUIypFRTazX6qPaB9T3ZJFiQboNgH00gd/Jv1eWu\nIPxU+pEI5pSvyFSmDYCd/5kCzrX3dpisRnXr0B9DJaaUmANU+mDyBbu2a6vU\nqN+M\r\n=K6Ja\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","_from":"file:published/axway-flow-sdk@3.1.7.tgz","engines":{"node":">= 8.9"},"gitHead":"efa6ee2c3beae11da58794c25cf0a8e7b32c87ee","scripts":{"test":"nyc mocha ./test","build":"npm run build:lint && npm run test","build:lint":"eslint .","test:watch":"npm test -- --watch","build:lint:fix":"eslint . --fix","check:dependencies":"npm-check -i chai -i chai-as-promised"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"_resolved":"","_integrity":"","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder-plugins","type":"git"},"_npmVersion":"6.4.1","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.16.0","dependencies":{"ajv":"^5.3.0","ejs":"^2.6.1","nomnom":"^1.8.1","axway-flow-schema":"^5.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"2.6.3","@axway/flow":"^6.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_3.1.7_1558535012711_0.8100016001115786","host":"s3://npm-registry-packages"}},"1.2.13":{"name":"axway-flow-sdk","version":"1.2.13","keywords":["amplify","api-builder","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@1.2.13","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"jvos-axway","email":"jvos@axway.com"},{"name":"mdimitrova","email":"mdimitrova@axway.com"},{"name":"neon-axway","email":"cshantakumar@axway.com"},{"name":"nkeranova","email":"nkeranova@axway.com"},{"name":"pboev-axway","email":"pboev@axway.com"},{"name":"vchauhan","email":"vchauhan@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"nyc":{"lines":80,"exclude":["dist/*.*"],"branches":80,"reporter":["lcov","text-summary"],"functions":80,"statements":80,"check-coverage":false},"dist":{"shasum":"e8f50ee6f4fcf05f71cf97c2016f0bc634f69f0a","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-1.2.13.tgz","fileCount":11,"integrity":"sha512-reTfM2Lxx8+IZw+bPtcK+WveZCdZTIxt7KJvI3hWAEWnJTZizzYkuBZw+6utO33qgfE1iRP4FPVI+V53FznQcA==","signatures":[{"sig":"MEUCIQCltWD39DQmg5LOUkP39toKPGfQxIt7at7prSW4Ipl98gIgOrvdOjb7KRj2s6XV7rw4xEJ+OeZcZmEBDF3cBEt9JvU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":43085,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc56SnCRA9TVsSAnZWagAAXKwP/1p7mybj7/q8qDr9a1p+\nfG4J2eBOdsOATjEBRHBs5eRywsRKRupU5NNVohX0W3RhYGXV6FGEah1pbbiP\neQIFQyV+K6uwMO6J4vUV7RWIqk3punjI9PyhZKRzQ8DNBtpCDB+5zEKUHR4h\nP9xCHDa/VThg8L5JpvvaBzJhj47X3cZni1aJwbj7Il3D8Zpa0JAFnu9KDFwL\nOzm/XlaRHXHGkZT0dGI9w4UlrYej565LpGIfSIGxNRuGlzCetgHOoKb2lGhP\n4ZyTkymiF1aXRSiZZfO5bpb4mHJLJ8shjcRYribGXKcFnqylEAlQZFhVtJy8\nAjLNVsW+6kdqrHylkYAj//f5YYF5mtTcZTpgkixHi0bKSdxGJp3rsfWLY4YW\nDvirhrhz6kOsHVDKhCHsRO8cNMve7bILswBNt6kB2NgyHu6K6ofcOpln5qcz\nxlt6AtvwYYj70o34YW8VkzvfePGImzQEy8Jd8FtDb1VK++YRR7xyhIfwSF89\nroS9PJgPwPe6pV9blzHqDuNIj8elk7z/vdQIhYRRSzXpQIyW6rOxp8S5GdOD\nojvYrXmXmBuDJHOgryxPIgwRzCIsHPnxnf7w9pkrgFtxGvYBqmvKK3otXDvb\nJ23PuYJJuDEL0ad1+YcY5mUz7zqWM9EMnOcEn6rj6A3DKtdktdsKi6d5k+98\nldvw\r\n=BbMQ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","_from":"file:published/axway-flow-sdk@1.2.13.tgz","readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node project\n* SDK for building custom modules for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node project\n\nGenerates a new flow-node project named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd mynode\nnpm install\nnpm run build\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module)\n\t.add('encodeURI', {\n\t\tname: 'Encode URI',\n\t\ticon: 'encode.svg',\n\t\tdescription: 'URI encoder'\n\t})\n\t.method('encode', {\n\t\tname: 'Encode URI',\n\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t})\n\t.parameter('uri', {\n\t\ttype: 'string',\n\t\tdescription: 'The URI to encode.'\n\t})\n\t.output('encoded', {\n\t\tname: 'Encoded',\n\t\tdescription: 'The encoded URI.',\n\t\tcontext: '$.encodedURI',\n\t\tschema: {\n\t\t\ttype: 'string'\n\t\t}\n\t})\n\t.action((req, cb) => {\n\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t});\n```\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [models](https://docs.axway.com/bundle/API_Builder_allOS_en/page/models.html), or registered \nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(specs) : <code>function</code>\nMocks an API Builder flow-node using the spec generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| specs | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the spec is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the spec's defined `output`, and ensures that the method invokes the correct\ncallback.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst specs = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(specs).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, options)](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| srcModule | <code>object</code> | a node module |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new node spec and prepares the `NodeBuilder` to accept the following spec\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the spec and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the spec.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node spec and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, options) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| options | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](#module_axway-flow-sdk..handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](#module_axway-flow-sdk..handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| module | <code>object</code> | The node module. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flow-node specs against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid specs.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n<a name=\"module_axway-flow-sdk..handler\"></a>\n\n### axway-flow-sdk~handler : <code>function</code>\nA handler function to perform the node method's action.  The function will receive all\nof the provided parameters in `req.params`.  If any parameters are not provided, or are\nof the wrong time, or some have defaults, your function will need to handle those\nsituations.  On success, your function should invoke one of the named `output`.  On error,\nyour function should invoke the callback with a non-null `err` value.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| req | <code>Request</code> | The [`Request`](#module_axway-flow-sdk..Request) \t\tobject. |\n| cb | <code>flowCallback</code> | The output \t\t[`callback`](#module_axway-flow-sdk..flowCallback). |\n\n**Example**  \n```js\ncb.encoded(null, uncodeURI(req.params.uri));\n```\n**Example**  \n```js\ncb('error!');\n```\n<a name=\"module_axway-flow-sdk..flowCallback\"></a>\n\n### axway-flow-sdk~flowCallback : <code>function</code>\nA callback function that your method\n\t\t[`handler`](#module_axway-flow-sdk..handler) must invoke.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [err] | <code>\\*</code> | A non `null` value indicates a terminal error (flow processing will stop). |\n| [value] | <code>\\*</code> | The output value to be written back to the flow processing context. |\n\n<a name=\"module_axway-flow-sdk..Request\"></a>\n\n### axway-flow-sdk~Request : <code>object</code>\nThe request object.\n\n**Kind**: inner typedef of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| env | <code>object</code> | The application configuration. |\n| params | <code>object</code> | The method params, as supplied during runtime \t\t(see [.parameter](#module_axway-flow-sdk..NodeBuilder+parameter)). |\n\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## License\n\nThis code is closed source and Confidential and Proprietary to Axway, Inc. All Rights Reserved. This code MUST not be modified, copied or otherwise redistributed without express written permission of Axway. This file is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement. Your right to use this software terminates when you terminate your Axway subscription.\n","engines":{"node":">= 8.9"},"scripts":{"test":"shx rm -rf coverage .nyc_output && cross-env NODE_ENV=test nyc mocha ./test --recursive -R spec","build":"npm run clean && npm run build:dev && npm run check:dependencies","clean":"shx rm -rf coverage","posttest":"nyc check-coverage","build:dev":"npm run build:lint && npm run check:used && npm run build:dist && npm run test","build:dist":"npm run build:readme && babel -d ./dist ./src","build:lint":"eslint .","check:used":"dependency-check ./package.json --no-dev --entry src/index.js","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","check:unused":"dependency-check ./package.json --unused --no-dev -i deep-equal","check:dependencies":"npm run check:used && npm run check:unused"},"_npmUser":{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},"_resolved":"","_integrity":"","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder","type":"git"},"_npmVersion":"6.1.0","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.11.3","dependencies":{"ajv":"^5.3.0","ejs":"^2.6.1","nomnom":"^1.8.1","axway-flow-schema":"1.1.3","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axway-flow":"2.2.13"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_1.2.13_1558684839160_0.886128652729701","host":"s3://npm-registry-packages"}},"3.1.8":{"name":"axway-flow-sdk","version":"3.1.8","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@3.1.8","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"jvos-axway","email":"jvos@axway.com"},{"name":"mdimitrova","email":"mdimitrova@axway.com"},{"name":"neon-axway","email":"cshantakumar@axway.com"},{"name":"nkeranova","email":"nkeranova@axway.com"},{"name":"pboev-axway","email":"pboev@axway.com"},{"name":"pdzhorev","email":"pdzhorev@axway.com"},{"name":"vchauhan","email":"vchauhan@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"nyc":{"lines":95,"branches":86,"per-file":false,"functions":96,"statements":94},"dist":{"shasum":"64427342f96d9ea8b193559123a68534d04a3181","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-3.1.8.tgz","fileCount":14,"integrity":"sha512-HB9kV9E44R2kQLPSSZLc4EsFuvKkTbmZFSnF+5w7bNWSbTLR3Xa5i5UdPvr3a0SYOAx47zTWi/T9NK52rAiIIg==","signatures":[{"sig":"MEUCIFOA9AdGRoWO0yIZJ3G+lpbYXklBgerVydF7kUd30PNzAiEA627W2PvUg+vnvXOOazYDRfrjuut38/Mu7WGgt8Ns3mQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":48311,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdHeXXCRA9TVsSAnZWagAAHdgP/R3nXiQNCrcA+xhclUE0\nSjc/mw+x4QqJIbVyRbEMZehQc4LMb4xH6FJTb6TdjiMxU8GgaEHmcHKyUO1R\nZgrr9BMOoYueNCLCSeW0ZqvRH9CLWp06OMUgKIKFmzLLkSoOXqxVJG4VFXhy\nVBVzqsKgbZeia5tNrs14v8S/LmmdykJ8qTv9M1sAU/7TtRGZfNyWiKAVAAnW\n3z+qbR62yEU3ziccgeBIZ0ZLnoeeQ40zha2GTH8unab3vva7vYUj8nH7mM2n\nHGmM33M84ioQiLQ452Thslaa7UBfB2GT6puRVySpQ1/jcmKySZaYRFEbY7Rk\nf5+NG72kqA2mObHuZH+C2h/F/u43iWBtXi2tXSnKGG9IJbJ9+YiUxFVqzkcW\np8b+TkPdvbmWQDgNcyVng3mZHng0lo7S5vqoWJ8TVLOUUftKCRFOqWJgAHfc\n+UKt9LMn8t97X91oT6+p6flQg4MDqDk77Ph9xpZquW2KM4FvH1ZmDPcOiwJ3\nIVeN1p7SI0zoMb5mr5Th7FPyF9ejqCesdEAY3B37huYix9bDx7I6NI4qj4VH\nQFP+q4yyrKWYgjaGGCVieciSiEmILXtwspbCSdjC3lZCybfTpA7lF2ibtYYJ\nF5h2DbeNfpHwv7slBZzclrK/lOMTi76a6I7IsZkAPJMspDsGocwoD5VWEWXB\nIOma\r\n=nrKs\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","_from":"file:published/axway-flow-sdk@3.1.8.tgz","readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node plugin\n* SDK for building custom flow-node plugins for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node plugin\n\nGenerates a new flow-node plugin named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd api-builder-plugin-fn-mynode\nnpm install --no-optional\nnpm run build (optional)\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes;\n```\n\nNotice that this encodeURI example is returning a function, `getFlowNodes`, that returns a promise. This allows for the generation of the flow-node to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been returned from `getFlowNodes` instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [Models](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/models.html), or registered\nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(flownodes) : <code>function</code>\nMocks an API Builder flow-node using the flow-node generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| flownodes | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the flow-node is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the flow-node's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow-node is asynchronous, i.e. returns a promise, the promise must be resolved to get the flow-nodes defined in the plugin. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst flownodesPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet flownodes;\nbefore(() => {\n\treturn flownodesPromise.then((resolvedFlownodes) => {\n\t\tflownodes = resolvedFlownodes;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst flownodes = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)\n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule, [options])](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.group(name)](#module_axway-flow-sdk..NodeBuilder+group) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule, [options])\n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| srcModule | <code>object</code> |  | a node module |\n| [options] | <code>object</code> |  | The options for the builder. |\n| [options.validate] | <code>object</code> | <code>true</code> | The enables parameter validation.  Disable \tif you need to use refs. |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new flownode and prepares the `NodeBuilder` to accept the following flownode\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the flownode and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the flownode.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)\n**Returns**: <code>NodeBuilder</code> - The current object (this).\n**Access**: public\n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**\n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node flownode and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)\n**Returns**: <code>NodeBuilder</code> - The current object (this).\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**\n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n**Example** *(Disable validation)*\n```js\nsdk.init(module, { validation: false }).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { $ref: '#/definitions/foo' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+group\"></a>\n\n#### nodeBuilder.group(name) ⇒ <code>NodeBuilder</code>\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)\n**Returns**: <code>NodeBuilder</code> - The current object (this).\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| name | <code>string</code> | A unique name for the parameter group as it will appear in the UI. |\n\n**Example**\n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.group('Advanced')\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)\n**Returns**: <code>NodeBuilder</code> - The current object (this).\n**Access**: public\n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**\n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)\n**Returns**: <code>NodeBuilder</code> - The current object (this).\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**\n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](module:axway-flow-sdk~handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)\n**Returns**: <code>NodeBuilder</code> - The current object (this).\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](module:axway-flow-sdk~handler) \t\tfunction. |\n\n**Example**\n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module, [options]) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)\n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object\n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| module | <code>object</code> |  | The node module. |\n| [options] | <code>object</code> |  | The options for the builder. |\n| [options.validate] | <code>object</code> | <code>true</code> | The enables parameter validation.  Disable \tif you need to use refs. |\n\n**Example**\n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flownodes against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)\n**Throws**:\n\n- <code>Error</code> If nodes contains invalid flownodes.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**\n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n\n## Author\n\nAxway <support@axway.com> https://axway.com\n\n## Changes\n\n#### 3.1.8\n- #5895: Fix issue where new Flow-Node projects would not get generated with a `test` directory.\n\n#### 3.1.7\n- #5711: Internal cleanup of npm scripts.\n\n#### 3.1.6\n- #5708: Internal changes removing readme autogeneration.\n\n#### 3.1.5\n- #5708: Internal changes to mocha configuration.\n\n#### 3.1.4\n- #5709: Internal changes to update eslint rules.\n\n#### 3.1.3\n- #5707: Internal cleanup to code coverage during build process.\n\n#### 3.1.2\n- #5742: Internal change to replace `dot` dependency with `ejs` when generating new flow-node plugins.\n\n#### 3.1.0\n- #5600: Support schema references by disabling validation when building flow-nodes.\n\n#### 3.0.0\n- #5436: Breaking Change: Minimum supported version of API Builder is now Jakarta\n- #5436: Moves advanced HTTP options into a new group, \"Advanced HTTP Options\"\n\n#### axway-flow-sdk@2.0.9\n- #4757: Changed SCM repository and associated internal cleanup.\n\n## License\n\nThis 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](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.\n","engines":{"node":">= 8.9"},"gitHead":"7d9d6ddb3525b28eebfd9f2bedcd67630f7f4015","scripts":{"test":"nyc mocha ./test","build":"npm run build:lint && npm run test","build:lint":"eslint .","test:watch":"npm test -- --watch","build:lint:fix":"eslint . --fix","check:dependencies":"npm-check -i chai -i chai-as-promised"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"_resolved":"","_integrity":"","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder-plugins","type":"git"},"_npmVersion":"6.4.1","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.16.0","dependencies":{"ajv":"^5.3.0","ejs":"^2.6.1","nomnom":"^1.8.1","axway-flow-schema":"^5.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"rimraf":"2.6.3","@axway/flow":"^6.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_3.1.8_1562240470609_0.0020151433256279105","host":"s3://npm-registry-packages"}},"3.1.9":{"name":"axway-flow-sdk","version":"3.1.9","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@3.1.9","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"jvos-axway","email":"jvos@axway.com"},{"name":"mdimitrova","email":"mdimitrova@axway.com"},{"name":"neon-axway","email":"cshantakumar@axway.com"},{"name":"nkeranova","email":"nkeranova@axway.com"},{"name":"pboev-axway","email":"pboev@axway.com"},{"name":"pdzhorev","email":"pdzhorev@axway.com"},{"name":"vchauhan","email":"vchauhan@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"nyc":{"lines":95,"branches":86,"per-file":false,"functions":96,"statements":94},"dist":{"shasum":"7ace4ad1d9cb54971e62e766281a14b60d0fc306","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-3.1.9.tgz","fileCount":14,"integrity":"sha512-d2CTvESi2jli6HjEzC09P6Wp5Q1u4ICK6hBtlj0+nYNN9wvThrE4x6y/udFSdjtiWiDegloxML/WTsdyDFjg0Q==","signatures":[{"sig":"MEUCIEPHai3ULI0yZMbU+fL4cuOPNyUf0rJRegT1Yigmmhc+AiEAle5PC6z0oV+jzv5zWy31Yb6Axr4Cl4XpUZEEfgJf9Qk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":48342,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdHzlbCRA9TVsSAnZWagAAKb0P/jcldXHGnCH2jbDgamuR\nN5cbSiFJfBmTqxYH56PSTtPmKXAXWAD0ZGFbgf+PFoeVHWCHwoIBrmjziYqB\nF5nluA9bxYP2l417gsHunT+9iFnWkNaCdTqPGdv9pQ429I0Pq1Slh47BxMwW\nFMhmkhATEV/xkTounLUgwTojuKDsTvKNnyiW+a74jmGrv875dNUIylf5UAg6\nzmlTpYbb3paWPTuraDW0MLSH7aTx7YUL1PU5RTZCqEjCIcOH0Rd2xUUXVzu1\nT0ja6hij97YpGEL+H6wnIzwXUwvl+9iehd2XGjCj4n7j3zUJEyR1w0smyy78\nP1rU95T6ECzlP9wuudpzA7avZEVQyJNEWKpt6GamB0PO8PBRkW0RBnHB5gaK\n3QMJssh7YxNOUK+AiAM1Wohns0sgqxTORGva3cD34LScLjXM3TSwM3NwIXWL\npF0KBIdqnyS0gnWpKn6ZqoByj/QSbQXvgXcEDw8iDnGgx22n12zLhokFp3Wt\nLDZdSr0pHfELld26zyUX9b/R4kvH1cVDYwmpVSkoRvge+QT4myWyp0Yxwkhd\nwNAZRhIFFAuoTIpxZ7tGzefXvZnA+bpw48CeCMk9qMeKB7GQcZjReupM9Nis\nCiz/m7XVyNaVQaxexwO61VIdssp1sFCa6cu8XpcQK3zNszP6bHJOQAKPWYxE\nsIzB\r\n=CSEK\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","engines":{"node":">= 8.9"},"scripts":{"test":"nyc mocha ./test","build":"npm run build:lint && npm run test","build:lint":"eslint .","test:watch":"npm test -- --watch","build:lint:fix":"eslint . --fix","check:dependencies":"npm-check -i chai -i chai-as-promised"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder-plugins","type":"git"},"_npmVersion":"6.4.1","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"10.14.0","dependencies":{"ajv":"^5.3.0","ejs":"^2.6.1","nomnom":"^1.8.1","axway-flow-schema":"^5.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"2.6.3","@axway/flow":"^6.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_3.1.9_1562327387147_0.4802425366444927","host":"s3://npm-registry-packages"}},"3.1.10":{"name":"axway-flow-sdk","version":"3.1.10","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@3.1.10","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"jvos-axway","email":"jvos@axway.com"},{"name":"mdimitrova","email":"mdimitrova@axway.com"},{"name":"neon-axway","email":"cshantakumar@axway.com"},{"name":"nkeranova","email":"nkeranova@axway.com"},{"name":"pboev-axway","email":"pboev@axway.com"},{"name":"pdzhorev","email":"pdzhorev@axway.com"},{"name":"vchauhan","email":"vchauhan@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"nyc":{"lines":95,"branches":86,"per-file":false,"functions":96,"statements":94},"dist":{"shasum":"089b16d53574ea7e7e18e13e9068691670883fed","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-3.1.10.tgz","fileCount":13,"integrity":"sha512-nQsvpI6m/9sCjKdDVZTllG0z9TOBgBht+mqDlfjXU288JAmfrh13MsUwi9NzmBg3BeXTxOKKG7v8IBol1zNvNg==","signatures":[{"sig":"MEQCIC25wm7Fy/sLyL2nrjJClQn8pBGpdJT8xzMnaPvz1P1PAiAG0cZiFN5trFPDRPfDljjXBvNxc2uZgcZHdPIKrWy/HQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":30574,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdLxcqCRA9TVsSAnZWagAAC2gP/2HZtqNYK5KIjMKuKXep\nXrhpzHwSLi5zC3GAgmWVjuKURqfmBqbIZjYgOVDNSvd39Kyvnd3dVedGaJsh\ncWUZ6WV0rSZoYSYQ//IlNjtsrZWsP51QQvHZMg8Pv8yO1tUr7qv0ZWICxep3\n9T8ULv8SsnX1RjNqpbiwTIzcH0u6Fbxuoat/hyPrSX6iLup1xKS5hck0gDJ2\nqvWsdoUpLikdYzbJqdau76UtSpb3lANEZMEV523je3T6szgYdQ8fgilmKufg\nFc6LrQim0MwJMu8NoIfrtPYzPIF/8Ys6AJGvZsiRoiomJXNK7EwKORRrkJig\n93spiMy12TgMKy5aEvzktTwmtLcsg2AnE2PMOuorzsfitwBCUd/fFCJfbPeU\nR2If9Uf/u+lKMx8Kw7HYMLD7yi6qgyZKGmf0wDmFqC+EQKiZk82ZZuYMC8M3\nOCMTTuwBS4AG70IK46sBC/AHKgmWCdFwAXcLQKzkhOCEXKww8HyOQ6tveJb9\nOKCQ2RDdNGsuqcJbsf7R+oDhidwGXdUYAns0KwDUjjhFIeOC4K8o+Jn23Fg6\neJG03jiFKruJyOeAmLlHgzP0vS9JAoOmVRKw/hJQYSNk21+B90nZ+a/onSlJ\n3r8os4AkHfCWIokmt22lFaG9KbxBC8eaoSNg2pamP0ha/RQDvFcnOYHfRce4\n6c1e\r\n=394g\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","_from":"file:published/axway-flow-sdk@3.1.10.tgz","readme":"ERROR: No README data found!","engines":{"node":">= 8.9"},"gitHead":"84d5984159789264cca742dbc1947e4eed888cfd","scripts":{"test":"nyc mocha ./test","build":"npm run build:lint && npm run test","build:docs":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","build:lint":"eslint .","test:watch":"npm test -- --watch","build:lint:fix":"eslint . --fix","check:dependencies":"npm-check -i chai -i chai-as-promised"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"_resolved":"","_integrity":"","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder-plugins","type":"git"},"_npmVersion":"6.4.1","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.16.0","dependencies":{"ajv":"^5.3.0","ejs":"^2.6.1","nomnom":"^1.8.1","axway-flow-schema":"^5.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"2.6.3","@axway/flow":"^6.0.0","node-readme":"^0.1.9"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_3.1.10_1563367209726_0.3909488517836808","host":"s3://npm-registry-packages"}},"3.1.11":{"name":"axway-flow-sdk","version":"3.1.11","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@3.1.11","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"jvos-axway","email":"jvos@axway.com"},{"name":"mdimitrova","email":"mdimitrova@axway.com"},{"name":"neon-axway","email":"cshantakumar@axway.com"},{"name":"nkeranova","email":"nkeranova@axway.com"},{"name":"pboev-axway","email":"pboev@axway.com"},{"name":"pdzhorev","email":"pdzhorev@axway.com"},{"name":"vchauhan","email":"vchauhan@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"nyc":{"lines":95,"branches":86,"per-file":false,"functions":96,"statements":94},"dist":{"shasum":"fc62d9b65db4783009602e0f228bc4913799e246","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-3.1.11.tgz","fileCount":14,"integrity":"sha512-pkOuNfDjilLqgT/IvgRRIMK7RxDl4wvfbBFxgAearfsLMmQ4jwC8K3UlE0AMKQ9gjSieuOxCxSyq3Ez7lVRCHQ==","signatures":[{"sig":"MEUCIB7pZyG4aIfVYsZHmhXMWWrXvV0cqcYIY/iv3vP2iKUbAiEAvCcZs2QyASjRFemyWjtFWj7/r3VzHObsC1dhiq5NfBU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":48811,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdMHr8CRA9TVsSAnZWagAA584P+gNfJhDkZ1d1eufMvQbo\nsy7Kikwk2Ar8uRjNO/+GRGgIZGUnBINQPKwaFdV84XUfF1HroSTa2/v7hhl3\nsrJtzPqgiUMbmejY5pttlWPLq5ji1KCVAs3TYvGieGYEtHMlcnxbSiZblSYB\nA/9QpSAwR3EM2Zla5os++WQxtfy/8CtQ5d3X03Sz1J11sZv97j1jnGv3NFoU\neeL1gdSvEXydtI31Cz2OSTSDKXpLSj4qYnyMXNGvyQSCsL4ISaKxYwpmu2F7\nyajhiQD5Q9WTWO3H9eogqo5sv10DAAIZQd+1WEhHo/5dV35Usw/hLlwOlLFu\nPDDsVnFF+fdaGH7Pg5BALxkh7la9Dh71ocCkcBaJ63ZX5Wl4w+gE+uuOAwam\n3/nXyxaJvP7dTOuPIqWzlMsqyau/5upYn4lhB0bNIfMYnsbsskVDNFd5QmCX\nog1m79mzD0fmtXv0qqzfB5wxXvHfUuIKkr68lZ6hmHLA9yVLo/+6RfJQW1HJ\nU14y/oQ0k4pDM43m+YFZDzUNTfNwF+tp3bcTleSvuxz1fAtk6gbfioTi5IaH\nESOTbBETRS11yKWzOfq5GBiEChhvZ6DWlKrA+QasEcXKiBDZXlVX6JOMdsPx\nJAdvCuVz//iXkiHadZdL/tFWf8TntZgSPDsLCFEpW3/eY5SWjbewHYfuCwD6\nKBaj\r\n=jwAO\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","_from":"file:published/axway-flow-sdk@3.1.11.tgz","readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node plugin\n* SDK for building custom flow-node plugins for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node plugin\n\nGenerates a new flow-node plugin named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd api-builder-plugin-fn-mynode\nnpm install --no-optional\nnpm run build (optional)\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes;\n```\n\nNotice that this encodeURI example is returning a function, `getFlowNodes`, that returns a promise. This allows for the generation of the flow-node to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been returned from `getFlowNodes` instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [Models](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/models.html), or registered\nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(flownodes) : <code>function</code>\nMocks an API Builder flow-node using the flow-node generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| flownodes | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the flow-node is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the flow-node's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow-node is asynchronous, i.e. returns a promise, the promise must be resolved to get the flow-nodes defined in the plugin. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst flownodesPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet flownodes;\nbefore(() => {\n\treturn flownodesPromise.then((resolvedFlownodes) => {\n\t\tflownodes = resolvedFlownodes;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst flownodes = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule, [options])](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.group(name)](#module_axway-flow-sdk..NodeBuilder+group) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule, [options])\n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| srcModule | <code>object</code> |  | a node module |\n| [options] | <code>object</code> |  | The options for the builder. |\n| [options.validate] | <code>object</code> | <code>true</code> | The enables parameter validation.  Disable \tif you need to use refs. |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new flownode and prepares the `NodeBuilder` to accept the following flownode\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the flownode and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the flownode.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node flownode and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n**Example** *(Disable validation)*  \n```js\nsdk.init(module, { validation: false }).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { $ref: '#/definitions/foo' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+group\"></a>\n\n#### nodeBuilder.group(name) ⇒ <code>NodeBuilder</code>\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| name | <code>string</code> | A unique name for the parameter group as it will appear in the UI. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.group('Advanced')\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| name | <code>string</code> |  | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> |  | A schema used to validate the parameter. |\n| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](module:axway-flow-sdk~handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](module:axway-flow-sdk~handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module, [options]) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| module | <code>object</code> |  | The node module. |\n| [options] | <code>object</code> |  | The options for the builder. |\n| [options.validate] | <code>object</code> | <code>true</code> | The enables parameter validation.  Disable \tif you need to use refs. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flownodes against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid flownodes.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n\n\n# Author\n\nAxway <support@axway.com> https://axway.com\n\n\n# Changes\n\n#### 3.1.11\n- #5923: Fixes for both the README.md not being published and the wrong .README.md template.\n\n#### 3.1.10\n- #5914: Internal changes adding README.md generation.\n\n#### 3.1.9\n- #5887: Fix the issue where the `axway-flow -n` command would throw an error\n\n#### 3.1.8\n- #5895: Fix issue where new Flow-Node projects would not get generated with a `test` directory.\n\n#### 3.1.7\n- #5711: Internal cleanup of npm scripts.\n\n#### 3.1.6\n- #5708: Internal changes removing readme autogeneration.\n\n#### 3.1.5\n- #5708: Internal changes to mocha configuration.\n\n#### 3.1.4\n- #5709: Internal changes to update eslint rules.\n\n#### 3.1.3\n- #5707: Internal cleanup to code coverage during build process.\n\n#### 3.1.2\n- #5742: Internal change to replace `dot` dependency with `ejs` when generating new flow-node plugins.\n\n#### 3.1.0\n- #5600: Support schema references by disabling validation when building flow-nodes.\n\n#### 3.0.0\n- #5436: Breaking Change: Minimum supported version of API Builder is now Jakarta\n- #5436: Moves advanced HTTP options into a new group, \"Advanced HTTP Options\"\n\n#### axway-flow-sdk@2.0.9\n- #4757: Changed SCM repository and associated internal cleanup.\n\n# License\n\nThis 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](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.\n","engines":{"node":">= 8.9"},"gitHead":"1d637e21932a24fd9d856520f486e34194ad6c31","scripts":{"test":"nyc mocha ./test","build":"npm run build:lint && npm run test","build:lint":"eslint .","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","build:lint:fix":"eslint . --fix","check:dependencies":"npm-check -i chai -i chai-as-promised"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"_resolved":"","_integrity":"","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder-plugins","type":"git"},"_npmVersion":"6.4.1","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.16.0","dependencies":{"ajv":"^5.3.0","ejs":"^2.6.1","nomnom":"^1.8.1","axway-flow-schema":"^5.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"rimraf":"2.6.3","@axway/flow":"^6.0.0","node-readme":"^0.1.9"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_3.1.11_1563458299436_0.7498345277815048","host":"s3://npm-registry-packages"}},"3.2.0":{"name":"axway-flow-sdk","version":"3.2.0","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@3.2.0","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"jvos-axway","email":"jvos@axway.com"},{"name":"mdimitrova","email":"mdimitrova@axway.com"},{"name":"neon-axway","email":"cshantakumar@axway.com"},{"name":"nkeranova","email":"nkeranova@axway.com"},{"name":"pboev-axway","email":"pboev@axway.com"},{"name":"pdzhorev","email":"pdzhorev@axway.com"},{"name":"vchauhan","email":"vchauhan@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"nyc":{"lines":95.59,"branches":88.32,"per-file":false,"statements":95.59},"dist":{"shasum":"bfb97b12f074ba8b3600988c9c5d4fcd769dd2eb","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-3.2.0.tgz","fileCount":14,"integrity":"sha512-WrzDVslNn3euTKy5clZGGjeMJltGMqdTPEO5RxXI/IffB9jx6BcKMIw0e523l3Q1VxyJhktfPyQHLrtSacR4DA==","signatures":[{"sig":"MEUCIQCZcT4BqCyvYposxFMm9HBOCxQ9LlVGhJozX7h7Ws9xmAIgL5C4TupHMq/h0YNVm0W5ITWolR1TFUIrHR0/3ThYwh4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":51908,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdMbNPCRA9TVsSAnZWagAAE7YP/RDs7NEMCT8J7O7IcbBF\nObAlaeOlq20Bg6x6rFG0B1a5aF9tMI0T16MVZKi0dJanbVjInGeVCjN++NCY\nMFfcXJ74+hOrVra+Xqmml2rhmqiX1LwbgEZfa0SQUxkjtNWYUvpvuIsniDMS\nMd4p6z/QHiXHpKGtWnpbyAqlyz8w09wXCX0vU9Vg7/C4u1cH1dUmuOJq0yXE\ny+RM1oOL3V88HbUCB7IvilM9KunDaBO/H3w3lFm+sjuVqnlkaytoT8ul4qeX\nLtQ2UL3jYebgPlWUQEMvlyS5IdaiSpH4yU7bIaSxNcIqc+0NoKEO+NkeQsd2\nJL893fdpE31R6HmvPGlL44R038aF7Ir4/M8ImK52uro+QetYDiTMpfOusd5u\nQUEAaRlZbZWQxG+0ljAS7DCPoJKJSScCIk0lVqMPF7ou4sQCBFDcDvN3c1PS\nKppIUhM2zNyQ+/bCOBM7D194joBNHVBiNPv0YsixqeCelg1oAoDEMO2y2pmq\nmRLVvKj/gZA9YRRhCfakCPZg2yzHq75Z5o+LKds5/e9qG0RZPboXExj1QQ0W\n3vtO6+MIaoW3k0wgSPvo07EIhyM0xYjMPTSW4v/cNgi8mDLcfvafIp2JJfdb\nbOwAv05CmsV50QgWDZNsRUBm7iuA5TtgeGZLe2S0Cgtdq/ytSjtbvHe8BWKI\nz9P9\r\n=mGHQ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","_from":"file:published/axway-flow-sdk@3.2.0.tgz","engines":{"node":">= 8.9"},"gitHead":"5aa8e8a3c1378beef2e233f8c5358690cdc6afb8","scripts":{"test":"nyc mocha ./test","build":"npm run build:lint && npm run test","build:lint":"eslint .","test:watch":"npm test -- --watch","build:readme":"node-readme && shx mv README.md README.hbs && jsdoc2md --template README.hbs src/index.js > README.md && shx rm -rf README.hbs","build:lint:fix":"eslint . --fix","check:dependencies":"npm-check -i chai -i chai-as-promised"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"_resolved":"","_integrity":"","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder-plugins","type":"git"},"_npmVersion":"6.4.1","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.16.0","dependencies":{"ajv":"^5.3.0","ejs":"^2.6.1","nomnom":"^1.8.1","axway-flow-schema":"^5.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"2.6.3","@axway/flow":"^6.0.0","node-readme":"^0.1.9"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_3.2.0_1563538254405_0.24282933491841963","host":"s3://npm-registry-packages"}},"3.3.0":{"name":"axway-flow-sdk","version":"3.3.0","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@3.3.0","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"jvos-axway","email":"jvos@axway.com"},{"name":"mdimitrova","email":"mdimitrova@axway.com"},{"name":"neon-axway","email":"cshantakumar@axway.com"},{"name":"nkeranova","email":"nkeranova@axway.com"},{"name":"pboev-axway","email":"pboev@axway.com"},{"name":"pdzhorev","email":"pdzhorev@axway.com"},{"name":"vchauhan","email":"vchauhan@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"nyc":{"lines":95.63,"branches":88.32,"per-file":false,"statements":95.63},"dist":{"shasum":"62b09bd141874c3b5ec0124a89e52db91cd9e702","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-3.3.0.tgz","fileCount":14,"integrity":"sha512-A8LNS/kLG97EA2f+lUzl1t2+ajfeFXj7BmurH6F5zBw8h4zlELLM02O5b3Go4dA5080tkxcCocO31wLzgjnGdQ==","signatures":[{"sig":"MEUCIQCAJp/aJqrzVl8Bu3HLqOeLUfmCvY+lgs/qEimX100beQIgaNZtsG1tAfimVdMV/wmbEvok6xOi0VS6qTrePLfGDMc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":51902,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdOFZBCRA9TVsSAnZWagAAmDkP/30bmhTC2z9PtbE32XxN\niGwnJuPAxRgearM+13tv5RdIbo6iR+0k8Jw8GouoLSxODuj1KxM7/Mx7Xola\nZXuJucoMzEbHYIDBArNO5VBf9ZpLWBdUysfWOTix0CwpytRLlB8PeB5e/ZR6\nQeISdehvrqj8/X/Ylo+zYCcEJz73n5/uvCNxyK8WIcnof/J87tEdwd/5LqgT\nsE2YX+8f2GTwj4A08q4e7CybVcjTkWlSs/4K0E9VoQJI30Un7wKuOkjgH/xL\njTw7mcDiJUxA2jYGj4l+/eGcnPt/CCwl83x8HOl18ZWeRYTtxdIde/QzKQAe\ngl+Nz2feqg3QPa+gD/ePDiJl51TA1rYwP0zaPmbdNpTBHQAnUreteZV+qDdS\npy7AJCjk4Ep+aUjHeBVJM07Rmk1z/cc312TWpLogUCY+4v11mqBaCIetBuLR\nfgtnhhLU+uZbDbAk+IGg0904RuNrroDT4Bkh1P7ibK3eLR3xELzBGvsURm8H\n22cLABQRWDBHuwxldlgkdF/99lw0jLAZUxcFKzi4F+jPA6KPmjRw0qXUOFrz\n6cvu0/QquwwRd+ZIB4ftioiGfOo95dHxkIcZd0LRgvQv2koli2D3M1JAkudO\niqXgb+10k9ApEuCNFQdIS10iqqsOcLvygumT1zP5evPKM8VKoeijvVF6xxN8\nbXt+\r\n=fM5O\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","_from":"file:published/axway-flow-sdk@3.3.0.tgz","readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node plugin\n* SDK for building custom flow-node plugins for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node plugin\n\nGenerates a new flow-node plugin named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd api-builder-plugin-fn-mynode\nnpm install --no-optional\nnpm run build (optional)\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes;\n```\n\nNotice that this encodeURI example is returning a function, `getFlowNodes`, that returns a promise. This allows for the generation of the flow-node to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been returned from `getFlowNodes` instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [Models](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/models.html), or registered\nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(flownodes) : <code>function</code>\nMocks an API Builder flow-node using the flow-node generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| flownodes | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the flow-node is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the flow-node's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow-node is asynchronous, i.e. returns a promise, the promise must be resolved to get the flow-nodes defined in the plugin. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst flownodesPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet flownodes;\nbefore(() => {\n\treturn flownodesPromise.then((resolvedFlownodes) => {\n\t\tflownodes = resolvedFlownodes;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst flownodes = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule, [options])](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.group(name)](#module_axway-flow-sdk..NodeBuilder+group) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, options)](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule, [options])\n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| srcModule | <code>object</code> |  | a node module |\n| [options] | <code>object</code> |  | The options for the builder. |\n| [options.validate] | <code>object</code> | <code>true</code> | The enables parameter validation.  Disable \tif you need to use refs. |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new flownode and prepares the `NodeBuilder` to accept the following flownode\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the flownode and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the flownode.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node flownode and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n**Example** *(Disable validation)*  \n```js\nsdk.init(module, { validation: false }).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { $ref: '#/definitions/foo' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+group\"></a>\n\n#### nodeBuilder.group(name) ⇒ <code>NodeBuilder</code>\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| name | <code>string</code> | A unique name for the parameter group as it will appear in the UI. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.group('Advanced')\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, options) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method.  Any number of parameters can be added to a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| name | <code>string</code> | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> | A schema used to validate the parameter. |\n| 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. |\n| options.required | <code>boolean</code> | specifies that the parameter is required. Parameters are required by default. |\n| options.multilineWrapper | <code>object</code> | describes the before and after parts that surrounds user provided value in the UI. |\n| options.multilineWrapper.before | <code>string</code> | read-only string that is placed before the user provided value in the UI. |\n| options.multilineWrapper.after | <code>string</code> | read-only string that is placed after the user provided value in the UI. |\n| options.initialType | <code>string</code> | The type to display by default in the UI for this parameter.                                       Allowed values are object, array, string, selector, null, boolean and number. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](module:axway-flow-sdk~handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](module:axway-flow-sdk~handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module, [options]) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| module | <code>object</code> |  | The node module. |\n| [options] | <code>object</code> |  | The options for the builder. |\n| [options.validate] | <code>object</code> | <code>true</code> | The enables parameter validation.  Disable \tif you need to use refs. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flownodes against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid flownodes.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n\n# Changes\n\n#### 3.3.0\n- #5892: Added support for defining a type for parameters to display by default in the Flow editor. Previously parameters always started with `selector`. Now they will consider the type provided using `initialType` as an option:\n```js\n.parameter('myToggle', {\n\ttype: 'boolean'\n}, {\n\tinitialType: 'boolean'\n})\n```\n\n#### 3.2.0\n- #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 }`.\n- #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.\nThis is useful for when context or comments are needed.\n\n#### 3.1.11\n- #5923: Fix issue where README.md was not published.\n- #5923: Fix issue where README.md was generated with hardcoded docs.\n\n#### 3.1.10\n- #5914: Internal change to re-introduce readme generation from JSDoc.\n\n#### 3.1.9\n- #5887: Fix issue where the `axway-flow -n` command would throw an error\n\n#### 3.1.8\n- #5895: Fix issue where new Flow-Node projects would not get generated with a `test` directory.\n\n#### 3.1.7\n- #5711: Internal cleanup of npm scripts.\n\n#### 3.1.6\n- #5708: Internal changes removing readme autogeneration.\n\n#### 3.1.5\n- #5708: Internal changes to mocha configuration.\n\n#### 3.1.4\n- #5709: Internal changes to update eslint rules.\n\n#### 3.1.3\n- #5707: Internal cleanup to code coverage during build process.\n\n#### 3.1.2\n- #5742: Internal change to replace `dot` dependency with `ejs` when generating new flow-node plugins.\n\n#### 3.1.0\n- #5600: Support schema references by disabling validation when building flow-nodes.\n\n#### 3.0.0\n- #5436: Breaking Change: Minimum supported version of API Builder is now Jakarta\n- #5436: Moves advanced HTTP options into a new group, \"Advanced HTTP Options\"\n\n#### 2.0.9\n- #4757: Changed SCM repository and associated internal cleanup.\n\n# License\n\nThis 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](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.\n","engines":{"node":">= 8.9"},"gitHead":"564b6b4339b6b80875837a00d10f9c5a9235d61e","scripts":{"test":"nyc mocha ./test","build":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","test:watch":"npm test -- --watch","build:readme":"jsdoc2md --template .README.md src/index.js > README.md","build:lint:fix":"eslint . --fix","check:dependencies":"npm-check -i chai -i chai-as-promised"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"_resolved":"","_integrity":"","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder-plugins","type":"git"},"_npmVersion":"6.4.1","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.16.0","dependencies":{"ajv":"^5.3.0","ejs":"^2.6.1","nomnom":"^1.8.1","axway-flow-schema":"^5.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"rimraf":"2.6.3","@axway/flow":"^6.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_3.3.0_1563973184524_0.7542562919542266","host":"s3://npm-registry-packages"}},"3.4.0":{"name":"axway-flow-sdk","version":"3.4.0","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@3.4.0","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"jvos-axway","email":"jvos@axway.com"},{"name":"mdimitrova","email":"mdimitrova@axway.com"},{"name":"neon-axway","email":"cshantakumar@axway.com"},{"name":"nkeranova","email":"nkeranova@axway.com"},{"name":"pboev-axway","email":"pboev@axway.com"},{"name":"pdzhorev","email":"pdzhorev@axway.com"},{"name":"vchauhan","email":"vchauhan@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"nyc":{"lines":95.63,"branches":88.32,"per-file":false,"statements":95.63},"dist":{"shasum":"aaae9cae13f106e6f515de50bca8f9d9b5004438","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-3.4.0.tgz","fileCount":14,"integrity":"sha512-ZArxmgNXovp1d3B/FMjAuh2QIgHRSdk8HwCtwz1Ht1AV/UKx+Tt2mHCNwY3njTbRNPZ5P/FwdUQwnjRk3T5gcA==","signatures":[{"sig":"MEUCIA0UyTgtT24uba4sjrb93q15vqFRlA0hi6FOx4Tc/qQDAiEA7E+CONI2Qo2ugKRklCXqpidUyMG/crs+fEmZ50Vl8Do=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":52058,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdQt8lCRA9TVsSAnZWagAACqUP/ieXsE/4Pne0dmap2A8E\nNlI4taKGpZKXVEvSxWhOqkxkEVm4HFhbHEfTH595/yuiHKYgIWzPItgPAvUD\n4de+l9tjwuAG/i1AeHIuztwxjZnl11GYVKdViJUQe0b79Zem25SUcBdyuEtS\njSMB1mOQyUXoqWltxr5Rx4yz2f1jEvtEFa1zr3audOCNFmVz2yI9oPs73ron\nqw/e4W26EF79svByN2g5sBEyNarcnNl9TmNhYs2PrOskSZ5BTbgptVejUVzX\nl9pGEhTGtDhEWLOblkFL6Ng/Nv/AOx7bnkFjBmdwcml2LvwPRgcM7YfOGCZL\nCqFGunNn+D4X6/VtPSBhfU/0PVnJJ0BqsZ+EUM4dPKoUdznQOtlO4Cqg82A/\n4Knd1U1dsX++CKRiUTu4FEzPrTfpefRs0INt+E9+c+OWiugkiGVoJ5t6U1oH\nwuajMEaV1tIggtM1hpwPuD1YHrL6ujNlmvLuI491qZnOje0zX0AiTzweHPpG\nOyVJ1ieHRu3B/eMZMieJZDYwncJkmgiTPk4yRUX6avLrTzjCJMECUOeWzZiF\nLXtTPUW9nV480dvIVpyn5ERrH/B6MKIMvURVL8eY0OX2BNcqbA/7HthDyLWT\nLMcKBZXjiCuCxcKptjUjX6RJRItInQvLTp/wlR3dAwwFCM6MIjWvMpT4FuEh\n99D/\r\n=K/Hu\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","_from":"file:published/axway-flow-sdk@3.4.0.tgz","engines":{"node":">= 8.9"},"gitHead":"95d001b7751a72a49e7777e9872845f46b591259","scripts":{"test":"nyc mocha ./test","build":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","test:watch":"npm test -- --watch","build:readme":"jsdoc2md --template .README.md src/index.js > README.md","build:lint:fix":"eslint . --fix","check:dependencies":"npm-check -i chai -i chai-as-promised"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"_resolved":"","_integrity":"","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder-plugins","type":"git"},"_npmVersion":"6.4.1","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.16.0","dependencies":{"ajv":"^5.3.0","ejs":"^2.6.1","nomnom":"^1.8.1","axway-flow-schema":"^5.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"2.6.3","@axway/flow":"^6.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_3.4.0_1564663588249_0.10943824235266608","host":"s3://npm-registry-packages"}},"3.4.1":{"name":"axway-flow-sdk","version":"3.4.1","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@3.4.1","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"ivivanov-axway","email":"ivivanov@axway.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"jvos-axway","email":"jvos@axway.com"},{"name":"mdimitrova","email":"mdimitrova@axway.com"},{"name":"neon-axway","email":"cshantakumar@axway.com"},{"name":"nkeranova","email":"nkeranova@axway.com"},{"name":"pboev-axway","email":"pboev@axway.com"},{"name":"pdzhorev","email":"pdzhorev@axway.com"},{"name":"vchauhan","email":"vchauhan@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"nyc":{"lines":95.63,"branches":88.32,"per-file":false,"statements":95.63},"dist":{"shasum":"088a98fd5dc6b8326a8d059d62a263b21c03ba79","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-3.4.1.tgz","fileCount":14,"integrity":"sha512-rcFZJhSk3o53Zq18nCxQETsF9zsZRvNZ6q+lKt/qeYTbhtYSPpPhMvcIM+jXEXdFLcRbxDh1gFVy8Q7E6cRhfA==","signatures":[{"sig":"MEUCIQC2q30ffj+fdGLwwluOYkBcS7JQJ9wNH5A+pw0Ng4MfUgIgBks40+71iJb3I/b0NVSbbnTU0ZHGtXhOetkcf99631M=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":52098,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdjfkCCRA9TVsSAnZWagAAW40QAIvZK9iEM09J8vEuCytD\nAPl98TH8z7jxlOQL0J6vXJBxiAxD60xKemEGG8z+l3iw/WNLcI+X/6v6aCn2\nGTvM4/SagriIFUQ+9cpliyUzus++6vkFFr4X41Tp/v++nQuNKbD960+YXIp7\nmkgisLVvBcFfW9kvzrSI672DSaaSlgPSmGY9VoRNne5eG84XT9mO2FO1G8D6\nACPDw9mCuB6f0jab9D3PvMMtLPJq8LG2dpvhFznkvPGdgxkyFvIiy7fNNm5e\nfyXhiwqWpYyyUZIHtdmT6TYCB8xPr+7IVneCYqef1o27K3dayLWmtPcOqMk9\nQXokfSlTCN58MGtqNEKx6kh6djtH2y8/XxM/N5a/yCykooJ0OqWZBkVsWZEL\nXpgP0T+87Ztl+m7GhISSM6te0tVWwcHVJHFZxG/godLUt/kk6hRAptUKK+/Q\nXz7ClCXmyfy//pgWi8mHI357iPJ2ihpveXxpqyo0QtoEGXJEUFgXauS9f8i7\nyZoaphcVNxj3JrBVz8k+EJBRYGSa3lk+k21/bwtCaRScev19mLEUANxvm58S\nrbZY7LLZ+6rZMn5mvNGMT+3SqNqPwvaZkDXBfiC66gbToRMeNzJ0tnlhXAqa\nZqbxyJ28gfULJ03MITepsEkJNdBcGFIlYtSlGUuX6Lz4VjCs3tU0mvOiGlYn\nLd4p\r\n=em84\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","_from":"file:published/axway-flow-sdk@3.4.1.tgz","engines":{"node":">= 8.9"},"gitHead":"743a4baacaf10fe8ba868ff98cf6a2d99dab4854","scripts":{"test":"nyc mocha ./test","build":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","test:watch":"npm test -- --watch","build:readme":"jsdoc2md --template .README.md src/index.js > README.md","build:lint:fix":"eslint . --fix","check:dependencies":"npm-check -i chai -i chai-as-promised"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"_resolved":"","_integrity":"","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder-plugins","type":"git"},"_npmVersion":"6.4.1","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.16.1","dependencies":{"ajv":"^5.3.0","ejs":"^2.6.1","nomnom":"^1.8.1","axway-flow-schema":"^5.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"2.6.3","@axway/flow":"^6.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_3.4.1_1569585408741_0.7015831726936725","host":"s3://npm-registry-packages"}},"3.4.2":{"name":"axway-flow-sdk","version":"3.4.2","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@3.4.2","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway_alasdair","email":"ahurst@axway.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"jvos-axway","email":"jvos@axway.com"},{"name":"mdimitrova","email":"mdimitrova@axway.com"},{"name":"neon-axway","email":"cshantakumar@axway.com"},{"name":"nkeranova","email":"nkeranova@axway.com"},{"name":"pboev-axway","email":"pboev@axway.com"},{"name":"pdzhorev","email":"pdzhorev@axway.com"},{"name":"pltod2","email":"pl.todorov@gmail.com"},{"name":"vchauhan","email":"vchauhan@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"nyc":{"lines":95.65,"branches":88.32,"per-file":false,"statements":95.65},"dist":{"shasum":"6aa44fd490ad314f737531244e8c3ac4635f75b7","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-3.4.2.tgz","fileCount":14,"integrity":"sha512-jjB3lH1//pnl/VNHpUcS97WR9g2JsgE8avxHagyeSbqH0d1QS/zva34ldyfBVYIbibsLdn1peh+NVX5yB3dyWQ==","signatures":[{"sig":"MEUCIQCO2TBrwNFKLdl+sNqutJr7fsu50pZSq3Fy1mNk/G5pKwIgeEtQ0Ibi9gVer3hjxCqp5P1DaORjqBf5rFWX9OXEJ9Y=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":52132,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd4Rb2CRA9TVsSAnZWagAAsLAQAJODr44nqloPgvWd8qGo\nONuuR+JZnzJR8IRQv+rMKl12oPDJRF9WM13Ofjb/n+o2mE5cF5IgdP5FmTBW\n4VUHmqAaTd4oFjyuAHtxawjIb+7OW7OFVeeWxNHhS1qfyEkhqY8vWjX7rfI0\nyMYDvrgT5tGFdqcP+wFe4GgF3McBv20/5AvkP/T64ZH1dKNzeLpslzX2+e3I\nWJWR8HQZIFArg8LwcVBFusKv081aZ60UUB6nWDsgYgH47eOIKUPZgqiSncuo\nKWSwf9Yg20co5S//YhSkHqASxbERG/uaL0lGTMlKAJXWNyn0gChah9jFZgoy\ndvC/VVVvhepnlDl2qzzHUmholg09Ud3LlVVlK1rZh/kfNV00oLwOvjEnTjoV\nKoi76512Zo0thvcSSYyGdRLcl0Zdz77pF4yh4csEOq2S+hlhgkBRUwnPZxyn\nDknrlV/dI0p/ekQ60Sh8J4pt0qYpAWG/8KywZsoedpEFhG9BZj8MsFl+s5/X\no5gLW+0yXcpwr+xp5pLakawVApvUP9vjt/68+4afbgA15EaTrDvnBe7R8qKM\nR9DEped1Qpq5WByaWX1VtxQlfLJh4Ds3t9KG8iIRjaP1vG0UZPRc3ezpBSow\nClxjPXk+Hf2M97huMORRxY1IMwB9XHbDtPOdcksclOpnyPWOBE+WfGce9VTA\nh17X\r\n=VhZt\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","_from":"file:published/axway-flow-sdk@3.4.2.tgz","engines":{"node":">= 8.9"},"gitHead":"84d1d4a46f11909e17dfc654438ea869024b921c","scripts":{"test":"nyc mocha ./test","build":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","test:watch":"npm test -- --watch","build:readme":"jsdoc2md --template .README.md src/index.js > README.md","build:lint:fix":"eslint . --fix","check:dependencies":"npm-check -i chai -i chai-as-promised"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"_resolved":"","_integrity":"","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder-plugins","type":"git"},"_npmVersion":"6.4.1","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.16.2","dependencies":{"ajv":"^5.3.0","ejs":"^2.6.1","nomnom":"^1.8.1","axway-flow-schema":"^5.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"2.6.3","@axway/flow":"^6.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_3.4.2_1575032565695_0.24600387106895427","host":"s3://npm-registry-packages"}},"3.4.3":{"name":"axway-flow-sdk","version":"3.4.3","keywords":["amplify","api-builder","axway","flow","sdk"],"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","_id":"axway-flow-sdk@3.4.3","maintainers":[{"name":"awam","email":"ewanharris93@gmail.com"},{"name":"axway_alasdair","email":"ahurst@axway.com"},{"name":"axway-npm","email":"builder11@axway.com"},{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},{"name":"cb1kenobi","email":"chris@cb1inc.com"},{"name":"jamie.peabody","email":"jamie.peabody@gmail.com"},{"name":"jvos-axway","email":"jvos@axway.com"},{"name":"mdimitrova","email":"mdimitrova@axway.com"},{"name":"neon-axway","email":"cshantakumar@axway.com"},{"name":"nkeranova","email":"nkeranova@axway.com"},{"name":"pboev-axway","email":"pboev@axway.com"},{"name":"pdzhorev","email":"pdzhorev@axway.com"},{"name":"pltod2","email":"pl.todorov@gmail.com"},{"name":"vchauhan","email":"vchauhan@axway.com"}],"homepage":"https://platform.axway.com","bin":{"axway-flow":"bin/axway-flow.js"},"nyc":{"lines":95.65,"branches":88.32,"per-file":false,"statements":95.65},"dist":{"shasum":"f9733d8c6ef1e3aa5b67a8afd0115bd6ae3d4a22","tarball":"https://registry.npmjs.org/axway-flow-sdk/-/axway-flow-sdk-3.4.3.tgz","fileCount":14,"integrity":"sha512-AcDbyJN+iyXCUXY1ei245ApkA49HelOFdimks/b5x/b8JLazfwvCh2nJ4NNAvlTTMh3V06Mo23PMA2ruVrUdEw==","signatures":[{"sig":"MEUCIQCABUwmmpU1SNqNpR7mI0ojCbL8zgtdap5Og3Rm7G1bbAIgDets/Lfqzx3CAQSpgpO8NJhCjrq9dhFhc5h8pQAoheY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":52169,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJejYJSCRA9TVsSAnZWagAAYyQP/2OEkgW+dDzxpMml4zyl\nT6dVRsLEG8Bfexro8AzFopV/qEQwtb1xOcxFaDvqbuz6TFTZzh9Z0NKtuHd/\nLj5g0tHEOq1m5MCqWQ86JTmFGKXcCQuAcmGb2Mk6UizqF/ctah/MatGsFYwO\nY0AMVZZrWnQq7JmjC8z/95dw5rkdooVml90488v1naebxhILdVmaqCNzYcz4\n9r9ydmFUAONxbRQ5yg6ss10t4oyFkaqxpMK4b4tq0pvIuft607or/LF5Qx+9\nfEPbxj1C2Luzj8EVQzolnjk3ENBjM9m2WorPH1DZkNJAeM/EZvipzl/GgHPf\nkHZZzlX0smpsRLQTizOU/Sh1+fwOy1Ain8BZeBTrZLw972zdpPto+EWvC5VL\ng6oLsG+xmmqHIFlhUOOhPdtTesw9SZSB1zcUGzCgO8fyL52J1B7y3XOPIGDV\n0hkxKjMOvzWADg4n9+HcONwu4tLkhJuSJNb12tvascedAXW6cqwffDtwArjT\ndFDnjvskvnyICbXvjG/WSuWAQijiJ1INhGCzI6s6bZUfjVTBZlO//YEuW5z5\nk2RwIlkwD0jzGSEsPcGmNaUza1BEibSnngNceLHzGveh+eOurt+/nijDfZjA\n8EpPVoPKFqstIgh9Kgoj28q+pV0clY8KP1AwkxoDhw9XqxvrDI0n2eKO3Goi\nGrCL\r\n=0gwE\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","_from":"file:published/axway-flow-sdk@3.4.3.tgz","readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node plugin\n* SDK for building custom flow-node plugins for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node plugin\n\nGenerates a new flow-node plugin named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd api-builder-plugin-fn-mynode\nnpm install --no-optional\nnpm run build (optional)\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes;\n```\n\nNotice that this encodeURI example is returning a function, `getFlowNodes`, that returns a promise. This allows for the generation of the flow-node to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been returned from `getFlowNodes` instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [Models](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/models.html), or registered\nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(flownodes) : <code>function</code>\nMocks an API Builder flow-node using the flow-node generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| flownodes | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the flow-node is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the flow-node's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow-node is asynchronous, i.e. returns a promise, the promise must be resolved to get the flow-nodes defined in the plugin. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst flownodesPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet flownodes;\nbefore(() => {\n\treturn flownodesPromise.then((resolvedFlownodes) => {\n\t\tflownodes = resolvedFlownodes;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst flownodes = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule, [options])](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.group(name)](#module_axway-flow-sdk..NodeBuilder+group) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, options)](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule, [options])\n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| srcModule | <code>object</code> |  | a node module |\n| [options] | <code>object</code> |  | The options for the builder. |\n| [options.validate] | <code>object</code> | <code>true</code> | The enables parameter validation. Disable \tif you need to use refs. |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new flownode and prepares the `NodeBuilder` to accept the following flownode\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the flownode and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the flownode.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node flownode and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n**Example** *(Disable validation)*  \n```js\nsdk.init(module, { validation: false }).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { $ref: '#/definitions/foo' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+group\"></a>\n\n#### nodeBuilder.group(name) ⇒ <code>NodeBuilder</code>\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| name | <code>string</code> | A unique name for the parameter group as it will appear in the UI. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.group('Advanced')\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, options) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method. Any number of parameters can be added\nto a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| name | <code>string</code> | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> | A schema used to validate the parameter. |\n| options | <code>object</code> \\| <code>boolean</code> | As an object, specifies additional options to configure \t\tthe parameter. As a boolean, specifies that the parameter is required. Parameters are \t\trequired by default. |\n| options.required | <code>boolean</code> | specifies that the parameter is required. Parameters are \t\trequired by default. |\n| options.multilineWrapper | <code>object</code> | describes the before and after parts that \t\tsurrounds user provided value in the UI. |\n| options.multilineWrapper.before | <code>string</code> | read-only string that is placed before \t\tthe user provided value in the UI. |\n| options.multilineWrapper.after | <code>string</code> | read-only string that is placed after \t\tthe user provided value in the UI. |\n| options.initialType | <code>string</code> | The type to display by default in the UI for \t\tthis parameter. Allowed values are object, array, string, selector, null, boolean \t\tand number. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](module:axway-flow-sdk~handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](module:axway-flow-sdk~handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module, [options]) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| module | <code>object</code> |  | The node module. |\n| [options] | <code>object</code> |  | The options for the builder. |\n| [options.validate] | <code>object</code> | <code>true</code> | The enables parameter validation.  Disable \tif you need to use refs. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flownodes against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid flownodes.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n\n# Changes\n\n#### 3.4.3\n- #6315: Internal chore.\n\n#### 3.4.2\n- #6116: Internal cleanup chore.\n\n#### 3.4.1\n- #6074: Internal CI chore\n\n#### 3.4.0\n- #5924: Added support for string parameters having a format of \"mustache\".\n\n#### 3.3.0\n- #5892: Added support for defining a type for parameters to display by default in the Flow editor. Previously parameters always started with `selector`. Now they will consider the type provided using `initialType` as an option:\n```js\n.parameter('myToggle', {\n\ttype: 'boolean'\n}, {\n\tinitialType: 'boolean'\n})\n```\n\n#### 3.2.0\n- #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 }`.\n- #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.\nThis is useful for when context or comments are needed.\n\n#### 3.1.11\n- #5923: Fix issue where README.md was not published.\n- #5923: Fix issue where README.md was generated with hardcoded docs.\n\n#### 3.1.10\n- #5914: Internal change to re-introduce readme generation from JSDoc.\n\n#### 3.1.9\n- #5887: Fix issue where the `axway-flow -n` command would throw an error\n\n#### 3.1.8\n- #5895: Fix issue where new Flow-Node projects would not get generated with a `test` directory.\n\n#### 3.1.7\n- #5711: Internal cleanup of npm scripts.\n\n#### 3.1.6\n- #5708: Internal changes removing readme autogeneration.\n\n#### 3.1.5\n- #5708: Internal changes to mocha configuration.\n\n#### 3.1.4\n- #5709: Internal changes to update eslint rules.\n\n#### 3.1.3\n- #5707: Internal cleanup to code coverage during build process.\n\n#### 3.1.2\n- #5742: Internal change to replace `dot` dependency with `ejs` when generating new flow-node plugins.\n\n#### 3.1.0\n- #5600: Support schema references by disabling validation when building flow-nodes.\n\n#### 3.0.0\n- #5436: Breaking Change: Minimum supported version of API Builder is now Jakarta\n- #5436: Moves advanced HTTP options into a new group, \"Advanced HTTP Options\"\n\n#### 2.0.9\n- #4757: Changed SCM repository and associated internal cleanup.\n\n# License\n\nThis 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](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.\n","engines":{"node":">= 8.9"},"gitHead":"e2a495c05f8daf8ceb6a13a6b51e8392c726b88b","scripts":{"test":"nyc mocha ./test","build":"npm run build:lint && npm run test && npm run build:readme","build:lint":"eslint .","test:watch":"npm test -- --watch","build:readme":"jsdoc2md --template .README.md src/index.js > README.md","build:lint:fix":"eslint . --fix","check:dependencies":"npm-check -i chai -i chai-as-promised"},"_npmUser":{"name":"bladedancer","email":"bladedancer.gavin@gmail.com"},"_resolved":"","_integrity":"","deprecated":"no longer supported by Axway. Use @axway/api-builder-sdk instead","repository":{"url":"https://git.ecd.axway.int/amplify/api-builder-plugins","type":"git"},"_npmVersion":"6.13.4","description":"SDK for implementing custom flow nodes for API Builder flows","directories":{},"_nodeVersion":"8.17.0","dependencies":{"ajv":"^5.3.0","ejs":"^2.6.1","nomnom":"^1.8.1","axway-flow-schema":"^5.0.0","validate-npm-package-name":"^3.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"rimraf":"2.6.3","@axway/flow":"^6.0.0"},"_npmOperationalInternal":{"tmp":"tmp/axway-flow-sdk_3.4.3_1586332241480_0.1472907148134559","host":"s3://npm-registry-packages"}}},"time":{"created":"2017-11-15T16:17:38.533Z","modified":"2025-07-25T08:30:46.279Z","1.0.0":"2017-11-15T16:17:38.533Z","1.0.1":"2017-11-16T14:58:52.123Z","1.0.3":"2017-11-16T15:39:29.834Z","1.0.4":"2017-11-17T12:36:10.240Z","1.1.0-101":"2018-02-05T16:47:26.719Z","1.1.0-102":"2018-02-13T14:13:02.781Z","1.1.0-103":"2018-02-19T18:01:22.565Z","1.1.0-104":"2018-02-21T15:11:58.267Z","1.1.0-105":"2018-02-21T21:28:56.074Z","1.1.0-106":"2018-02-22T04:38:20.496Z","1.1.0-107":"2018-02-22T09:51:30.315Z","1.1.0":"2018-02-22T18:25:57.186Z","1.1.1-0":"2018-02-28T13:05:15.309Z","1.1.1-2":"2018-02-28T20:59:49.549Z","1.1.1-3":"2018-03-20T13:53:47.864Z","1.1.1-4":"2018-03-21T12:37:27.403Z","1.1.1-5":"2018-03-23T21:47:36.736Z","1.1.1-6":"2018-03-27T13:34:03.226Z","1.1.1-7":"2018-04-11T14:00:55.555Z","1.1.1-8":"2018-04-11T14:51:05.163Z","2.0.0-1":"2018-04-12T11:19:46.799Z","2.0.0-2":"2018-04-13T12:48:26.015Z","2.0.0-3":"2018-04-13T15:30:07.405Z","2.0.0-4":"2018-04-13T15:57:07.902Z","2.0.0-5":"2018-04-25T16:51:09.444Z","2.0.0-6":"2018-04-26T13:35:14.386Z","2.0.0-7":"2018-05-10T08:55:33.892Z","2.0.0-8":"2018-05-23T10:24:06.650Z","2.0.0-9":"2018-05-24T18:00:38.551Z","2.0.0-10":"2018-05-25T16:09:53.752Z","2.0.0-11":"2018-06-10T12:14:09.516Z","2.0.0-12":"2018-06-15T10:59:38.518Z","2.0.0-13":"2018-06-18T12:35:10.620Z","1.1.1":"2018-06-18T14:43:35.437Z","2.0.0-14":"2018-06-19T09:35:09.943Z","2.0.0-15":"2018-06-20T10:16:37.988Z","2.0.0-16":"2018-06-21T11:12:47.356Z","2.0.0":"2018-06-27T10:14:43.829Z","2.0.1":"2018-07-10T17:13:30.019Z","2.0.2":"2018-07-10T19:54:00.023Z","2.0.3":"2018-07-10T21:01:59.671Z","2.0.4":"2018-07-11T11:00:24.219Z","2.0.5":"2018-07-18T13:14:10.479Z","2.0.6":"2018-07-19T10:07:07.754Z","2.0.7":"2018-07-20T13:13:36.629Z","2.0.8":"2018-07-23T11:26:33.461Z","2.0.9":"2018-07-23T11:51:18.020Z","2.0.10":"2018-07-23T12:14:50.154Z","2.0.11":"2018-08-02T12:51:46.010Z","2.0.12":"2018-08-03T09:28:24.787Z","2.0.13":"2018-08-03T10:19:41.036Z","2.0.14":"2018-09-06T13:21:53.447Z","1.2.4":"2018-10-25T16:06:37.541Z","1.2.5":"2018-10-31T11:00:11.087Z","2.0.15":"2018-11-13T11:50:36.480Z","1.2.7":"2018-11-13T15:53:03.000Z","2.0.16":"2019-01-25T15:23:41.016Z","2.0.17":"2019-01-25T16:24:58.322Z","3.0.0":"2019-01-31T15:24:22.753Z","1.2.9":"2019-02-01T10:58:20.418Z","1.2.10":"2019-02-11T15:38:10.746Z","1.2.11":"2019-02-15T18:34:11.999Z","1.2.12":"2019-02-25T22:54:04.001Z","3.1.0":"2019-03-11T12:34:50.090Z","3.1.1":"2019-03-13T12:05:10.278Z","3.1.2":"2019-05-03T11:40:16.586Z","3.1.3":"2019-05-10T18:42:53.515Z","3.1.4":"2019-05-13T15:45:39.965Z","3.1.5":"2019-05-15T13:21:17.279Z","3.1.6":"2019-05-15T14:21:05.328Z","3.1.7":"2019-05-22T14:23:32.849Z","1.2.13":"2019-05-24T08:00:39.301Z","3.1.8":"2019-07-04T11:41:10.701Z","3.1.9":"2019-07-05T11:49:47.293Z","3.1.10":"2019-07-17T12:40:09.830Z","3.1.11":"2019-07-18T13:58:19.602Z","3.2.0":"2019-07-19T12:10:54.869Z","3.3.0":"2019-07-24T12:59:44.635Z","3.4.0":"2019-08-01T12:46:28.401Z","3.4.1":"2019-09-27T11:56:49.332Z","3.4.2":"2019-11-29T13:02:45.823Z","3.4.3":"2020-04-08T07:50:41.626Z"},"author":{"url":"https://axway.com","name":"Axway","email":"support@axway.com"},"license":"SEE LICENCE IN LICENSE","homepage":"https://platform.axway.com","keywords":["amplify","api-builder","axway","flow","sdk"],"repository":{"url":"https://git.ecd.axway.int/amplify/api-builder-plugins","type":"git"},"description":"SDK for implementing custom flow nodes for API Builder flows","maintainers":[{"email":"nkeranova@axway.com","name":"nkeranova"},{"email":"builder11@axway.com","name":"axway-npm"},{"email":"bladedancer.gavin@gmail.com","name":"bladedancer"},{"email":"ddimonov@axway.com","name":"ddimonov-axway"},{"email":"ashtripathi@axway.com","name":"neon-axway"},{"email":"vchauhan@axway.com","name":"vchauhan"},{"email":"mdimitrova@axway.com","name":"mdimitrova"},{"email":"pdzhorev@axway.com","name":"pdzhorev"},{"email":"ahurst@axway.com","name":"axway_alasdair"},{"email":"pl.todorov@gmail.com","name":"pltod2"},{"email":"mbonchev@axway.com","name":"mbonchev-axway"},{"email":"bchristiansen@axway.com","name":"axway-vertex"},{"email":"npm.modules@axway.com","name":"buildernpmuser"}],"readme":"# axway-flow-sdk\n\nSDK for implementing custom flow nodes for API Builder flows\n\n## Features\n\n* CLI tool for starting a new flow-node plugin\n* SDK for building custom flow-node plugins for API Builder flows\n\n## Install\n\n`npm install -g axway-flow-sdk`\n\n## Generating a new flow-node plugin\n\nGenerates a new flow-node plugin named \"mynode\" in the current directory.\n\n```\naxway-flow -n mynode\ncd api-builder-plugin-fn-mynode\nnpm install --no-optional\nnpm run build (optional)\n```\n\n## encodeURI example\n\n```js\nconst sdk = require('axway-flow-sdk');\n\nfunction getFlowNodes() {\n\tconst flownodes = sdk.init(module)\n\t\t.add('encodeURI', {\n\t\t\tname: 'Encode URI',\n\t\t\ticon: 'encode.svg',\n\t\t\tdescription: 'URI encoder'\n\t\t})\n\t\t.method('encode', {\n\t\t\tname: 'Encode URI',\n\t\t\tdescription: 'Encodes a URI by replacing each instance of certain characters with UTF-8 encodings.'\n\t\t})\n\t\t.parameter('uri', {\n\t\t\ttype: 'string',\n\t\t\tdescription: 'The URI to encode.'\n\t\t})\n\t\t.output('encoded', {\n\t\t\tname: 'Encoded',\n\t\t\tdescription: 'The encoded URI.',\n\t\t\tcontext: '$.encodedURI',\n\t\t\tschema: {\n\t\t\t\ttype: 'string'\n\t\t\t}\n\t\t})\n\t\t.action((req, cb) => {\n\t\t\tcb.encoded(null, encodeURI(req.params.uri));\n\t\t});\n\treturn Promise.resolve(flownodes);\n}\n\nexports = module.exports = getFlowNodes;\n```\n\nNotice that this encodeURI example is returning a function, `getFlowNodes`, that returns a promise. This allows for the generation of the flow-node to be asynchronous, for example, to allow the loading of content from a remote source. In this example it is used for demostration purposes only, `flownodes` could have been returned from `getFlowNodes` instead.\n\n## Type references\n\nIn [Axway API Builder](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder.html),\nit is possible to reference other types.  For example, types can be loaded from `./schemas`, registered\nfrom [Models](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/models.html), or registered\nfrom service connectors.  Any registered schema can be referenced whenever a `schema` is required.\n\n```js\n.parameter('greeting', {\n\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n})\n.output('next', {\n\tschema: {\n\t\t\"$ref\": \"schema://model/appc.arrowdb/user\"\n\t}\n})\n```\n## Testing your flow-node module\n\nThe cli will automatically generate a unit test in `./test/test.js`.  The test will use `mocknode`\nto mock an API Builder flow-node.\n\n### mocknode(flownodes) : <code>function</code>\nMocks an API Builder flow-node using the flow-node generated with `NodeBuilder`.\n\n**Access**: public\n\n| Param | Type | Description |\n| --- | --- | --- |\n| flownodes | <code>NodeBuilder</code> | The `NodeBuilder` object. |\n\n**Testing a successful output callback: `cb.next(null, 'stuff')`**\n\nThis example uses mocha and promises to check that the flow-node is defined well enough\nto pass the argument `foo` to the method `method`.  It also mocks the callback\nusing the flow-node's defined `output`, and ensures that the method invokes the correct\ncallback.\n\nNote if the flow-node is asynchronous, i.e. returns a promise, the promise must be resolved to get the flow-nodes defined in the plugin. This can simply be done using a before block that waits for the resolved promise.\n\n```js\nconst flownodesPromise = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nlet flownodes;\nbefore(() => {\n\treturn flownodesPromise.then((resolvedFlownodes) => {\n\t\tflownodes = resolvedFlownodes;\n\t});\n});\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal({\n\t\t\t\tnext: [null, 'stuff']\n\t\t\t})\n\t\t});\n})\n\n```\n\n**Testing an error default callback: `cb('invalid argument')`**\n\nThis example is similar to the previous example, save that the expectation is that\nthe method will invoke `cb('invalid argument')` when given an `undefined` parameter.\n\n```js\nconst flownodes = require('../src');\nconst { mocknode } = require('axway-flow-sdk');\n\nit('describes a test', () => {\n\tconst args = { foo: undefined };\n\treturn mocknode(flownodes).node('example').invoke('method', args)\n\t\t.then((response) => {\n\t\t\texpect(response).to.deep.equal(['invalid argument'])\n\t\t});\n})\n```\n\n# API Reference\n\n<a name=\"module_axway-flow-sdk..NodeBuilder\"></a>\n\n### axway-flow-sdk~NodeBuilder\n**Kind**: inner class of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n\n* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder)\n    * [new NodeBuilder(srcModule, [options])](#new_module_axway-flow-sdk..NodeBuilder_new)\n    * [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code>\n    * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code>\n    * [.group(name)](#module_axway-flow-sdk..NodeBuilder+group) ⇒ <code>NodeBuilder</code>\n    * [.parameter(name, schema, options)](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code>\n    * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code>\n    * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code>\n\n<a name=\"new_module_axway-flow-sdk..NodeBuilder_new\"></a>\n\n#### new NodeBuilder(srcModule, [options])\n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| srcModule | <code>object</code> |  | a node module |\n| [options] | <code>object</code> |  | The options for the builder. |\n| [options.validate] | <code>object</code> | <code>true</code> | The enables parameter validation. Disable \tif you need to use refs. |\n\n<a name=\"module_axway-flow-sdk..NodeBuilder+add\"></a>\n\n#### nodeBuilder.add(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new flownode and prepares the `NodeBuilder` to accept the following flownode\noperations:\n- [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\n- [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output)\n\nThe `key` parameter is used to uniquely identify the flownode and represents a distinct\ninstance of a node for the flow editor.  The `key` will be used as the name unless the\n`name` option is provided.  The new node will appear under the \"general\" category\nby default, or under the provided `category` option.\n\nThe `icon` option can be bmp, jpeg, png, gif, tiff, or  svg file.  After,\n[.method](#module_axway-flow-sdk..NodeBuilder+method)\ncan be used to add method(s), and\n[.output](#module_axway-flow-sdk..NodeBuilder+output) can be used to\ndefine an output.  When done,\n[.action](#module_axway-flow-sdk..NodeBuilder+action) can be used to\ndefine an action function and finish the flownode.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| key | <code>string</code> |  | A unique key identifier for the node. |\n| [options] | <code>object</code> |  | Options for the node. |\n| [options.name] | <code>string</code> |  | A friendly name for the node as it will appear in the UI. |\n| [options.icon] | <code>string</code> |  | An icon file. |\n| [options.description] | <code>string</code> |  | A description for the node. |\n| [options.category] | <code>string</code> | <code>&quot;general&quot;</code> | A category under which the node will appear \t\tin the UI (defaults to \"general\"). |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+method\"></a>\n\n#### nodeBuilder.method(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new method to the current node flownode and prepares the `NodeBuilder`\nto accept the following method operations:\n- [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter)\n- [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action)\n\n[.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) must be\ncalled prior to adding a method.\n\nThe `key` uniquely identifies the method for the node and will be used as\nthe name unless the `name` option is provided.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key identifier for the method. |\n| [options] | <code>object</code> | Options for the method. |\n| [options.name] | <code>string</code> | A friendly name for the method as it will appear in the UI. |\n| [options.description] | <code>string</code> | A description for the method. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' });\n```\n**Example** *(Disable validation)*  \n```js\nsdk.init(module, { validation: false }).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { $ref: '#/definitions/foo' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+group\"></a>\n\n#### nodeBuilder.group(name) ⇒ <code>NodeBuilder</code>\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| name | <code>string</code> | A unique name for the parameter group as it will appear in the UI. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.group('Advanced')\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+parameter\"></a>\n\n#### nodeBuilder.parameter(name, schema, options) ⇒ <code>NodeBuilder</code>\nAdds a new parameter to the current method. Any number of parameters can be added\nto a method.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) must be\ncalled prior to adding a parameter.\n\nThe `name` uniquely identifies the the parameter, and the `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| name | <code>string</code> | A unique name for the parameter as it will appear in the UI. |\n| schema | <code>object</code> | A schema used to validate the parameter. |\n| options | <code>object</code> \\| <code>boolean</code> | As an object, specifies additional options to configure \t\tthe parameter. As a boolean, specifies that the parameter is required. Parameters are \t\trequired by default. |\n| options.required | <code>boolean</code> | specifies that the parameter is required. Parameters are \t\trequired by default. |\n| options.multilineWrapper | <code>object</code> | describes the before and after parts that \t\tsurrounds user provided value in the UI. |\n| options.multilineWrapper.before | <code>string</code> | read-only string that is placed before \t\tthe user provided value in the UI. |\n| options.multilineWrapper.after | <code>string</code> | read-only string that is placed after \t\tthe user provided value in the UI. |\n| options.initialType | <code>string</code> | The type to display by default in the UI for \t\tthis parameter. Allowed values are object, array, string, selector, null, boolean \t\tand number. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+output\"></a>\n\n#### nodeBuilder.output(key, [options]) ⇒ <code>NodeBuilder</code>\nAdds a new output to the current method.  Any number of outputs can be added to a method,\nbut for usability-sake, you should limit this.  The `output` represents one of the possible\ncallback routes for your method.  For example, if your method tested prime numbers, then\none output might be `prime`, and the other `not-prime`.\n\n[.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method)\nmust be called prior to adding an output.\n\nThe `key` uniquely identifies the the output route.  The `schema` is a valid\n[JSON Schema](http://json-schema.org) definition (both\n[draft-04](http://json-schema.org/draft-04/schema) and\n[draft-06](http://json-schema.org/draft-06/schema) are supported).\nIf `schema` is not provided, then the output type is effectively _any_ type.\n\nThe `context` is a valid [JSON Path](https://github.com/json-path/JsonPath) and\nis used as the default by the flow editor.  When the output is invoked, the configured\ncontext is where the output value will be written.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| key | <code>string</code> | A unique key for the output. |\n| [options] | <code>object</code> | output options |\n| [options.name] | <code>string</code> | A friendly name for the output as it will appear in \t\tthe UI. |\n| [options.description] | <code>string</code> | The output description. |\n| [options.context] | <code>string</code> | The default context string. |\n| [options.schema] | <code>object</code> | The expected JSON schema for the output value. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } });\n```\n<a name=\"module_axway-flow-sdk..NodeBuilder+action\"></a>\n\n#### nodeBuilder.action(handler) ⇒ <code>NodeBuilder</code>\nAssigns an action [`handler`](module:axway-flow-sdk~handler) to\nthe current method.  The method can only have one action handler.  Assigning an action will\nterminate the current method definition.\n\n**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder)  \n**Returns**: <code>NodeBuilder</code> - The current object (this).  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| handler | <code>handler</code> | The action [`handler`](module:axway-flow-sdk~handler) \t\tfunction. |\n\n**Example**  \n```js\nsdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\n```\n<a name=\"module_axway-flow-sdk..init\"></a>\n\n### axway-flow-sdk~init(module, [options]) ⇒ <code>NodeBuilder</code>\nAxway API Builder SDK for creating custom nodes to work with flows.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Returns**: <code>NodeBuilder</code> - A newly constructed\n\t\t[`NodeBuilder`](#module_axway-flow-sdk..NodeBuilder) object  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| module | <code>object</code> |  | The node module. |\n| [options] | <code>object</code> |  | The options for the builder. |\n| [options.validate] | <code>object</code> | <code>true</code> | The enables parameter validation.  Disable \tif you need to use refs. |\n\n**Example**  \n```js\nconst sdk = require('axway-flow-sdk');\nexports = module.exports = sdk.init(module);\n```\n<a name=\"module_axway-flow-sdk..validate\"></a>\n\n### axway-flow-sdk~validate(nodes)\nValidates the flownodes against the Axway Flow schema.\n\n**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk)  \n**Throws**:\n\n- <code>Error</code> If nodes contains invalid flownodes.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| nodes | <code>NodeBuilder</code> | nodes to validate |\n\n**Example**  \n```js\nconst nodes = sdk.init(module).add('encodeURI', { icon: 'encode.svg' })\n\t.method('encode', { name: 'Encode URI' })\n\t.parameter('uri', { type: 'string' })\n\t.output('encoded', { context: '$.encodedURI', schema: { type: 'string' } })\n\t.action((req, cb) => cb.encoded(null, encodeURI(req.params.uri));\nsdk.validate(nodes);\n```\n\n# Changes\n\n#### 3.4.2\n- #6116: Internal cleanup chore.\n\n#### 3.4.1\n- #6074: Internal CI chore\n\n#### 3.4.0\n- #5924: Added support for string parameters having a format of \"mustache\".\n\n#### 3.3.0\n- #5892: Added support for defining a type for parameters to display by default in the Flow editor. Previously parameters always started with `selector`. Now they will consider the type provided using `initialType` as an option:\n```js\n.parameter('myToggle', {\n\ttype: 'boolean'\n}, {\n\tinitialType: 'boolean'\n})\n```\n\n#### 3.2.0\n- #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 }`.\n- #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.\nThis is useful for when context or comments are needed.\n\n#### 3.1.11\n- #5923: Fix issue where README.md was not published.\n- #5923: Fix issue where README.md was generated with hardcoded docs.\n\n#### 3.1.10\n- #5914: Internal change to re-introduce readme generation from JSDoc.\n\n#### 3.1.9\n- #5887: Fix issue where the `axway-flow -n` command would throw an error\n\n#### 3.1.8\n- #5895: Fix issue where new Flow-Node projects would not get generated with a `test` directory.\n\n#### 3.1.7\n- #5711: Internal cleanup of npm scripts.\n\n#### 3.1.6\n- #5708: Internal changes removing readme autogeneration.\n\n#### 3.1.5\n- #5708: Internal changes to mocha configuration.\n\n#### 3.1.4\n- #5709: Internal changes to update eslint rules.\n\n#### 3.1.3\n- #5707: Internal cleanup to code coverage during build process.\n\n#### 3.1.2\n- #5742: Internal change to replace `dot` dependency with `ejs` when generating new flow-node plugins.\n\n#### 3.1.0\n- #5600: Support schema references by disabling validation when building flow-nodes.\n\n#### 3.0.0\n- #5436: Breaking Change: Minimum supported version of API Builder is now Jakarta\n- #5436: Moves advanced HTTP options into a new group, \"Advanced HTTP Options\"\n\n#### 2.0.9\n- #4757: Changed SCM repository and associated internal cleanup.\n\n# License\n\nThis 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](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.\n","readmeFilename":"README.md","users":{"brentonhouse":true}}