0.0.86 • Published 12 months ago

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

Weekly downloads
-
License
-
Repository
-
Last release
12 months 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.84

1 year ago

0.0.85

1 year ago

0.0.86

12 months ago

0.0.80

1 year ago

0.0.81

1 year ago

0.0.82

1 year ago

0.0.83

1 year ago

0.0.73

1 year ago

0.0.74

1 year ago

0.0.75

1 year ago

0.0.76

1 year ago

0.0.77

1 year ago

0.0.78

1 year ago

0.0.79

1 year ago

0.0.70

1 year ago

0.0.71

1 year ago

0.0.72

1 year ago

0.0.62

1 year ago

0.0.63

1 year ago

0.0.64

1 year ago

0.0.65

1 year ago

0.0.66

1 year ago

0.0.67

1 year ago

0.0.68

1 year ago

0.0.69

1 year ago

0.0.60

1 year ago

0.0.61

1 year ago

0.0.59

1 year ago

0.0.56

1 year ago

0.0.57

1 year ago

0.0.58

1 year ago

0.0.55

1 year ago

0.0.53

1 year ago

0.0.54

1 year ago

0.0.52

1 year ago

0.0.51

1 year ago

0.0.50

1 year ago

0.0.49

1 year ago

0.0.47

1 year ago

0.0.48

1 year ago

0.0.46

1 year ago

0.0.42

1 year ago

0.0.43

1 year ago

0.0.44

1 year ago

0.0.45

1 year ago

0.0.41

1 year ago

0.0.40

1 year ago

0.0.39

1 year ago

0.0.37

1 year ago

0.0.38

1 year ago

0.0.34

1 year ago

0.0.35

1 year ago

0.0.30

1 year ago

0.0.31

1 year ago

0.0.32

1 year ago

0.0.33

1 year ago

0.0.29

1 year ago

0.0.28

1 year ago

0.0.25

1 year ago

0.0.26

1 year ago

0.0.27

1 year ago

0.0.23

1 year ago

0.0.24

1 year ago

0.0.22

1 year ago

0.0.21

1 year ago

0.0.20

1 year ago

0.0.19

1 year ago

0.0.18

1 year ago

0.0.17

1 year ago

0.0.16

1 year ago

0.0.13

1 year ago

0.0.14

1 year ago

0.0.15

1 year ago

0.0.10

1 year ago

0.0.11

1 year ago

0.0.12

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.5

1 year ago

0.0.6

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago