Compose-ready workspace: packages/zappier (rate card, portal, Stripe), packages/verae-zapier-middleware (timestamp + NATS), packages/verae-zapier (CLI app), vendor/zapier-platform, and research/zapier vendor corpus. Gate 0 structure checks pass. Product code and research are not yet wired.
35 lines
926 B
JavaScript
35 lines
926 B
JavaScript
'use strict';
|
|
|
|
const _ = require('lodash');
|
|
const jsonschema = require('jsonschema');
|
|
|
|
const pollingThrottle = (definition) => {
|
|
const errors = [];
|
|
const actionType = 'triggers';
|
|
|
|
if (definition[actionType]) {
|
|
_.each(definition[actionType], (actionDef) => {
|
|
if (
|
|
actionDef.operation &&
|
|
actionDef.operation.throttle &&
|
|
_.has(actionDef.operation.throttle, 'retry') &&
|
|
(!actionDef.operation.type || actionDef.operation.type === 'polling')
|
|
) {
|
|
errors.push(
|
|
new jsonschema.ValidationError(
|
|
'must not use the "retry" field for a polling trigger.',
|
|
actionDef.operation.throttle,
|
|
'/ThrottleObjectSchema',
|
|
`instance.${actionType}.${actionDef.key}.operation.throttle`,
|
|
'invalid',
|
|
'throttle',
|
|
),
|
|
);
|
|
}
|
|
});
|
|
}
|
|
|
|
return errors;
|
|
};
|
|
|
|
module.exports = pollingThrottle;
|