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.
41 lines
1.4 KiB
JavaScript
41 lines
1.4 KiB
JavaScript
'use strict';
|
|
|
|
/* Each check below is expected to return a list of ValidationSchema errors. An error is defined by:
|
|
* new jsonschema.ValidationError(
|
|
* message, // string that explains the problem, like 'must not have a URL that points to AWS'
|
|
* instance, // the snippet of the app definition that is invalid
|
|
* schema, // name of the schema that failed, like '/TriggerSchema'
|
|
* propertyPath, // stringified path to problematic snippet, like 'instance.triggers.find_contact'
|
|
* name, // optional, the validation type that failed. Can make something up like 'invalidUrl'
|
|
* argument // optional
|
|
* );
|
|
*/
|
|
const checks = [
|
|
require('./searchOrCreateKeys'),
|
|
require('./deepNestedFields'),
|
|
require('./mutuallyExclusiveFields'),
|
|
require('./requiredSamples'),
|
|
require('./matchingKeys'),
|
|
require('./labelWhenVisible'),
|
|
require('./uniqueInputFieldKeys'),
|
|
require('./bufferedCreateConstraints'),
|
|
require('./requirePerformConditionally'),
|
|
require('./pollingThrottle'),
|
|
require('./AuthFieldisSafe'),
|
|
require('./inputFieldGroupsConstraints'),
|
|
require('./validateJsonFieldSchema'),
|
|
];
|
|
|
|
const runFunctionalConstraints = (definition, mainSchema) => {
|
|
return checks.reduce((errors, checkFunc) => {
|
|
const errorsForCheck = checkFunc(definition, mainSchema);
|
|
if (errorsForCheck) {
|
|
errors = errors.concat(errorsForCheck);
|
|
}
|
|
return errors;
|
|
}, []);
|
|
};
|
|
|
|
module.exports = {
|
|
run: runFunctionalConstraints,
|
|
};
|