npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

oute-services-canvas-sdk

v0.0.43

Published

- Initialization

Downloads

652

Readme

This module expose helper functions

  • Initialization
  params = {
    url: @server url
    token: @access token
  }
  Canvas = require("oute-services-canvas-sdk")
  canvas_instance = new Canvas(params)

Cache functions

  • get inputs from published canvas
  published_canvas = {
  "_id": "cjalQm9pU",
  "canvas_id": "wQ3nf3XTb",
  "task_graph": [
    [ "start", [] ],
    [ "http", [ "start" ] ],
    [ "ifelse", [ "http" ] ],
    [ "success", [ "ifelse" ] ]
  ],
  "flow": {
    "start": { "_id": "start", "type": "START", "inputs": [ { "key": "a" } ], "outputs": [] },
    "http": { "_id": "http", "type": "HTTP", "inputs": [], "outputs": [] },
    "ifelse": { "_id": "ifelse", "type": "IFELSE", "inputs": [], "outputs": [] },
    "success": { "_id": "success", "type": "SUCCESS", "inputs": [], "outputs": [] }
  },
  "state": "ACTIVE",
  "created_at": "2023-09-28T09:59:14.086Z",
  "updated_at": "2023-10-06T06:00:34.402Z",
  "__v": 0,
  "project_id": "x1QBwyqbN"
}
  await canvas_instance.getBoundsIOOfPublishedCanvas(published_canvas)
  • get start node from published canvas
  published_canvas = {
    "_id": "cjalQm9pU",
    "canvas_id": "wQ3nf3XTb",
    "task_graph": [],
    "flow": {},
    "state": "ACTIVE",
    "created_at": "2023-09-28T09:59:14.086Z",
    "updated_at": "2023-10-06T06:00:34.402Z",
    "__v": 0,
    "project_id": "x1QBwyqbN"
  }
  canvas_instance.getStartNodeOfPublishedCanvas(published_canvas)
  • get bounds input and output from canvas data
  canvas_data = "{ \"class\": \"GraphLinksModel\"}"
  canvas_instance.getBoundsIOOfCanvasData(canvas_data)
  • get bounds of untransformed canvas
  canvas_data = "{ \"class\": \"GraphLinksModel\"}"
  canvas_instance.getBoundsIOOfCanvasData(canvas_data)
  • Transform canvas to published
  canvas_data = {_id: "test", _r: ""}
  canvas_instance.transformCanvas(canvas_data)

Core functions

  • Save canvas
  body = {
    "asset_id" : "1ZXZKMvvE",
    "_r" : "{}",
    "meta": {},
    "workspace_id": "ZzBfJMpfQ",
    "name" : "test canvas",
    "parent_id" : null,
    "type" : "WORKFLOW",
    "user_id" : "[email protected]",
    "share_to_all": true
  }
  await canvas_instance.saveCanvas(body)
  • Find One
  query = {
    "asset_id": "1ZXZKMvvE"
  }
  await canvas_instance.findOne(query)
  • Get Init inputs of canvas
  query = {
    "asset_id": "1ZXZKMvvE",
    "workspace_id": "ZzBfJMpfQ"
  }
  await canvas_instance.getBoundsIOOfCanvas(query)

