@pond-ts/process API Reference
    Preparing search index...

    Function defineNode

    • Declares a reusable node type and returns a factory for it.

      const Stats = defineNode({
      kind: 'stats',
      inputs: { series: port<TimeSeries<Schema>>() },
      outputs: { mean: port<number>(), max: port<number>() },
      compute: ({ series }) => ({
      mean: series.column('cpu').mean(),
      max: series.column('cpu').max(),
      }),
      });

      const stats = Stats();
      raw.out.value.connect(stats.in.series);
      stats.out.mean.get();

      For a node type that needs per-instance configuration, close over it: const smoother = (span: number) => defineNode({ ... })();

      Type Parameters

      • In extends Readonly<Record<string, PortSpec<any>>>
      • Out extends Readonly<Record<string, PortSpec<any>>>

      Parameters

      Returns NodeFactory<In, Out>