Official Plugins (Kuzzle v2.x)
Workflows v1.x
2

This plugin is part of the Kuzzle Enterprise Plan. If you are interested, please contact us.

WorkflowContent #

Copied to clipboard!
import { JSONObject } from 'kuzzle';
import { Action } from './index';
export type WorkflowContent = {
  /**
    *  Workflow name
    */
  name: string;
  /**
    *  Workflow description
    */
  description: string;
  /**
    * Enable or disable a workflow
    */
  disabled?: boolean;
  /**
    * Path to extract the payload (lodash style)
    */
  payloadPath: string;
  /**
    *  Workflow trigger
    */
  trigger: {
    /**
      * Trigger type
      */
    type: 'notification' | 'event';
    /**
      * Collection to filter
      */
    collection?: string;
    /**
      * Depends on the "type":
      *  - `type=event`: filters to match with the extracted payload
      *  - `type=notification`: filters for the Realtime Engine
      *
      * Filters tested against the extracted payload
      * (`type=pipe`)
      *
      * @see https://docs.kuzzle.io/core/2/api/koncorde-filters-syntax
      */
    filters?: JSONObject;
    /**
      * Specify whether you want to receive trigger the workflow on documents
      * entering or leaving the scope only.
      * (`type=notification`)
      *
      * Default: `in`
      */
    scope?: 'all' | 'in' | 'out';
    /**
      * Trigger this workflow when the specified event is triggered.
      * (`type=event`)
      */
    event?: string;
  }
  /**
    * Array of predicates to verify
    */
  predicates?: Array<{
    /**
      * Predicate name
      */
    name: string;
    /**
      * Predicate custom arguments
      */
    args?: JSONObject;
  }>;
  /**
    * Actions to execute when the workflow is triggered
    */
  actions: Action[];
  /**
    * Kuzzle metadata
    * @todo use DocumentMetadata when it's not an interface anymore
    */
  _kuzzle_info?: {
    author?: string,
    createdAt?: number,
    updater?: string | null,
    updatedAt?: number | null
  };
};