master-zapier-plan-draft/vendor/zapier-platform/packages/schema/lib/schemas/FunctionSourceSchema.js
George Lambert b4150c8250 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.
2026-09-09 02:37:36 -04:00

37 lines
957 B
JavaScript

'use strict';
const makeSchema = require('../utils/makeSchema');
module.exports = makeSchema({
id: '/FunctionSourceSchema',
description:
'Source code like `{source: "return 1 + 2"}` which the system will wrap in a function for you.',
type: 'object',
required: ['source'],
properties: {
source: {
type: 'string',
pattern: 'return',
description:
'JavaScript code for the function body. This must end with a `return` statement.',
},
args: {
type: 'array',
items: { type: 'string' },
description:
"Function signature. Defaults to `['z', 'bundle']` if not specified.",
},
},
additionalProperties: false,
examples: [
{ source: 'return 1 + 2' },
{ args: ['x', 'y'], source: 'return x + y;' },
],
antiExamples: [
{
example: { source: '1 + 2' },
reason:
'Invalid value for key: source (must end with a `return` statement)',
},
],
});