Common functions that can be used by any plugin
npm install @squaredup/plugin-commonThis is a module that contains common functions that can be used by all SquaredUp Plugins.
Important to note the no future change can be allowed to break any existing functionality, versioning must be properly maintained in package.json.
- collectSuccessfulResponses : Takes in a list of promises (usually API responses) and returns only the ones that were successful (deprecated)
- flattenObjectArrayProps : Flattens single-item array properties in an array of objects to a single non-array value
- categorizeObjectArrayByProp : Categorizes an array of objects into separate properties of an object based on a property on each object
- collectResponses : Takes in a list of promises (usually API responses) and returns information about successful and failed responses
- processStandardDataStreamMessages : a helper routine to report errors returned by collectResponses() in a standard format
- deGremlin : a helper function to extract individual property values from a 'vertex', use flattenObjectArrayProps for full vertices
- getBase64Auth : a helper function for encoding usernames and passwords to base64 for Authorization headers
- pageAPI : a helper function that generates functions that can be used to manage pagingContext in import operations
- isValidEdge: a helper function that validates whether an edge is in an appropriate format or not
- isValidVertex: a helper function that validates whether a vertex is in an appropriate format or not
- warningTracker : a helper function that generates functions that can be used to track warnings sent to users
- generatePkcePair : a helper function that generates a challenge code and verifier for use with PKCE
- generateAxiosRequestLogInterceptors : a helper function that generates interceptors for axios that log requests consistently
- note that this does not prevent you from adding more interceptors to do something less generic later.
- generateAxiosResponeLogInterceptors : a helper function that generates interceptors for axios that log responses consistently
- note that this does not prevent you from adding more interceptors to do something less generic later.