0.0.55 • Published 15 days ago

oute-services-flow-utility-sdk v0.0.55

Weekly downloads
-
License
-
Repository
-
Last release
15 days ago

This module expose helper functions

  • Initialization
  var flow_utility_instance = require("oute-services-flow-utility-sdk")
  • Clean unwanted keys from json
  data = {
    key_config: {},
    a: 1
  }
  unwanted_keys = ["key_config", "task_obj"]
  result = flow_utility_instance.cleanUnwantedKeys(data, unwanted_keys)
  • Evaluate fx block
  state = {
    "1707301123322": {
      status_code: 200
    }
  }
  fx_block = {
    "type": "fx",
    "blocks": []
  }
  flow_utility_instance.fxBlock(state, fx_block)
  • Evaluate variable
  data = {
    "a": {
      "b": 1
    }
  }
  flatten_key = "\#{{a.b}}#"
  case_type = null
  nested_evaluation = true //This will decide if need to nest for the eval, default is false
  flow_utility_instance.getValue(data, flatten_key, case_type)
  • Resolve value based on type
  data = {
    "a": {
      "b": 1
    }
  }
  value = { "type": "fx", "blocks": [ { "type": "PRIMITIVES", "value": "7" }]}
  default_value = 9
  type = "INT"
  key = "id"
  case_type = null //lower, upper, caseless
  flow_utility_instance.resolveValue(data, key, value, type, default_value, case_type)
  • Parse and validate flow inputs
  input = {
    "key": "start_var1",
    "value": "sdf==>",
    "default": null,
    "type": "STRING",
    "required": false,
    "regex": null,
    "location": null
  }
  flow_utility_instance.parseAndValidate(input)
  • get default value based on type
  type = "ARRAY"
  flow_utility_instance.getDefaultValueByType(type)
  • Parse flow inputs/outputs and generate the object
  state = {
    headers: {a: 1, "content-type": "application/json"},
    body: {b: 2}
  }
  inputs = [
    {
      "key": "start_var1",
      "value": "\#{{body.b}}#",
      "default": null,
      "type": "STRING",
      "required": false,
      "regex": null,
      "location": null
    }
  ]
  update_key_by_alias = false
  flow_utility_instance.parseIO(state, inputs, update_key_by_alias)
  • Generate state from request
  req = {
    headers: {a: 1, "content-type": "application/json"},
    body: {b: 2}
  }
  inputs = [
    {
      "key": "start_var1",
      "value": "\#{{body.b}}#",
      "default": null,
      "type": "STRING",
      "required": false,
      "regex": null,
      "location": null
    }
  ]
  variables = {a: 234}
  result = flow_utility_instance.requestToStateTF(req, inputs, variables)
  • Parse db filter for orm
  state = {}
  filter = {}
  orm_type = "sequelize"
  db_type = "postgres"
  operators = Op //Sequelize operators
  flow_utility_instance.generateWhereClause(state, filter, orm_type, db_type, operators)
  • generate order by for orm
  state = {}
  inputs = [{"column": "key", "sort_by": "ASCENDING"}]
  orm_type = "sequelize"
  db_type = "postgres"
  flow_utility_instance.generateOrderByClause(state, inputs, orm_type, db_type)
  • generate group by for orm
  state = {}
  inputs = [{"column": "key"}]
  orm_type = "sequelize"
  db_type = "postgres"
  flow_utility_instance.generateGroupByClause(state, inputs, orm_type, db_type)
  • get values using dot anotation
  state = {
    "a": {
      "b": [1]
    }
  }
  flatten_key = "a.b.0"
  case_type = "caseless"
  flow_utility_instance.getValueByFlattenKeys(state, flatten_key, case_type)
0.0.55

15 days ago

0.0.53

17 days ago

0.0.54

17 days ago

0.0.52

18 days ago

0.0.51

21 days ago

0.0.50

23 days ago

0.0.49

25 days ago

0.0.47

28 days ago

0.0.48

27 days ago

0.0.46

29 days ago

0.0.42

1 month ago

0.0.43

1 month ago

0.0.44

1 month ago

0.0.45

30 days ago

0.0.41

1 month ago

0.0.40

1 month ago

0.0.39

1 month ago

0.0.37

1 month ago

0.0.38

1 month ago

0.0.34

1 month ago

0.0.35

1 month ago

0.0.30

1 month ago

0.0.31

1 month ago

0.0.32

1 month ago

0.0.33

1 month ago

0.0.29

2 months ago

0.0.28

2 months ago

0.0.25

2 months ago

0.0.26

2 months ago

0.0.27

2 months ago

0.0.23

2 months ago

0.0.24

2 months ago

0.0.22

2 months ago

0.0.21

2 months ago

0.0.20

2 months ago

0.0.19

2 months ago

0.0.18

2 months ago

0.0.17

2 months ago

0.0.16

3 months ago

0.0.13

3 months ago

0.0.14

3 months ago

0.0.15

3 months ago

0.0.10

3 months ago

0.0.11

3 months ago

0.0.12

3 months ago

0.0.9

3 months ago

0.0.8

3 months ago

0.0.7

3 months ago

0.0.5

3 months ago

0.0.6

3 months ago

0.0.4

3 months ago

0.0.3

3 months ago

0.0.2

3 months ago

0.0.1

3 months ago