Official Plugins (Kuzzle v2.x)
Workflows v0.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 './Action';
import { LifecycleHook } from './LifecycleHook';
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;
  }
  /**
    * Actions to execute when the workflow is triggered
    */
  actions: Action[];
  /**
    * Lifecycle hooks
    */
  lifecycle: {
    /**
      * Hook triggered each time the workflow is loaded.
      *
      * E.g. at startup, when the document is updated
      */
    load?: LifecycleHook;
  };
  /**
    * Kuzzle metadata
    * @todo use DocumentMetadata when it's not an interface anymore
    */
  _kuzzle_info?: {
    author?: string,
    createdAt?: number,
    updater?: string | null,
    updatedAt?: number | null
  };
};