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.
31 lines
820 B
JavaScript
31 lines
820 B
JavaScript
const _ = require('lodash');
|
|
const jsonschema = require('jsonschema');
|
|
|
|
const actionTypes = ['triggers', 'searches', 'creates', 'bulkReads'];
|
|
|
|
const labelWhenVisible = (definition) => {
|
|
const errors = [];
|
|
|
|
for (const actionType of actionTypes) {
|
|
const group = definition[actionType] || {};
|
|
_.each(group, (action, key) => {
|
|
const { display } = action;
|
|
if (!display.hidden && !(display.label && display.description)) {
|
|
errors.push(
|
|
new jsonschema.ValidationError(
|
|
`visible actions must have a label and description`,
|
|
action,
|
|
`/BasicDisplaySchema`,
|
|
`instance.${actionType}.${key}.display`,
|
|
'invalid',
|
|
'key',
|
|
),
|
|
);
|
|
}
|
|
});
|
|
}
|
|
|
|
return errors;
|
|
};
|
|
|
|
module.exports = labelWhenVisible;
|