{"version":3,"sources":["../../../packages/core/workflow/persistent-workflow-builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAG1E,aAAK,kBAAkB,GAAG,GAAG,CAAC;AAC9B,aAAK,eAAe,GAAG,GAAG,CAAC;AAC3B,aAAK,qBAAqB,GAAG,yBAAyB,CAAC,eAAe,EAAE,kBAAkB,CAAC,CAAC;AAC5F,aAAK,sBAAsB,GAAG,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;AAExE;;;GAGG;AACH,8BAAsB,yBAAyB;IAa/B,SAAS,CAAC,UAAU,EAAE,MAAM;IAAE,SAAS,CAAC,IAAI,EAAE,MAAM;IAAE,SAAS,CAAC,OAAO,EAAE,MAAM;IAZ3F;;OAEG;IACH,SAAS,CAAC,UAAU,EAAE,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;IAEhD;;;;;;OAMG;gBACmB,UAAU,EAAE,MAAM,EAAY,IAAI,EAAE,MAAM,EAAY,OAAO,EAAE,MAAM;IAG3F;;OAEG;IACH,SAAS,CAAC,IAAI,IAAI,IAAI;IAItB;;OAEG;IACH,SAAS,KAAK,QAAQ,IAAI,kBAAkB,CAO3C;IAED;;;;OAIG;IACH,SAAS,CAAC,WAAW,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,sBAAsB,GAAG,IAAI;IAUhF;;;;OAIG;IACH,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,sBAAsB,GAAG,IAAI;IAIxE;;;;OAIG;IACH,QAAQ,CAAC,KAAK,IAAI,kBAAkB;CACvC","file":"persistent-workflow-builder.d.ts","sourcesContent":["/* eslint-disable unused-imports/no-unused-vars */\r\nimport { PersistentWorkItem } from './persistent-work-item';\r\nimport { PersistentWorkflow } from './persistent-workflow';\r\nimport { PersistentWorkflowContext } from './persistent-workflow-context';\r\nimport { PersistentWorkflowRunner } from './persistent-workflow-runner';\r\n\r\ntype PersistentDataType = any;\r\ntype TransitDataType = any;\r\ntype PersistentContextType = PersistentWorkflowContext<TransitDataType, PersistentDataType>;\r\ntype PersistentWorkItemType = PersistentWorkItem<PersistentContextType>;\r\n\r\n/**\r\n * Abstract class of workflow builder.\r\n * An instance of this class will be used to build workflow.\r\n */\r\nexport abstract class PersistentWorkflowBuilder {\r\n    /**\r\n     * The collection of work items.\r\n     */\r\n    protected collection: PersistentWorkItem<any>[];\r\n\r\n    /**\r\n     * Initializes a new instance of the PersistentWorkflowBuilder abstract class.\r\n     *\r\n     * @param moduleName the module name.\r\n     * @param name the name within the namespace.\r\n     * @param version the version number.\r\n     */\r\n    constructor(protected moduleName: string, protected name: string, protected version: number) {\r\n    }\r\n\r\n    /**\r\n     * Initializes the collection to before adding any work items.\r\n     */\r\n    protected init(): void {\r\n        this.collection = [];\r\n    }\r\n\r\n    /**\r\n     * Gets the workflow.\r\n     */\r\n    protected get workflow(): PersistentWorkflow {\r\n        return {\r\n            moduleName: this.moduleName,\r\n            name: this.name,\r\n            version: this.version,\r\n            collection: this.collection\r\n        };\r\n    }\r\n\r\n    /**\r\n     * Add the work item single sequence pattern.\r\n     *\r\n     * @param workItem the work item.\r\n     */\r\n    protected addSequence<TRequest, TResult>(workItem: PersistentWorkItemType): void {\r\n        workItem.id = this.collection.length + PersistentWorkflowRunner.startingId;\r\n        workItem.nextId = -1;\r\n        if (this.collection.length > 0) {\r\n            this.collection[this.collection.length - 1].nextId = workItem.id;\r\n        }\r\n\r\n        this.add(workItem);\r\n    }\r\n\r\n    /**\r\n     * Add the work item with custom sequence.\r\n     *\r\n     * @param workItem the work item.\r\n     */\r\n    protected add<TRequest, TResult>(workItem: PersistentWorkItemType): void {\r\n        this.collection.push(workItem);\r\n    }\r\n\r\n    /**\r\n     * Build the collection of work item for workflow.\r\n     *\r\n     * @returns the collection of work items.\r\n     */\r\n    abstract build(): PersistentWorkflow;\r\n}\r\n"]}