UNPKG

n8n-nodes-base

Version:

Base nodes of n8n

27 lines (24 loc) 1.9 kB
/** * Google Perspective Node - Version 1 - Zod Validation Schemas * * These schemas validate node configuration at runtime. * Use .parse() for strict validation or .safeParse() for error handling. * * Schema helpers (z, expressionSchema, etc.) are passed as parameters * by the schema-validator, not imported from external files. * * @generated - CommonJS JavaScript for runtime loading */ module.exports = function getSchema({ parameters, z, expressionSchema, stringOrExpression, numberOrExpression, booleanOrExpression, resourceLocatorValueSchema, resourceMapperValueSchema, filterValueSchema, assignmentCollectionValueSchema, iDataObjectSchema, resolveSchema }) { // Parameters schema const parametersSchema = z.object({ operation: z.union([z.literal('analyzeComment')]).optional(), text: resolveSchema({ parameters, schema: stringOrExpression, required: false, displayOptions: {"show":{"operation":["analyzeComment"]}}, defaults: {"operation":"analyzeComment"} }), requestedAttributesUi: resolveSchema({ parameters, schema: z.object({ requestedAttributesValues: z.array(z.object({ attributeName: z.union([z.literal('flirtation'), z.literal('identity_attack'), z.literal('insult'), z.literal('profanity'), z.literal('severe_toxicity'), z.literal('sexually_explicit'), z.literal('threat'), z.literal('toxicity'), expressionSchema]).optional(), scoreThreshold: numberOrExpression.optional() })).optional() }), required: false, displayOptions: {"show":{"operation":["analyzeComment"]}}, defaults: {"operation":"analyzeComment"} }), options: resolveSchema({ parameters, schema: z.object({ languages: stringOrExpression.optional() }), required: false, displayOptions: {"show":{"operation":["analyzeComment"]}}, defaults: {"operation":"analyzeComment"} }), }); // Return combined config schema return z.object({ parameters: parametersSchema.optional(), }); };