Publish canvas

  • publish canvas
  body = {
    "asset_id" : "1ZXZKMvvE",
    "_r" : "{}",
    "meta": {},
    "workspace_id": "ZzBfJMpfQ",
    "name" : "test canvas",
    "publish_name" : "test canvas1",
    "parent_id" : null,
    "type" : "WORKFLOW",
    "user_id" : "[email protected]",
    "project_id": "x1QBwyqbN"
    "published_id": "cjalQm9pU", //This only needed if want to update the existing published data
    "annotation": "IC",
    "_id": "abc",
    "share_to_all": true
  }
  await canvas_instance.publishCanvas(body)
  • Get list of published canvas by project id
  query = {
    "project_id": "1ZXZKMvvE"
  }
  await canvas_instance.getPublishedListByProject(query)
  • Get latest of published canvas by asset id
  query = {
    "asset_id": "1ZXZKMvvE"
  }
  await canvas_instance.getPublishedByAsset(query)
  • Transform canvas to published
  body = {
    "asset_id" : "1ZXZKMvvE",
    "_r" : "{ \"class\": \"GraphLinksModel\",\n \"nodeCategoryProperty\": \"template\",\n  \"linkKeyProperty\": \"key\",\n  \"nodeDataArray\": [\n{\"key\":\"1692361625690\",\"src\":\"/static/media/input-setup.6bc4e1375793765dd9b1e7463776f5c9.svg\",\"text\":\"\",\"subText\":\"\",\"type\":\"Input Setup\", \"tf_data\": {\"_id\": \"start\", \"type\": \"START\", \"inputs\": [{\"key\": \"a\"}], \"outputs\": []},\"template\":\"startNode\",\"background\":\"rgb(33, 150, 243)\",\"foreground\":\"#fff\",\"viewSpot\":\"0 0.5\",\"location\":\"-746 0\"},\n{\"key\":\"1692361625695\",\"src\":\"/static/media/failure-setup.2e6fe9f6dcb6fb35de5a33083c93486e.svg\",\"text\":\"\",\"subText\":\"\",\"type\":\"Failure Setup\", \"tf_data\": {\"_id\": \"failed\", \"type\": \"FAILED\", \"inputs\": [], \"outputs\": []},\"template\":\"endNode\",\"background\":\"rgb(255, 82, 82)\",\"foreground\":\"#fff\",\"viewSpot\":\"1 0.6667\",\"location\":\"766 133.36\"},\n{\"key\":\"16923616256952\",\"src\":\"/static/media/success-setup.b7611cf8ee605348416961dad01f45bc.svg\",\"text\":\"\",\"subText\":\"\",\"type\":\"Success Setup\", \"tf_data\": {\"_id\": \"success\", \"type\": \"SUCCESS\", \"inputs\": [], \"outputs\": []},\"template\":\"endNode\",\"background\":\"rgb(76, 175, 80)\",\"foreground\":\"#fff\",\"viewSpot\":\"1 0.3333\",\"location\":\"766 -133.36\"},\n{\"key\":\"1692361631573\",\"src\":\"/static/media/http.7e60c9cb780694dcb54bfa896b38083f.svg\",\"text\":\"Method\",\"subText\":\"HTTP\", \"tf_data\": {\"_id\": \"http\", \"type\": \"HTTP\", \"inputs\": [], \"outputs\": []},\"type\":\"HTTP\",\"template\":\"\",\"background\":\"#be63f9\",\"foreground\":\"#fff\",\"module\":\"Flow Controls\",\"location\":\"-416.2578125 -85.8671875\"},\n{\"key\":\"1692361641779\",\"src\":\"/static/media/ifelse.60d2e8e0ecf5753156427c8d55b0459c.svg\",\"text\":\"If Else\", \"tf_data\": {\"_id\": \"ifelse\", \"type\": \"IFELSE\", \"inputs\": [], \"outputs\": []},\"subText\":\"Condition\",\"type\":\"If Else\",\"template\":\"\",\"background\":\"rgb(33, 150, 243)\",\"foreground\":\"#fff\",\"module\":\"Flow Controls\",\"location\":\"-135.7578125 -85.90234375\"}\n],\n  \"linkDataArray\": [\n{\"from\":\"1692361625690\",\"to\":\"1692361631573\",\"key\":-1},\n{\"from\":\"1692361631573\",\"to\":\"1692361641779\",\"key\":-2},\n{\"from\":\"1692361641779\",\"to\":\"16923616256952\",\"key\":-3}\n]}",
    "meta": {},
    "workspace_id": "ZzBfJMpfQ",
    "name" : "test canvas",
    "publish_name" : "test canvas1",
    "parent_id" : null,
    "type" : "WORKFLOW",
    "user_id" : "[email protected]",
    "project_id": "x1QBwyqbN"
    "published_id": "cjalQm9pU",
    "_id": "abc",
    "share_to_all": true
  }
  canvas_instance.canvasToPublished(body)
  • Execute canvas
  canvas_data = {
    _id: "test",
    _r: ""
  }
  state = {}
  await canvas_instance.executeCanvas(canvas_data, state)
  • Execute transformed canvas
  body = {flow: {}, state: {}}
  await canvas_instance.executeTransformedCanvas(body)