Milestone 0: import zappier billing, Verae middleware, and Zapier research
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.
This commit is contained in:
commit
b4150c8250
1364 changed files with 6814366 additions and 0 deletions
35
vendor/zapier-platform/packages/schema/lib/functional-constraints/matchingKeys.js
vendored
Normal file
35
vendor/zapier-platform/packages/schema/lib/functional-constraints/matchingKeys.js
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
'use strict';
|
||||
|
||||
const _ = require('lodash');
|
||||
const jsonschema = require('jsonschema');
|
||||
|
||||
const actionTypes = ['triggers', 'searches', 'creates'];
|
||||
|
||||
const matchingKeys = (definition) => {
|
||||
const errors = [];
|
||||
|
||||
// verifies that x.key === x
|
||||
// otherwise, we double results in the compiled app via core's compileApp
|
||||
|
||||
for (const actionType of actionTypes) {
|
||||
const group = definition[actionType] || {};
|
||||
_.each(group, (action, key) => {
|
||||
if (action.key !== key) {
|
||||
errors.push(
|
||||
new jsonschema.ValidationError(
|
||||
`must have a matching top-level key (found "${key}" and "${action.key}")`,
|
||||
action,
|
||||
`/${_.capitalize(actionType)}Schema`,
|
||||
`instance.${key}.key`,
|
||||
'invalid',
|
||||
'key',
|
||||
),
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return errors;
|
||||
};
|
||||
|
||||
module.exports = matchingKeys;
|
||||
Loading…
Add table
Add a link
Reference in a new issue