@skedulo/function-utilities
v0.0.6
Published
Connected Function utilities library
Downloads
3,910
Maintainers
Keywords
Readme
Skedulo Function Utilities
External development utilities for Skedulo Connected Function. This project includes utilities to parse Skedulo specific header to extract Custom Settings, User Context, and Authorization Info. This project is intended to be used only as a dev dependency in package projects because of its dependency on Node and the filesystem.
To develop both the dev public package and the Connected Function template, it's recommended that yarn link
is used across projects to test changes locally. For the package, this involves running yarn link
at the root and for each boilerplate running yarn link @skedulo/function-header-helper
.
Package Development
- Dependency Installation:
yarn
- Compile the package:
yarn compile
- Release package for local version to NPM:
yarn release-package ${versionNumber}
How to use this package in your project
const { method, path, headers, body, querystring } = payload
const skedContext:SkedContext = createSkedContext(headers);
// Get access token and Skedulo API base URL
const token: string = skedContext.auth.apiToken;
const baseUrl: string = skedConText.auth.baseUrl;
// Get the username of the user triggering the function
const userName: string = skedContext.userContext.username;
// Configuration Variables
// This will return the value of TEST_CONFIG variable in your Skedulo configuration. If the variable is not set, the function will return undefined.
const configVar = skedContext.configVars.getVariableValue("TEST_CONFIG")