oute-services-variable-sdk

0.0.20 • Public • Published

This module expose helper functions

  • Initialization
  var params = {
    url: @server url
    token: @access token
  }
  var Variable = require("oute-services-variable-sdk")
  var variable_instance = new Variable(params)

Cache functions

  • transformed variable to state
  variables = {LOCAL: []}
  environment_id = null
  variable_instance.transformedToState(variables, environment_id)

Core functions

  • Save
  body = {
    "_id": "ZX7c062wq",
    "name": "test2",
    "data_type": "STRING",
    "mode": "LOCAL",
    "default" : "test",
    "state": "ACTIVE",
    "workspace_id": "work",
    "asset_id" : "q-GmTD5-K",
    "parent_id" : "q-GmTD5-K",
    "env":{
      "default": "test1"
    }
  }
  await variable_instance.save(body)
  • Delete
  variable_id = "ZX7c062wq"
  await variable_instance.delete(variable_id)
  • Get by parent/project id
  parent_id = "q-GmTD5-K"
  asset_cache_obj = {
    "_id": "test@gofo.app|ZzBfJMpfQ",
    "user_id": "test@gofo.app",
    "workspace_id": "ZzBfJMpfQ",
    "workspace": {
      "_id": "ZzBfJMpfQ",
      "name": "test"
    },
    "user": {
      "_id": "test@gofo.app",
      "name": "test",
      "src": "test",
      "email_id": "test@gofo.app"
    },
    "folders": [
      {
        "_id": "q-GmTD5-K",
        "owner_id": "test@gofo.app",
        "name": "test form",
        "owner": {
          "_id": "test@gofo.app",
          "name": "test",
          "src": "test",
        },
        "is_favorite": false,
        "childs": [
          {
            "_id": "MyTbZOnfH",
            "owner_id": "test@gofo.app",
            "name": "test form",
            "owner": {
              "_id": "test@gofo.app",
              "name": "test",
            },
            "is_favorite": false
          }
        ]
      }
    ],
    "files": [
      {
        "_id": "q-GmTD5-K",
        "owner_id": "test@gofo.app",
        "name": "test form",
        "owner": {
          "_id": "test@gofo.app",
          "name": "test"
        },
        "is_favorite": false,
        "childs": [
          {
            "_id": "MyTbZOnfH",
            "owner_id": "test@gofo.app",
            "name": "test form",
            "owner": {
              "_id": "test@gofo.app",
              "name": "test",
              "src": "test",
            },
            "is_favorite": false
          }
        ]
      }
    ],
    "recent": [],
    "recommendation": [],
    "shared": [],
    "favourites": [],
    "trash": [],
    "checksum": "68fe37b0-9101-49e8-b8b7-35e7c89b0759",
    "created_at": "2023-07-11T18:25:53.863Z",
    "updated_at": "2023-07-12T11:20:44.818Z"
  }
  await a.getByParent(parent_id, asset_cache_obj)
  • Save
  body = {
    "variable_ids": ["ZX7c062wq"],
    "workspace_id": "ZzBfJMpfQ",
    "asset_id" : "q-GmTD5-K"
  }
  await variable_instance.mapToAsset(body)

Readme

Keywords

none

Package Sidebar

Install

npm i oute-services-variable-sdk

Weekly Downloads

133

Version

0.0.20

License

none

Unpacked Size

22.1 kB

Total Files

14

Last publish

Collaborators

  • oute