1.0.0 • Published 2 years ago

@a-mehrabi/aranode-json-parser v1.0.0

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

JSON PARSER Module

json parser implementation for aranode flow engine.

Table of Contents

Installation

To install this module in your aranode project, you just need to add the package using following command:

$ yarn add @a-mehrabi/aranode-json-parser

After that, when you want to use it, you must include it in custom modules like the following:

path: .env

ARANODE_CUSTOM_MODULES=@a-mehrabi/aranode-json-parser

Usage

For using json encoder or decoder, you need to use encoder or decoder associated description:

  1. json encoder flow description (jsonEncoder)
  2. json decoder flow description (jsonDecoder)

json encoder

json encoder flow description enables you to define the json encoder as a flow node.
json encoder, encodes javascript literal object to json string.

version: 1
kind: flow
name: greeter-flow
entryPoint: start

flow:
  start:
    transform:
      path: 'dist/get-payload-transformer.js'
    nextNode: initJsonEncoder

  initJsonEncoder:
    jsonEncoder: {}
    nextNode: checkPayload

  checkPayload:
    transform:
      path: 'dist/check-payload-transformer.js'
    nextNode: response

  response:
    port:
      name: greet-in-port
      type: inbound
      response: true
      end: true
    terminal: true

json decoder

json decoder flow description enables you to define the json decoder as a flow node.
json decoder, decodes json string to javascript literal object.

version: 1
kind: flow
name: greeter-flow
entryPoint: start

flow:
  start:
    transform:
      path: 'dist/get-payload-transformer.js'
    nextNode: initJsonDecoder

  initJsonDecoder:
    jsonDecoder: {}
    nextNode: checkPayload

  checkPayload:
    transform:
      path: 'dist/check-payload-transformer.js'
    nextNode: response

  response:
    port:
      name: greet-in-port
      type: inbound
      response: true
      end: true
    terminal: true

API

jsonEncoder

Type: flow description

Options: jsonDecoder does not support any options.

jsonDecoder

Type: flow description

Options: jsonDecoder does not support any options.