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
11
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trayio/connector-utils - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

lib/validatePaginationRange.js

2

lib/index.js
const deepMapKeys = require('./deepMapKeys');
const removeEmptyObjects = require('./removeEmptyObjects');
const lookup = require('./lookup');
const validatePaginationRange = require('./validatePaginationRange');
// const xmlFormatter = require('./xmlFormatter');

@@ -65,2 +66,3 @@ const { mustachedDDL, DDL } = require('./ddl');

DDL,
validatePaginationRange,
// Commenting for initial release pending functionality to add paths to treatAsArray

@@ -67,0 +69,0 @@ // xml: {

@@ -6,2 +6,3 @@ const ERROR_MESSAGES = {

LOOKUP: 'The lookup operation encountered an issue.',
PAGINATION: 'The validatePagination operation encountered an issue.',
};

@@ -47,2 +48,8 @@

class PaginationError extends GenericInternalError {
constructor(message = ERROR_MESSAGES.PAGINATION, ...errorArgs) {
super(message, ...errorArgs);
}
}
module.exports = {

@@ -53,2 +60,3 @@ XMLError,

LookupError,
PaginationError,
};

2

package.json
{
"name": "@trayio/connector-utils",
"version": "0.1.0",
"version": "0.1.1",
"description": "Common utility functions used in connectors.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -101,2 +101,5 @@ # Connector-utils

</dd>
<dt><a href="#validatePaginationRange">validatePaginationRange(value, validation)</a></dt>
<dd><p>Helper for validating user pagination input for a given range.</p>
</dd>
</dl>

@@ -332,1 +335,26 @@

| collection | <code>Object</code> | The collection from which to remove empty objects. |
<a name="validatePaginationRange"></a>
## validatePaginationRange(value, validation)
Helper for validating user pagination input for a given range.
**Kind**: global function
| Param | Type | Description |
| --- | --- | --- |
| value | <code>Integer</code> \| <code>String</code> | The value specified by user input. |
| validation | <code>Object</code> | Values relating specifically to the validation requirements. |
| validation.minRange | <code>Integer</code> \| <code>String</code> | The minimum range specified by the API. |
| validation.maxRange | <code>Integer</code> \| <code>String</code> | The maximum range specified by the API. |
| validation.inputName | <code>String</code> | The name of the input the range is associated with. |
**Example**
```js
validatePaginationRange(50, { minRange: 1, maxRange: 100, inputName: 'page size' })
// no error thrown as pagination is within range
validatePaginationRange(101, { minRange: 1, maxRange: 100, inputName: 'page size' })
// will throw a UserInputError as the pageSize is outside the range
// Error message returned: 'The page size must be between 1 - 100.'
```
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