Selva Compute API Reference - v1.1.2
    Preparing search index...

    Function processInputs

    • Internal

      Processes raw Grasshopper input schemas into strongly-typed TypeScript interfaces.

      This is an internal batch processor. Use fetchParsedDefinitionIO() to get processed inputs instead.

      Transforms each raw input parameter by:

      • Normalizing default values (flattening data trees, parsing primitives)
      • Applying type-specific parsing (Number, Text, Boolean, Geometry, etc.)
      • Validating constraints (min/max, required fields)
      • Converting to discriminated union types for type safety

      Parameters

      Returns InputParam[]

      Array of processed, strongly-typed input parameters

      • Empty data trees are converted to undefined
      • Single values are extracted from arrays when appropriate
      • Tree structures are preserved for list/tree access parameters
      • Invalid inputs fall back to safe defaults with console warnings
      const rawInputs = [
      { paramType: 'Number', name: 'radius', minimum: 0, default: 10 },
      { paramType: 'Text', name: 'label', default: 'Hello' }
      ];

      const processed = processInputs(rawInputs);
      // Result: [
      // { paramType: 'Number', name: 'radius', minimum: 0, default: 10, ... },
      // { paramType: 'Text', name: 'label', default: 'Hello', ... }
      // ]

      // Now type-safe:
      if (processed[0].paramType === 'Number') {
      console.log(processed[0].minimum); // TypeScript knows this exists
      }

      processInput for individual input processing logic