UNPKG

n8n-nodes-base

Version:

Base nodes of n8n

26 lines (24 loc) 1.13 kB
/** * X (Formerly Twitter) Node - Version 2 - Zod Schema Factory * Exports a factory that unions all discriminator schemas. * * Schema helpers (z, expressionSchema, etc.) are passed as parameters * by the schema-validator, not imported from external files. * * @generated - CommonJS JavaScript for runtime loading */ const getDirectMessageSchema = require('./resource_direct_message/index.schema'); const getListSchema = require('./resource_list/index.schema'); const getTweetSchema = require('./resource_tweet/index.schema'); const getUserSchema = require('./resource_user/index.schema'); module.exports = function getSchema(helpers) { const { parameters, z } = helpers; // Apply discriminator default if not set const effectiveParams = parameters.resource === undefined ? { ...parameters, resource: 'tweet' } : parameters; return z.union([ getDirectMessageSchema({ ...helpers, parameters: effectiveParams }), getListSchema({ ...helpers, parameters: effectiveParams }), getTweetSchema({ ...helpers, parameters: effectiveParams }), getUserSchema({ ...helpers, parameters: effectiveParams }), ]); };