@a-mehrabi/aranode-json-parser 中文文档教程

发布于 3年前 浏览 21 更新于 3年前

JSON PARSER Module

aranode 流引擎的 json 解析器实现。

Table of Contents

Installation

要在您的 aranode 项目中安装此模块, 你只需要使用以下命令添加包:

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

之后,当你想使用它时, 您必须将其包含在自定义模块中,如下所示:

path: .env

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

Usage

要使用 json 编码器或解码器,您需要使用编码器或解码器相关描述:

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

json encoder

json encoder flow description使您能够将 json 编码器定义为流节点。
json 编码器,将 javascript 文字对象编码为 json 字符串。

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 解码器流描述使您能够将 json 解码器定义为流节点。
json 解码器,将 json 字符串解码为 javascript 文字对象。

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

类型:流程描述

选项: jsonDecoder 不支持任何选项。

jsonDecoder

类型:流程描述

选项: jsonDecoder 不支持任何选项。

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.

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文