n8n-nodes-base
Version:
Base nodes of n8n
28 lines (26 loc) • 1.21 kB
JavaScript
/**
* Matrix - Room Resource - Zod Schema Factory
* Exports a factory that unions all operation schemas for this resource.
*
* 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 getCreateSchema = require('./operation_create.schema');
const getInviteSchema = require('./operation_invite.schema');
const getJoinSchema = require('./operation_join.schema');
const getKickSchema = require('./operation_kick.schema');
const getLeaveSchema = require('./operation_leave.schema');
module.exports = function getSchema(helpers) {
const { parameters, z } = helpers;
// Apply operation default if not set
const effectiveParams = parameters.operation === undefined ? { ...parameters, operation: 'me' } : parameters;
return z.union([
getCreateSchema({ ...helpers, parameters: effectiveParams }),
getInviteSchema({ ...helpers, parameters: effectiveParams }),
getJoinSchema({ ...helpers, parameters: effectiveParams }),
getKickSchema({ ...helpers, parameters: effectiveParams }),
getLeaveSchema({ ...helpers, parameters: effectiveParams }),
]);
};