New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@trayio/connector-utils

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trayio/connector-utils

Common utility functions used in connectors.

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
decreased by-69.57%
Maintainers
1
Weekly downloads
 
Created
Source

Connector-utils

Common utility functions used in connectors.

Usage

TODO: add usage guide

Documentation

Classes

GenericErrorError

Class representing the base error for all connector errors

UserInputErrorGenericError

Class representing a UserInputError

ConnectorErrorGenericError

Class representing a ConnectorError

ApiErrorGenericError

Class representing a ConnectorError

OAuthRefreshGenericError

Class representing a ConnectorError

NoTriggerErrorGenericError

Class representing a ConnectorError

Functions

mustachedDDL(object, text, value, isInteger)

Takes value paths as mustached values and returns correct DDL outputs. A custom flag is in place to allow for keeping integer types for the value key if required, as mustaching will convert an integer to string.

DDL(object, textPath, valuePath)

Takes value paths as explicit strings and returns correct DDL outputs.

deepMapKeys(collection, iteratee)

Maps object keys and formats according to specified casing.

userInputErrorRejection(message, body)

Return a User Input Error with option to pass a body argument. The use case for this over the custom Error class is to pass a body to provide error context.

connectorErrorRejection(message, body)

Return a Connector Error with option to pass a body argument. The use case for this over the custom Error class is to pass a body to provide error context.

apiErrorRejection(message, body)

Return a API Error with option to pass a body argument. The use case for this over the custom Error class is to pass a body to provide error context.

oauthErrorRejection(message, body)

Return a oAuth Error with option to pass a body argument. The use case for this over the custom Error class is to pass a body to provide error context.

noTriggerErrorRejection(message, body)

Return a No Trigger Error with option to pass a body argument. The use case for this over the custom Error class is to pass a body to provide error context.

lookup(message, [step_settings])

Generates a lookup object for DDL operations.

removeEmptyObjects(collection)

Recursively removes empty objects, arrays and strings from a collection. It's important to note that this method will remove objects if they become empty as a result of the nested key/value containing an empty object (the same goes for arrays).

GenericError ⇐ Error

Class representing the base error for all connector errors

Kind: global class
Extends: Error

UserInputError ⇐ GenericError

Class representing a UserInputError

Kind: global class
Extends: GenericError

new UserInputError(message, ...errorArgs)

Custom error to throw for issues concerning User Input.

ParamTypeDescription
messageStringCustom error message to return.
...errorArgsanyError args allowing for extra parameters native to the normal Error class.

ConnectorError ⇐ GenericError

Class representing a ConnectorError

Kind: global class
Extends: GenericError

new ConnectorError(message, ...errorArgs)

Custom error to throw for issues concerning the Connector.

ParamTypeDescription
messageStringCustom error message to return.
...errorArgsanyError args allowing for extra parameters native to the normal Error class.

ApiError ⇐ GenericError

Class representing a ConnectorError

Kind: global class
Extends: GenericError

new ApiError(message, ...errorArgs)

Custom error to throw for issues concerning the Api;;.

ParamTypeDescription
messageStringCustom error message to return.
...errorArgsanyError args allowing for extra parameters native to the normal Error class.

OAuthRefresh ⇐ GenericError

Class representing a ConnectorError

Kind: global class
Extends: GenericError

new OAuthRefresh(message, ...errorArgs)

Custom error to throw when an oAuth token has expired.

ParamTypeDescription
messageStringCustom error message to return.
...errorArgsanyError args allowing for extra parameters native to the normal Error class.

NoTriggerError ⇐ GenericError

Class representing a ConnectorError

Kind: global class
Extends: GenericError

new NoTriggerError(message, ...errorArgs)

Custom error to throw for issues when a trigger request is ignored.

ParamTypeDescription
messageStringCustom error message to return.
...errorArgsanyError args allowing for extra parameters native to the normal Error class.

mustachedDDL(object, text, value, isInteger)

Takes value paths as mustached values and returns correct DDL outputs. A custom flag is in place to allow for keeping integer types for the value key if required, as mustaching will convert an integer to string.

Kind: global function

ParamTypeDefaultDescription
objectObjectThe collection with keys to iterate over and format.
textStringThe path for the required text value.
valueStringThe path for the required value, value.
isIntegerBooleanfalseFlag for whether or not the value field needs to an integer rather than a string.

DDL(object, textPath, valuePath)

Takes value paths as explicit strings and returns correct DDL outputs.

Kind: global function

ParamTypeDescription
objectObjectThe collection with keys to iterate over and format.
textPathStringThe path for the required text value.
valuePathStringThe path fot the required value, value.

deepMapKeys(collection, iteratee)

Maps object keys and formats according to specified casing.

Kind: global function

ParamTypeDescription
collectionObjectThe collection with keys to iterate over and format.
iterateefunctionThe format function used to format keys IE Lodash _.camelCase('some_string').

userInputErrorRejection(message, body)

Return a User Input Error with option to pass a body argument. The use case for this over the custom Error class is to pass a body to provide error context.

Kind: global function

ParamTypeDescription
messageStringThe error message to be returned.
bodyanyCustom body to be returned when providing more error context.

connectorErrorRejection(message, body)

Return a Connector Error with option to pass a body argument. The use case for this over the custom Error class is to pass a body to provide error context.

Kind: global function

ParamTypeDescription
messageStringThe error message to be returned.
bodyanyCustom body to be returned when providing more error context.

apiErrorRejection(message, body)

Return a API Error with option to pass a body argument. The use case for this over the custom Error class is to pass a body to provide error context.

Kind: global function

ParamTypeDescription
messageStringThe error message to be returned.
bodyanyCustom body to be returned when providing more error context.

oauthErrorRejection(message, body)

Return a oAuth Error with option to pass a body argument. The use case for this over the custom Error class is to pass a body to provide error context.

Kind: global function

ParamTypeDescription
messageStringThe error message to be returned.
bodyanyCustom body to be returned when providing more error context.

noTriggerErrorRejection(message, body)

Return a No Trigger Error with option to pass a body argument. The use case for this over the custom Error class is to pass a body to provide error context.

Kind: global function

ParamTypeDescription
messageStringThe error message to be returned.
bodyanyCustom body to be returned when providing more error context.

lookup(message, [step_settings])

Generates a lookup object for DDL operations.

Kind: global function

ParamTypeDefaultDescription
messageStringThe DDL operation that is run when the lookup is executed.
[step_settings]Object{}The custom step settings for the lookup.

removeEmptyObjects(collection)

Recursively removes empty objects, arrays and strings from a collection. It's important to note that this method will remove objects if they become empty as a result of the nested key/value containing an empty object (the same goes for arrays).

Kind: global function

ParamTypeDescription
collectionObjectThe collection from which to remove empty objects.

Keywords

FAQs

Package last updated on 05 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc