@coorpacademy/progression-engine
Version:
7 lines (5 loc) • 4.41 kB
Flow
// @flow
import {computeInitialStep} from "../compute-next-step";
import type {AvailableContent, Content, Progression, Engine, EngineOptions} from "../types";
import {getConfig} from "../config";
declare export default function(engine: {ref: string, version: string}, content: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, engineOptions: {lives?: number, livesDisabled?: boolean}, availableContent: Array<{ref: string, rules: Array<{conditions: Array<{operator: $Keys<{BETWEEN: <T>(expectedValues: Array<T>, value: T) => boolean, EQUALS: <T>(expectedValues: Array<T>, value: T) => boolean, GT: <T>(expectedValues: Array<T>, value: T) => boolean, GTE: <T>(expectedValues: Array<T>, value: T) => boolean, IN: <T>(expectedValues: Array<T>, value: T) => boolean, LT: <T>(expectedValues: Array<T>, value: T) => boolean, LTE: <T>(expectedValues: Array<T>, value: T) => boolean, NOT_BETWEEN: <T>(expectedValues: Array<T>, value: T) => boolean, NOT_EQUALS: <T>(expectedValues: Array<T>, value: T) => boolean, NOT_IN: <T>(expectedValues: Array<T>, value: T) => boolean}>, target: {field: "lives" | "stars" | string, scope: "variable"} | {field: "isCorrect" | "answer", ref: string, scope: "slide"}, values: Array<number | boolean | string | Array<string>>}>, destination: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, instructions: Array<{field: string, type: "add" | "set", value: number | boolean | string}>, priority: number, ref?: string, source: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}}> | null, slides: Array<{_id: string, chapter_id: string, position?: ?number, question: {content: {answers: Array<Array<string>>}, type: "qcm"} | {content: {answers: Array<Array<string>>}, type: "qcmGraphic"} | {content: {answers: Array<Array<string>>, matchOrder: boolean}, type: "qcmDrag"} | {content: {answers: Array<Array<string>>}, type: "slider"} | {content: {answers: Array<Array<string>>, maxTypos?: ?number}, type: "basic"} | {content: {answers: Array<Array<string>>, choices: Array<{type: "text" | "select"}>, matchOrder: boolean, maxTypos?: ?number}, type: "template"}}>}>): {actions: Array<{type: "init"} | {payload: {instructions: Array<{field: string, type: "add" | "set", value: number | boolean | string}> | null, nextContent: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}}, type: "move"} | {payload: {answer: Array<string>, content: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, godMode: ?boolean, instructions: Array<{field: string, type: "add" | "set", value: number | boolean | string}> | null, isCorrect: ?boolean, nextContent: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}}, type: "answer"} | {payload: {content: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}}, type: "clue"} | {payload: {content: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, instructions: Array<{field: string, type: "add" | "set", value: number | boolean | string}> | null, nextContent: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}}, type: "extraLifeAccepted"} | {payload: {content: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, nextContent: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}}, type: "extraLifeRefused"} | {payload: {content: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, resource: {ref: string, type: "video" | "pdf", version?: string}}, type: "resource"} | {payload: {instructions: Array<{field: string, type: "add" | "set", value: number | boolean | string}> | null, nextContent: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}}, type: "move"}>, content: {ref: string, type: string, version?: string} | {ref: string, type: "video" | "pdf", version?: string}, engine: {ref: string, version: string}, engineOptions: {lives?: number, livesDisabled?: boolean}} | null;