n8n-nodes-base
Version:
Base nodes of n8n
32 lines (30 loc) • 1.53 kB
JavaScript
/**
* GitHub - Workflow 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 getDisableSchema = require('./operation_disable.schema');
const getDispatchSchema = require('./operation_dispatch.schema');
const getDispatchAndWaitSchema = require('./operation_dispatch_and_wait.schema');
const getEnableSchema = require('./operation_enable.schema');
const getGetSchema = require('./operation_get.schema');
const getGetUsageSchema = require('./operation_get_usage.schema');
const getListSchema = require('./operation_list.schema');
module.exports = function getSchema(helpers) {
const { parameters, z } = helpers;
// Apply operation default if not set
const effectiveParams = parameters.operation === undefined ? { ...parameters, operation: 'getRepositories' } : parameters;
return z.union([
getDisableSchema({ ...helpers, parameters: effectiveParams }),
getDispatchSchema({ ...helpers, parameters: effectiveParams }),
getDispatchAndWaitSchema({ ...helpers, parameters: effectiveParams }),
getEnableSchema({ ...helpers, parameters: effectiveParams }),
getGetSchema({ ...helpers, parameters: effectiveParams }),
getGetUsageSchema({ ...helpers, parameters: effectiveParams }),
getListSchema({ ...helpers, parameters: effectiveParams }),
]);
};