Improved JSDocs in limit package
no issue - There were a few errors and little inconsistencies that needed a cleanup
This commit is contained in:
parent
3c6bb95234
commit
d6d88d4f70
@ -11,7 +11,7 @@ class Limit {
|
||||
* @param {String} options.name - name of the limit
|
||||
* @param {String} options.error - error message to use when limit is reached
|
||||
* @param {String} options.helpLink - URL to the resource explaining how the limit works
|
||||
* @param {Object} options.db - instance of knex db connection that currentCountQuery can use to run state check through
|
||||
* @param {Object} [options.db] - instance of knex db connection that currentCountQuery can use to run state check through
|
||||
* @param {Object} options.errors - instance of errors compatible with Ghost-Ignition's errors (https://github.com/TryGhost/Ignition#errors)
|
||||
*/
|
||||
constructor({name, error, helpLink, db, errors}) {
|
||||
@ -99,6 +99,7 @@ class MaxLimit extends Limit {
|
||||
*
|
||||
* @param {Object} options
|
||||
* @param {Number} [options.max] - overrides configured default max value to perform checks against
|
||||
* @param {Number} [options.addedCount] - number of items to add to the currentCount during the check
|
||||
*/
|
||||
async errorIfWouldGoOverLimit({max, addedCount = 1} = {}) {
|
||||
let currentCount = await this.currentCountQuery(this.db);
|
||||
@ -130,6 +131,7 @@ class MaxPeriodicLimit extends Limit {
|
||||
* @param {String} options.name - name of the limit
|
||||
* @param {Object} options.config - limit configuration
|
||||
* @param {Number} options.config.maxPeriodic - maximum limit the limit would check against
|
||||
* @param {String} options.config.error - error message to use when limit is reached
|
||||
* @param {Function} options.config.currentCountQuery - query checking the state that would be compared against the limit
|
||||
* @param {('month')} options.config.interval - an interval to take into account when checking the limit. Currently only supports 'month' value
|
||||
* @param {String} options.config.startDate - start date in ISO 8601 format (https://en.wikipedia.org/wiki/ISO_8601), used to calculate period intervals
|
||||
@ -202,6 +204,7 @@ class MaxPeriodicLimit extends Limit {
|
||||
*
|
||||
* @param {Object} options
|
||||
* @param {Number} [options.max] - overrides configured default maxPeriodic value to perform checks against
|
||||
* @param {Number} [options.addedCount] - number of items to add to the currentCount during the check
|
||||
*/
|
||||
async errorIfWouldGoOverLimit({max, addedCount = 1} = {}) {
|
||||
let currentCount = await this.currentCountQuery(this.db);
|
||||
@ -233,6 +236,7 @@ class FlagLimit extends Limit {
|
||||
* @param {String} options.name - name of the limit
|
||||
* @param {Object} options.config - limit configuration
|
||||
* @param {Number} options.config.disabled - disabled/enabled flag for the limit
|
||||
* @param {String} options.config.error - error message to use when limit is reached
|
||||
* @param {String} options.helpLink - URL to the resource explaining how the limit works
|
||||
* @param {Object} options.db - instance of knex db connection that currentCountQuery can use to run state check through
|
||||
* @param {Object} options.errors - instance of errors compatible with Ghost-Ignition's errors (https://github.com/TryGhost/Ignition#errors)
|
||||
@ -275,6 +279,16 @@ class FlagLimit extends Limit {
|
||||
}
|
||||
|
||||
class AllowlistLimit extends Limit {
|
||||
/**
|
||||
*
|
||||
* @param {Object} options
|
||||
* @param {String} options.name - name of the limit
|
||||
* @param {Object} options.config - limit configuration
|
||||
* @param {[String]} options.config.allowlist - allowlist values that would be compared against
|
||||
* @param {String} options.config.error - error message to use when limit is reached
|
||||
* @param {String} options.helpLink - URL to the resource explaining how the limit works
|
||||
* @param {Object} options.errors - instance of errors compatible with Ghost-Ignition's errors (https://github.com/TryGhost/Ignition#errors)
|
||||
*/
|
||||
constructor({name, config, helpLink, errors}) {
|
||||
super({name, error: config.error || '', helpLink, errors});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user