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
27
vendor/zapier-platform/packages/schema/lib/utils/makeSchema.js
vendored
Normal file
27
vendor/zapier-platform/packages/schema/lib/utils/makeSchema.js
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
'use strict';
|
||||
|
||||
const _ = require('lodash');
|
||||
|
||||
const makeValidator = require('./makeValidator');
|
||||
|
||||
const getRawSchema = (schema) => schema.schema;
|
||||
|
||||
const getDependencies = (schema) => schema.dependencies;
|
||||
|
||||
const flattenDependencies = (schemas) => {
|
||||
schemas = schemas || [];
|
||||
return _.flatten(schemas.map(getDependencies).concat(schemas));
|
||||
};
|
||||
|
||||
const makeSchema = (schemaDefinition, schemaDependencies) => {
|
||||
const dependencies = flattenDependencies(schemaDependencies);
|
||||
const validatorDependencies = dependencies.map(getRawSchema);
|
||||
return {
|
||||
dependencies,
|
||||
id: schemaDefinition.id,
|
||||
schema: schemaDefinition,
|
||||
validate: makeValidator(schemaDefinition, validatorDependencies).validate,
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = makeSchema;
|
||||
Loading…
Add table
Add a link
Reference in a new issue