@acorex/platform 21.0.0-next.37 → 21.0.0-next.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/fesm2022/acorex-platform-common.mjs +19 -1
  2. package/fesm2022/acorex-platform-common.mjs.map +1 -1
  3. package/fesm2022/acorex-platform-core.mjs +11 -172
  4. package/fesm2022/acorex-platform-core.mjs.map +1 -1
  5. package/fesm2022/acorex-platform-layout-builder.mjs +7 -8
  6. package/fesm2022/acorex-platform-layout-builder.mjs.map +1 -1
  7. package/fesm2022/acorex-platform-layout-components.mjs +39 -29
  8. package/fesm2022/acorex-platform-layout-components.mjs.map +1 -1
  9. package/fesm2022/acorex-platform-layout-designer.mjs +8 -9
  10. package/fesm2022/acorex-platform-layout-designer.mjs.map +1 -1
  11. package/fesm2022/acorex-platform-layout-entity.mjs +468 -255
  12. package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
  13. package/fesm2022/acorex-platform-layout-views.mjs +171 -86
  14. package/fesm2022/acorex-platform-layout-views.mjs.map +1 -1
  15. package/fesm2022/acorex-platform-layout-widget-core.mjs +36 -13
  16. package/fesm2022/acorex-platform-layout-widget-core.mjs.map +1 -1
  17. package/fesm2022/{acorex-platform-layout-widgets-file-list-popup.component-9uCkMxcc.mjs → acorex-platform-layout-widgets-file-list-popup.component-CDYAGBku.mjs} +5 -60
  18. package/fesm2022/acorex-platform-layout-widgets-file-list-popup.component-CDYAGBku.mjs.map +1 -0
  19. package/fesm2022/acorex-platform-layout-widgets.mjs +101 -128
  20. package/fesm2022/acorex-platform-layout-widgets.mjs.map +1 -1
  21. package/fesm2022/acorex-platform-themes-default.mjs +16 -4
  22. package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
  23. package/fesm2022/acorex-platform-workflow.mjs +25 -5
  24. package/fesm2022/acorex-platform-workflow.mjs.map +1 -1
  25. package/package.json +1 -1
  26. package/types/acorex-platform-common.d.ts +11 -6
  27. package/types/acorex-platform-core.d.ts +56 -101
  28. package/types/acorex-platform-layout-builder.d.ts +0 -1
  29. package/types/acorex-platform-layout-components.d.ts +4 -3
  30. package/types/acorex-platform-layout-designer.d.ts +1 -1
  31. package/types/acorex-platform-layout-entity.d.ts +36 -30
  32. package/types/acorex-platform-layout-views.d.ts +31 -29
  33. package/types/acorex-platform-layout-widget-core.d.ts +30 -14
  34. package/types/acorex-platform-layout-widgets.d.ts +17 -11
  35. package/types/acorex-platform-themes-default.d.ts +1 -0
  36. package/types/acorex-platform-workflow.d.ts +28 -51
  37. package/fesm2022/acorex-platform-layout-widgets-file-list-popup.component-9uCkMxcc.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-platform-workflow.mjs","sources":["../../../../libs/platform/workflow/src/lib/errors.types.ts","../../../../libs/platform/workflow/src/lib/workflow-event-dispatcher.service.ts","../../../../libs/platform/workflow/src/lib/workflow-registery.service.ts","../../../../libs/platform/workflow/src/lib/workflow.types.ts","../../../../libs/platform/workflow/src/lib/actions/decide.action.ts","../../../../libs/platform/workflow/src/lib/workflow.service.ts","../../../../libs/platform/workflow/src/lib/actions/start-workflow.action.ts","../../../../libs/platform/workflow/src/lib/engine/workflow-instance.types.ts","../../../../libs/platform/workflow/src/lib/engine/activity/activity.types.ts","../../../../libs/platform/workflow/src/lib/engine/activity/activity-definition.provider.ts","../../../../libs/platform/workflow/src/lib/engine/activity/activity-definition.service.ts","../../../../libs/platform/workflow/src/lib/engine/runtime/workflow-engine.ts","../../../../libs/platform/workflow/src/lib/engine/runtime/workflow-expression-scope.service.ts","../../../../libs/platform/workflow/src/lib/engine/runtime/activity-executor.service.ts","../../../../libs/platform/workflow/src/lib/engine/runtime/workflow-manager.service.ts","../../../../libs/platform/workflow/src/lib/engine/workflow/workflow-definition.provider.ts","../../../../libs/platform/workflow/src/lib/engine/runtime/workflow-local-engine.ts","../../../../libs/platform/workflow/src/lib/engine/runtime/index.ts","../../../../libs/platform/workflow/src/lib/engine/workflow/workflow-definition.service.ts","../../../../libs/platform/workflow/src/lib/engine/index.ts","../../../../libs/platform/workflow/src/lib/workflow.module.ts","../../../../libs/platform/workflow/src/acorex-platform-workflow.ts"],"sourcesContent":["export class AXPWorkflowError extends Error {\n constructor(message: string, public inner: Error | null = null) {\n super(message);\n this.name = 'AXPWorkflowError';\n }\n}","import { Injectable } from '@angular/core';\nimport { Observable, Subject } from 'rxjs';\nimport { AXPWorkflowEvent } from './workflow.types';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPWorkflowEventService {\n private eventSubject = new Subject<AXPWorkflowEvent>();\n\n dispatch(event: AXPWorkflowEvent): void {\n this.eventSubject.next(event);\n }\n\n get events$(): Observable<AXPWorkflowEvent> {\n return this.eventSubject.asObservable();\n }\n}\n","import { Injectable, Type } from '@angular/core';\nimport { AXPWorkflow, AXPWorkflowAction, AXPWorkflowFunction, AXPWorkflowStep } from './workflow.types';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPWorkflowRegistryService {\n private functionsMap = new Map<string, Type<AXPWorkflowFunction>>();\n private actionsMap = new Map<string, Type<AXPWorkflowAction>>();\n private workflowsMap = new Map<string, AXPWorkflow>();\n\n registerWorkflow(name: string, workflow: AXPWorkflow): void {\n this.workflowsMap.set(name, workflow);\n }\n\n getWorkflow(name: string): AXPWorkflow | undefined {\n return this.workflowsMap.get(name);\n }\n\n registerAction(name: string, action: Type<AXPWorkflowAction>): void {\n this.actionsMap.set(name, action);\n }\n\n getAction(name: string): Type<AXPWorkflowAction> | undefined {\n return this.actionsMap.get(name);\n }\n\n registerFunction(name: string, func: Type<AXPWorkflowFunction>): void {\n this.functionsMap.set(name, func);\n }\n\n getFunction(name: string): Type<AXPWorkflowFunction> | undefined {\n return this.functionsMap.get(name);\n }\n\n getFunctionNames(): string[] {\n return Array.from(this.functionsMap.keys());\n }\n\n getStep(workflowName: string, stepName: string): AXPWorkflowStep | undefined {\n const workflow = this.workflowsMap.get(workflowName);\n if (workflow) {\n const steps = workflow.steps as { [key: string]: AXPWorkflowStep };\n return steps[stepName];\n }\n return undefined;\n }\n\n updateStepInWorkflow(workflowName: string, stepName: string, step: AXPWorkflowStep): void {\n const workflow = this.workflowsMap.get(workflowName);\n if (workflow) {\n const steps = workflow.steps as { [key: string]: AXPWorkflowStep };\n if (steps[stepName]) {\n steps[stepName] = step;\n } else {\n throw new Error(`Step with name ${stepName} does not exist in workflow ${workflowName}.`);\n }\n } else {\n throw new Error(`Workflow with name ${workflowName} does not exist.`);\n }\n }\n\n addStepToWorkflow(workflowName: string, stepName: string, step: AXPWorkflowStep): void {\n const workflow = this.workflowsMap.get(workflowName);\n if (workflow) {\n const steps = workflow.steps as { [key: string]: AXPWorkflowStep };\n if (!steps[stepName]) {\n steps[stepName] = step;\n } else {\n throw new Error(`Step with name ${stepName} already exists in workflow ${workflowName}.`);\n }\n } else {\n throw new Error(`Workflow with name ${workflowName} does not exist.`);\n }\n }\n\n addAfterStep(\n workflowId: string,\n stepId: string,\n newStepId: string,\n newStepAction: string,\n conditionExpression: string\n ): void {\n const step = this.getStep(workflowId, stepId);\n if (step != undefined) {\n this.addStepToWorkflow(workflowId, newStepId, {\n action: newStepAction,\n nextSteps: step.nextSteps,\n });\n\n this.updateStepInWorkflow(workflowId, stepId, {\n ...step,\n nextSteps: [\n {\n conditions: [{ type: 'SINGLE', expression: conditionExpression }],\n nextStepId: newStepId,\n },\n ],\n });\n }\n }\n}\n","import { Injectable, inject } from '@angular/core';\nimport { filter } from 'rxjs';\nimport { AXPWorkflowEventService } from './workflow-event-dispatcher.service';\nimport { cloneDeep, get } from 'lodash-es';\nimport { setSmart } from '@acorex/platform/core';\n\nexport interface AXPWorkflow {\n steps: { [stepName: string]: AXPWorkflowStep };\n startStepId: string;\n}\n\n\nexport class AXPWorkflowContext {\n\n constructor(initialData: any = {}) {\n this.variables = cloneDeep(initialData);\n }\n\n private variables: any = {};\n private stepOutputs: Map<string, any> = new Map();\n\n setVariable(key: string, value: any): void {\n setSmart(this.variables, key, value);\n }\n\n\n setVariables(context: any = {}) {\n this.variables = { ...this.variables, ...context };\n }\n\n getVariable<T = any>(key?: string | null): T {\n return !key ? this.variables : get(this.variables, key);\n }\n\n setOutput(key: string, output: any): void {\n this.stepOutputs.set(key, output);\n }\n\n setOutputs(values: Map<string, any>): void {\n this.stepOutputs = new Map([...this.stepOutputs, ...values])\n }\n\n getOutput<T = any>(key: string): T {\n return this.stepOutputs.get(key);\n }\n}\n\nexport type AXPWorkflowActionInput = any;\n\nexport type AXPWorkflowConditionType = 'AND' | 'OR' | 'SINGLE';\n\nexport interface AXPWorkflowCondition {\n type: AXPWorkflowConditionType;\n conditions?: AXPWorkflowCondition[]; // Nested conditions\n expression?: string; // Used if type is 'SINGLE'\n}\n\nexport interface AXPWorkflowNextStep {\n conditions: AXPWorkflowCondition[];\n nextStepId: string;\n}\n\nexport interface AXPWorkflowStep {\n id?: string;\n action: AXPWorkflowAction | string;\n input?: AXPWorkflowActionInput;\n nextSteps?: AXPWorkflowNextStep[];\n conditions?: AXPWorkflowCondition[];\n}\n@Injectable()\nexport abstract class AXPWorkflowAction {\n private eventService = inject(AXPWorkflowEventService);\n\n protected dispatch(event: AXPWorkflowEvent): void {\n this.eventService.dispatch(event);\n }\n\n abstract execute(context: AXPWorkflowContext): Promise<void>;\n}\n\n@Injectable()\nexport abstract class AXPWorkflowFunction {\n abstract execute(...args: any[]): Promise<any> | any;\n}\n\nexport interface AXPWorkflowEvent<T = any> {\n type: string;\n payload?: T;\n}\n\n\n\nexport function createWorkFlowEvent<T>(type: string) {\n const eventCreator = (payload: T) => ({ type, payload });\n eventCreator.type = type;\n return eventCreator;\n}\n\nexport function ofType<T extends { type: string }>(...allowedTypes: Array<{ type: string }>) {\n return filter((event: T) => allowedTypes.some((type) => event.type === type.type));\n}\n","import { Injectable } from \"@angular/core\";\nimport { AXPWorkflowAction, AXPWorkflowContext } from \"../workflow.types\";\n\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPWorkflowDecideAction extends AXPWorkflowAction {\n async execute(context: AXPWorkflowContext): Promise<void> {\n // its a fake action\n }\n}","import { Injectable, Injector, inject } from '@angular/core';\nimport { cloneDeep, set } from 'lodash-es';\nimport { Observable } from 'rxjs';\nimport { AXPWorkflowError } from './errors.types';\nimport { AXPWorkflowEventService } from './workflow-event-dispatcher.service';\nimport { AXPWorkflowRegistryService } from './workflow-registery.service';\nimport {\n AXPWorkflow,\n AXPWorkflowAction,\n AXPWorkflowCondition,\n AXPWorkflowContext,\n AXPWorkflowEvent,\n AXPWorkflowFunction,\n AXPWorkflowNextStep,\n AXPWorkflowStep,\n} from './workflow.types';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPWorkflowService {\n private eventService = inject(AXPWorkflowEventService);\n\n get events$(): Observable<AXPWorkflowEvent> {\n return this.eventService.events$;\n }\n\n constructor(private registryService: AXPWorkflowRegistryService, private injector: Injector) { }\n\n exists(name: string): boolean {\n return !!this.registryService.getWorkflow(name);\n }\n\n\n async execute(\n workflow: AXPWorkflow | string,\n initialContext: AXPWorkflowContext | any | null = null\n ): Promise<AXPWorkflowContext> {\n // Instantiate or retrieve the workflow\n const wk = typeof workflow === 'string' ? this.getWorkflowInstance(workflow) : workflow;\n\n let currentStepId = wk.startStepId;\n const context =\n initialContext instanceof AXPWorkflowContext\n ? initialContext\n : new AXPWorkflowContext(this.processData(initialContext) ?? {});\n // Initialize context with initial variables\n\n while (currentStepId) {\n const currentStep = wk.steps[currentStepId];\n if (!currentStep) {\n throw new AXPWorkflowError(`Step '${currentStepId}' not found in the workflow steps.`);\n }\n\n // Instantiate or retrieve the action\n const action =\n typeof currentStep.action === 'string' ? this.getActionInstance(currentStep.action) : currentStep.action;\n //\n if (currentStep.input) {\n let inputs: any = {};\n await this.processInputs(cloneDeep(currentStep.input), inputs, '', context);\n await new Promise((resolve) =>\n setTimeout(async () => {\n Object.assign(action, inputs);\n resolve(0);\n })\n );\n }\n try {\n await new Promise((resolve) =>\n setTimeout(async () => {\n await action.execute(context);\n resolve(0);\n }, 0)\n );\n } catch (error) {\n console.error(error);\n throw new AXPWorkflowError('Workflow Error', error as Error);\n }\n // Determine the next step based on the conditions\n const nextStepInfo = await this.determineNextStep(currentStep, context);\n if (nextStepInfo) {\n currentStepId = nextStepInfo.nextStepId;\n } else {\n break; // Exit the loop if no next step is determined\n }\n }\n return context;\n }\n\n private processData(initialContext: any): any {\n //TODO: update values with expressions and return new object\n return initialContext;\n }\n\n\n\n private getActionInstance(actionName: string): AXPWorkflowAction {\n const actionType = this.registryService.getAction(actionName);\n if (!actionType) {\n throw new AXPWorkflowError(`Action type '${actionName}' not found in the registry.`);\n }\n return this.injector.get(actionType);\n }\n\n private getWorkflowInstance(workflowName: string): AXPWorkflow {\n const workflowType = this.registryService.getWorkflow(workflowName);\n if (!workflowType) {\n throw new AXPWorkflowError(`Workflow type '${workflowName}' not found in the registry.`);\n }\n return workflowType;\n }\n\n private async determineNextStep(\n currentStep: AXPWorkflowStep,\n context: AXPWorkflowContext\n ): Promise<AXPWorkflowNextStep | null> {\n if (!currentStep.nextSteps) {\n return null;\n }\n for (const nextStep of currentStep.nextSteps) {\n if (await this.evaluateCondition(nextStep.conditions, context)) {\n return nextStep;\n }\n }\n return null;\n }\n\n private async evaluateCondition(conditions: AXPWorkflowCondition[], context: AXPWorkflowContext): Promise<boolean> {\n if (!conditions || conditions.length === 0) {\n return true; // If no conditions, the step proceeds\n }\n\n // Map each condition to a promise using evaluateSingleCondition\n const conditionPromises = conditions.map((condition) => this.evaluateSingleCondition(condition, context));\n\n // Wait for all promises to resolve\n const results = await Promise.all(conditionPromises);\n\n // Check if every condition is true\n return results.every((result) => result);\n }\n\n private async evaluateSingleCondition(\n condition: AXPWorkflowCondition,\n context: AXPWorkflowContext\n ): Promise<boolean> {\n switch (condition.type) {\n case 'SINGLE':\n return (!condition.expression ? true : await this.evaluateExpression(condition.expression, context)) as boolean;\n case 'AND':\n // Evaluate all conditions with 'AND' logic\n const andConditions = condition.conditions ?? [];\n const andResults = await Promise.all(andConditions.map((cond) => this.evaluateSingleCondition(cond, context)));\n return andResults.every((result) => result);\n\n case 'OR':\n // Evaluate all conditions with 'OR' logic\n const orConditions = condition.conditions ?? [];\n const orResults = await Promise.all(orConditions.map((cond) => this.evaluateSingleCondition(cond, context)));\n return orResults.some((result) => result);\n\n default:\n throw new AXPWorkflowError(`Unsupported condition type: ${condition.type}`);\n }\n }\n\n //TODO: return any and recursively update object, update scopes\n private async evaluateExpression(templateExpression: string, context: AXPWorkflowContext): Promise<Boolean> {\n try {\n let expression = '';\n if (typeof templateExpression === 'string' && templateExpression.trim().includes('{{')) {\n const expressionMatch = templateExpression.match(/\\{\\{\\s*(.*?)\\s*\\}\\}/);\n if (!expressionMatch) {\n throw Error(`No valid expression found in \"${templateExpression}\"`);\n }\n expression = expressionMatch[1];\n } else {\n expression = templateExpression;\n }\n // Create a scope that includes context and registered functions\n const scope = { context, ...this.createFunctionScope() };\n // Evaluating the expression within the created scope\n const sandbox = new Function('scope', `return (async function() { with (scope) { return ${expression}; } })();`);\n const result = await sandbox(scope);\n return result;\n } catch (error) {\n console.error('Error evaluating expression:', error);\n return false;\n }\n }\n\n private async processInputs(obj: any, inputs: any, pathPrefix: string = '', context: any = {}): Promise<void> {\n if (!obj) {\n return;\n }\n\n for await (const i of Object.entries(obj)) {\n const key = i[0];\n const value = i[1];\n const currentPath = pathPrefix ? `${pathPrefix}.${key}` : key;\n if (typeof value === 'string' && value.trim().includes('{{')) {\n const expValue = await this.evaluateExpression(value, context);\n set(inputs, currentPath, expValue);\n } else if (\n typeof value === 'object' &&\n value !== null &&\n (value.constructor === Object || Array.isArray(value))\n ) {\n // Recursively handle nested objects\n this.processInputs(value, inputs, currentPath, context);\n } else {\n // Apply static values directly\n set(inputs, currentPath, value);\n }\n }\n }\n\n private createFunctionScope(): any {\n const scope: any = {};\n this.registryService.getFunctionNames().forEach((name) => {\n scope[name] = this.getFunctionInstance(name).execute;\n });\n return { methods: { scope } };\n }\n\n private getFunctionInstance(functionName: string): AXPWorkflowFunction {\n const functionType = this.registryService.getFunction(functionName);\n if (!functionType) {\n throw new AXPWorkflowError(`Function type '${functionName}' not found in the registry.`);\n }\n return this.injector.get(functionType);\n }\n}\n","import { inject, Injectable } from \"@angular/core\";\nimport { AXPWorkflowAction, AXPWorkflowContext } from \"../workflow.types\";\nimport { AXPWorkflowService } from \"../workflow.service\";\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPStartWorkflowAction extends AXPWorkflowAction {\n\n private workflowService = inject(AXPWorkflowService)\n private workflow: string;\n private context: any;\n\n async execute(context: AXPWorkflowContext): Promise<void> {\n //console.log(\"start WK current context\", context);\n //console.log(\"start WK input context\", this.context);\n if (this.context)\n context.setVariables(this.context)\n //console.log(\"start WK merged context\", context);\n try {\n await this.workflowService.execute(this.workflow, context);\n }\n catch (e: unknown) {\n throw e;\n }\n\n }\n}\n\n","// ============================================\n// WORKFLOW INSTANCE v3.0.0 TYPES\n// Based on Elsa Workflow Instance schema: https://elsaworkflows.io/schemas/workflow-instance/v3.0.0/schema.json\n// Compatible with Elsa backend while using ACoreX naming conventions\n// ============================================\n\n/**\n * Workflow status.\n */\nexport type AXPWorkflowStatus = 'Running' | 'Finished';\n\n/**\n * Workflow sub-status.\n */\nexport type AXPWorkflowSubStatus = 'Pending' | 'Executing' | 'Suspended' | 'Finished' | 'Cancelled' | 'Faulted';\n\n/**\n * Activity status.\n */\nexport type AXPActivityStatus = 'Running' | 'Completed' | 'Canceled' | 'Faulted';\n\n/**\n * Exception state.\n */\nexport interface AXPExceptionState {\n /**\n * Exception type name.\n */\n type: string;\n\n /**\n * Exception message.\n */\n message: string;\n\n /**\n * Stack trace (nullable).\n */\n stackTrace?: string | null;\n\n /**\n * Inner exception (nullable).\n */\n innerException?: AXPExceptionState | null;\n}\n\n/**\n * Activity incident.\n */\nexport interface AXPActivityIncident {\n /**\n * Activity ID that caused the incident.\n */\n activityId: string;\n\n /**\n * Activity node ID.\n */\n activityNodeId: string;\n\n /**\n * Activity type.\n */\n activityType: string;\n\n /**\n * Incident message.\n */\n message: string;\n\n /**\n * Exception (nullable).\n */\n exception?: AXPExceptionState | null;\n\n /**\n * Timestamp (ISO date-time).\n */\n timestamp: string;\n}\n\n/**\n * Workflow fault state.\n */\nexport interface AXPWorkflowFaultState {\n /**\n * Exception (nullable).\n */\n exception?: AXPExceptionState | null;\n\n /**\n * Fault message.\n */\n message: string;\n\n /**\n * Faulted activity ID (nullable).\n */\n faultedActivityId?: string | null;\n}\n\n/**\n * Bookmark.\n */\nexport interface AXPBookmark {\n /**\n * Bookmark ID.\n */\n id: string;\n\n /**\n * Bookmark name.\n */\n name: string;\n\n /**\n * Bookmark hash.\n */\n hash: string;\n\n /**\n * Bookmark payload (nullable).\n */\n payload?: any | null;\n\n /**\n * Activity node ID.\n */\n activityNodeId: string;\n\n /**\n * Activity instance ID.\n */\n activityInstanceId: string;\n\n /**\n * Auto burn flag.\n */\n autoBurn?: boolean;\n\n /**\n * Callback method name (nullable).\n */\n callbackMethodName?: string | null;\n\n /**\n * Metadata (nullable).\n */\n metadata?: Record<string, string> | null;\n}\n\n/**\n * Completion callback state.\n */\nexport interface AXPCompletionCallbackState {\n /**\n * Owner activity instance ID.\n */\n ownerInstanceId: string;\n\n /**\n * Child activity node ID.\n */\n childNodeId: string;\n\n /**\n * Method name (nullable).\n */\n methodName?: string | null;\n}\n\n/**\n * Variable (for activity context).\n */\nexport interface AXPActivityVariable {\n /**\n * Variable ID.\n */\n id: string;\n\n /**\n * Variable name.\n */\n name: string;\n\n /**\n * Type name.\n */\n typeName: string;\n\n /**\n * Is array flag.\n */\n isArray?: boolean;\n\n /**\n * Variable value (nullable).\n */\n value?: any | null;\n\n /**\n * Storage driver type name (nullable).\n */\n storageDriverTypeName?: string | null;\n}\n\n/**\n * Activity execution context state.\n */\nexport interface AXPActivityExecutionContextState {\n /**\n * Context ID (activity instance ID).\n */\n id: string;\n\n /**\n * Parent context ID (nullable).\n */\n parentContextId?: string | null;\n\n /**\n * Scheduled activity node ID.\n */\n scheduledActivityNodeId: string;\n\n /**\n * Owner activity node ID (nullable).\n */\n ownerActivityNodeId?: string | null;\n\n /**\n * Properties bag.\n */\n properties: Record<string, any>;\n\n /**\n * Activity state (evaluated properties) (nullable).\n */\n activityState?: Record<string, any> | null;\n\n /**\n * Dynamic variables.\n */\n dynamicVariables: AXPActivityVariable[];\n\n /**\n * Activity status.\n */\n status: AXPActivityStatus;\n\n /**\n * Is executing flag.\n */\n isExecuting: boolean;\n\n /**\n * Fault count.\n */\n faultCount: number;\n\n /**\n * Started at timestamp (ISO date-time).\n */\n startedAt: string;\n\n /**\n * Completed at timestamp (ISO date-time, nullable).\n */\n completedAt?: string | null;\n\n /**\n * Tag (nullable).\n */\n tag?: any | null;\n}\n\n/**\n * Workflow state (internal execution state).\n */\nexport interface AXPWorkflowState {\n /**\n * State ID.\n */\n id: string;\n\n /**\n * Workflow definition ID.\n */\n definitionId: string;\n\n /**\n * Workflow definition version.\n */\n definitionVersion: number;\n\n /**\n * Correlation ID (nullable).\n */\n correlationId?: string | null;\n\n /**\n * Workflow status.\n */\n status: AXPWorkflowStatus;\n\n /**\n * Workflow sub-status.\n */\n subStatus: AXPWorkflowSubStatus;\n\n /**\n * Bookmarks.\n */\n bookmarks: AXPBookmark[];\n\n /**\n * Incidents.\n */\n incidents: AXPActivityIncident[];\n\n /**\n * Fault (nullable).\n */\n fault?: AXPWorkflowFaultState | null;\n\n /**\n * Completion callbacks.\n */\n completionCallbacks: AXPCompletionCallbackState[];\n\n /**\n * Activity execution contexts.\n */\n activityExecutionContexts: AXPActivityExecutionContextState[];\n\n /**\n * Input data.\n */\n input: Record<string, any>;\n\n /**\n * Output data.\n */\n output: Record<string, any>;\n\n /**\n * Properties bag.\n */\n properties: Record<string, any>;\n\n /**\n * Created at timestamp (ISO date-time).\n */\n createdAt: string;\n\n /**\n * Updated at timestamp (ISO date-time).\n */\n updatedAt: string;\n\n /**\n * Finished at timestamp (ISO date-time, nullable).\n */\n finishedAt?: string | null;\n\n /**\n * Total number of activities/steps in the workflow (for progress display).\n */\n totalSteps?: number;\n}\n\n/**\n * Workflow instance (stored in database).\n * This matches the Elsa Workflow Instance schema for backend compatibility.\n */\nexport interface AXPWorkflowInstance {\n /**\n * Schema reference.\n */\n $schema?: string;\n\n /**\n * Unique instance ID.\n */\n id: string;\n\n /**\n * Workflow definition ID.\n */\n definitionId: string;\n\n /**\n * Workflow definition version ID.\n */\n definitionVersionId: string;\n\n /**\n * Workflow definition version number.\n */\n version: number;\n\n /**\n * Parent workflow instance ID (nullable, for child workflows).\n */\n parentWorkflowInstanceId?: string | null;\n\n /**\n * Workflow state (internal execution state).\n */\n workflowState: AXPWorkflowState;\n\n /**\n * Workflow status.\n */\n status: AXPWorkflowStatus;\n\n /**\n * Workflow sub-status.\n */\n subStatus: AXPWorkflowSubStatus;\n\n /**\n * Correlation ID (nullable).\n */\n correlationId?: string | null;\n\n /**\n * Instance name (nullable).\n */\n name?: string | null;\n\n /**\n * Incident count.\n */\n incidentCount: number;\n\n /**\n * Created at timestamp (ISO date-time).\n */\n createdAt: string;\n\n /**\n * Updated at timestamp (ISO date-time).\n */\n updatedAt: string;\n\n /**\n * Finished at timestamp (ISO date-time, nullable).\n */\n finishedAt?: string | null;\n\n /**\n * Entity reference ID (for linking workflow instances to business entities).\n */\n entityRefId?: string | null;\n\n /**\n * Entity reference type (e.g., 'HumanCapitalManagement.LeaveRequest').\n */\n entityRefType?: string | null;\n}\n\n","import { AXPCategoryEntity } from \"@acorex/platform/core\";\nimport { AXPWidgetTypesMap } from \"@acorex/platform/layout/widget-core\";\nimport { AXPWorkflowInputDescriptor, AXPWorkflowOutputDescriptor } from \"../workflow-definition.types\";\n\n// ============================================\n// SIMPLIFIED ACTIVITY SYSTEM\n// ============================================\n\n/**\n * Type of task for inbox handling.\n * - 'human-task': Requires inbox - needs human interaction\n * - 'ui-activity': UI-only activity (no inbox) - immediate execution\n * - 'system-activity': System/backend activity (no inbox) - automated execution\n */\nexport type AXPTaskType = 'human-task' | 'ui-activity' | 'system-activity';\n\n/**\n * Activity Category - Extends AXPCategoryEntity for consistency and performance\n * \n * Inherited properties from AXPCategoryEntity:\n * - id: string - Unique identifier\n * - title: string - Display name\n * - description?: string - Category description\n * - parentId?: string - Parent category ID\n * - childrenCount: number - Direct child categories count (enables lazy loading)\n * - itemsCount?: number - Direct activities count\n * - totalChildrenCount?: number - Total nested categories (optional, for analytics)\n * - totalItemsCount?: number - Total activities in tree (optional, for analytics)\n */\nexport interface AXPActivityCategory extends AXPCategoryEntity {\n // No additional properties needed - all inherited from AXPCategoryEntity\n // Use: childrenCount instead of hasChild\n // Use: itemsCount instead of hasActivity\n}\n\n/**\n * Activity Definition - Metadata for UI and tooling.\n * Contains all metadata needed for displaying activities in toolbox and designer.\n * The `name` property is used as the command key for execution.\n */\nexport interface AXPActivityDefinition {\n /**\n * Activity name - used as command key for execution.\n * This is the unique identifier for the activity.\n */\n name: string;\n \n /**\n * Activity type (e.g., \"workflow-activity:check-permission\").\n */\n type: string;\n \n /**\n * Display name for UI.\n */\n title?: string;\n \n /**\n * Description of what the activity does.\n */\n description?: string;\n \n /**\n * Category for grouping in toolbox.\n */\n category?: string;\n \n /**\n * Icon name or class.\n */\n icon?: string;\n \n /**\n * Where this activity should be executed.\n * - 'frontend': Execute in browser (UI activities, console, events)\n * - 'backend': Execute in backend (business logic, API calls)\n * - 'both': Execute in both frontend and backend (hybrid activities)\n * \n * Default: 'frontend'\n */\n executionMode?: 'frontend' | 'backend' | 'both';\n \n /**\n * Type of task for inbox handling.\n * - 'human-task': Requires inbox - needs human interaction\n * - 'ui-activity': UI-only activity (no inbox) - immediate execution\n * - 'system-activity': System/backend activity (no inbox) - automated execution\n * \n * Default: 'ui-activity' (for backward compatibility)\n */\n taskType?: AXPTaskType;\n \n /**\n * Input descriptors.\n */\n inputs?: AXPWorkflowInputDescriptor[];\n \n /**\n * Output descriptors.\n */\n outputs?: AXPWorkflowOutputDescriptor[];\n \n /**\n * Static outcomes (exit points).\n * Example: ['Done', 'Success', 'Failed']\n */\n outcomes?: string[];\n\n /**\n * Whether this activity is browsable in the toolbox.\n * Default: true\n */\n isBrowsable?: boolean;\n \n /**\n * Whether this activity is a container (can have children).\n * Default: false\n */\n isContainer?: boolean;\n}\n\n// Note:\n// Previous versions defined dedicated activity result/command types here\n// (AXPActivityResult / AXPActivity) that wrapped output and outcome.\n// Activities are now modeled directly as AXPCommand with outcome stored in\n// AXPExecuteCommandResult.metadata.outcome.\n\n","import { InjectionToken } from '@angular/core';\nimport { AXPActivityCategory, AXPActivityDefinition } from './activity.types';\n\nexport type AXPActivityProviderToken =\n | AXPActivityProvider\n | Promise<AXPActivityProvider>;\n\nexport const AXP_ACTIVITY_PROVIDER = new InjectionToken<AXPActivityProviderToken[]>('AXP_ACTIVITY_PROVIDER', {\n factory: () => [],\n});\n\nexport interface AXPActivityProvider {\n /**\n * Get list of activity definitions for a category.\n * @param categoryId - Category ID to filter activities\n * @returns Promise of activity definitions array\n */\n getList(categoryId: string): Promise<AXPActivityDefinition[]>;\n \n /**\n * Get activity definition by name (unique identifier).\n * The name is used as the command key for execution.\n * @param name - Activity name (unique identifier and command key)\n * @returns Promise of activity definition or undefined if not found\n */\n getById(name: string): Promise<AXPActivityDefinition | undefined>;\n}\n\nexport type AXPActivityCategoryProviderToken =\n | AXPActivityCategoryProvider\n | Promise<AXPActivityCategoryProvider>;\n\nexport const AXP_ACTIVITY_CATEGORY_PROVIDER = new InjectionToken<AXPActivityCategoryProviderToken[]>('AXP_ACTIVITY_CATEGORY_PROVIDER', {\n factory: () => [],\n});\n\nexport interface AXPActivityCategoryProvider {\n getList(parentId?: string): Promise<AXPActivityCategory[]>;\n getById(id: string): Promise<AXPActivityCategory | undefined>;\n}\n\n","//#region ---- Imports ----\n\nimport { inject, Injectable } from '@angular/core';\nimport { AXPActivityCategory, AXPActivityDefinition } from './activity.types';\nimport { AXP_ACTIVITY_CATEGORY_PROVIDER, AXP_ACTIVITY_PROVIDER } from './activity-definition.provider';\n\n//#endregion\n\n/**\n * Optimized Activity Definition Service\n * \n * Manages activity definitions (metadata) for UI and tooling.\n * Similar to AXPReportDefinitionService - only handles metadata, not execution.\n * \n * Performance optimizations:\n * 1. Uses childrenCount to determine if category has children (no query needed)\n * 2. Uses itemsCount to determine if category has activities (no query needed)\n * 3. Aggressive caching prevents duplicate API calls\n * 4. Single pending request per resource prevents race conditions\n * 5. Lazy loading - only loads data when needed\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPActivityDefinitionService {\n //#region ---- Providers & Caches ----\n\n private readonly categoryProviders = inject(AXP_ACTIVITY_CATEGORY_PROVIDER, { optional: true }) || [];\n private readonly activityProviders = inject(AXP_ACTIVITY_PROVIDER, { optional: true }) || [];\n\n //#endregion\n\n //#region ---- Cache Storage ----\n\n /** Cache for categories by id - O(1) lookup */\n private categoriesById = new Map<string, AXPActivityCategory>();\n\n /** Cache for categories by parentId - O(1) lookup */\n private categoriesByParentId = new Map<string | undefined, AXPActivityCategory[]>();\n\n /** Cache for activity definitions by categoryId - O(1) lookup */\n private activitiesByCategory = new Map<string, AXPActivityDefinition[]>();\n\n /** Cache for individual activity definitions by name - O(1) lookup */\n private activitiesByName = new Map<string, AXPActivityDefinition>();\n\n /** Track which provider index owns each category (by category ID) */\n private categoryOwnership = new Map<string, number>(); // Maps categoryId → provider index\n\n /** Pending API requests to prevent duplicate calls */\n private pendingCategoriesRequests = new Map<string | undefined, Promise<AXPActivityCategory[]>>();\n private pendingActivitiesRequests = new Map<string, Promise<AXPActivityDefinition[]>>();\n private pendingActivityRequests = new Map<string, Promise<AXPActivityDefinition | undefined>>();\n\n //#endregion\n\n //#region ---- Initialization ----\n\n\n //#endregion\n\n //#region ---- Public API: Categories ----\n\n /**\n * Get categories by parentId with aggressive caching\n * \n * Optimization: Returns cached result immediately if available,\n * preventing unnecessary API calls during navigation\n * \n * @param parentId - Parent category ID (undefined = root categories)\n * @returns Array of categories with count metadata (childrenCount, itemsCount)\n */\n async getCategories(parentId?: string): Promise<AXPActivityCategory[]> {\n // ✅ Fast path: Return cached result\n if (this.categoriesByParentId.has(parentId)) {\n return this.categoriesByParentId.get(parentId)!;\n }\n\n // ✅ Prevent duplicate requests: Return pending promise\n if (this.pendingCategoriesRequests.has(parentId)) {\n return this.pendingCategoriesRequests.get(parentId)!;\n }\n\n // ✅ Create single request and cache it\n const requestPromise = this.loadCategoriesFromProviders(parentId);\n this.pendingCategoriesRequests.set(parentId, requestPromise);\n\n return requestPromise;\n }\n\n /**\n * Get single category by ID with O(1) lookup\n * \n * Optimization: Uses Map for instant retrieval, falls back to\n * searching cache, then providers if not found\n */\n async getCategoryById(categoryId: string): Promise<AXPActivityCategory | undefined> {\n // ✅ Fast path: O(1) lookup in cache\n if (this.categoriesById.has(categoryId)) {\n return this.categoriesById.get(categoryId);\n }\n\n // ✅ Search in cached parent-child lists\n for (const categories of this.categoriesByParentId.values()) {\n const found = categories.find(cat => cat.id === categoryId);\n if (found) {\n this.categoriesById.set(categoryId, found);\n return found;\n }\n }\n\n // ✅ Load root categories if not loaded\n if (!this.categoriesByParentId.has(undefined)) {\n await this.getCategories();\n if (this.categoriesById.has(categoryId)) {\n return this.categoriesById.get(categoryId);\n }\n }\n\n // ✅ Breadth-first search through hierarchy\n return this.searchCategoryInHierarchy(categoryId);\n }\n\n /**\n * Get category path from root to specified category\n * \n * Optimization: Builds path using cached categories only\n */\n async getCategoriesPathById(categoryId: string): Promise<AXPActivityCategory[]> {\n const path: AXPActivityCategory[] = [];\n let currentCategoryId: string | undefined = categoryId;\n\n while (currentCategoryId) {\n const category = await this.getCategoryById(currentCategoryId);\n if (!category) {\n throw new Error(`Category '${currentCategoryId}' not found`);\n }\n path.unshift(category);\n currentCategoryId = category.parentId;\n }\n\n return path;\n }\n\n //#endregion\n\n //#region ---- Public API: Activity Definitions ----\n\n /**\n * Get activity definitions for a category with smart caching\n * \n * Optimization: Checks itemsCount before querying\n * - If itemsCount = 0, returns empty array (no API call)\n * - If itemsCount > 0, loads and caches activity definitions\n * - Returns cached result on subsequent calls\n * \n * @param categoryId - Category ID to get activity definitions from\n * @returns Array of activity definitions\n */\n async getActivitiesByCategoryId(categoryId: string): Promise<AXPActivityDefinition[]> {\n // ✅ Fast path: Return cached result\n if (this.activitiesByCategory.has(categoryId)) {\n return this.activitiesByCategory.get(categoryId)!;\n }\n\n // ✅ Smart optimization: Check itemsCount before querying\n const category = await this.getCategoryById(categoryId);\n if (category && category.itemsCount !== undefined && category.itemsCount === 0) {\n // Category has no activities - cache empty array and skip API call\n const emptyArray: AXPActivityDefinition[] = [];\n this.activitiesByCategory.set(categoryId, emptyArray);\n return emptyArray;\n }\n\n // ✅ Prevent duplicate requests\n if (this.pendingActivitiesRequests.has(categoryId)) {\n return this.pendingActivitiesRequests.get(categoryId)!;\n }\n\n // ✅ Load from providers\n const requestPromise = this.loadActivitiesFromProviders(categoryId);\n this.pendingActivitiesRequests.set(categoryId, requestPromise);\n\n return requestPromise;\n }\n\n /**\n * Get single activity definition by name with O(1) lookup\n * \n * Optimization: Uses Map for instant retrieval\n * \n * @param name - Activity name (unique identifier and command key)\n * @returns Activity definition or undefined if not found\n */\n async getActivityByName(name: string): Promise<AXPActivityDefinition | undefined> {\n // ✅ Fast path: O(1) lookup in cache\n if (this.activitiesByName.has(name)) {\n return this.activitiesByName.get(name);\n }\n\n // ✅ Prevent duplicate requests\n if (this.pendingActivityRequests.has(name)) {\n return this.pendingActivityRequests.get(name)!;\n }\n\n // ✅ Load from providers\n const requestPromise = this.loadActivityFromProviders(name);\n this.pendingActivityRequests.set(name, requestPromise);\n\n return requestPromise;\n }\n\n /**\n * Get all activity definitions (flat list) by loading root categories and their activities.\n * Used by activity selector UIs (e.g. automation command configurator).\n */\n async getAllActivities(): Promise<AXPActivityDefinition[]> {\n const categories = await this.getCategories(undefined);\n const all: AXPActivityDefinition[] = [];\n for (const cat of categories) {\n const activities = await this.getActivitiesByCategoryId(cat.id);\n all.push(...activities);\n }\n return all;\n }\n\n /**\n * Get category ID containing a specific activity definition\n * \n * Optimization: Searches cache first, loads on-demand if needed\n */\n async getCategoryIdByActivityName(activityName: string): Promise<string | undefined> {\n // ✅ Search in cached activity definitions\n for (const [categoryId, definitions] of this.activitiesByCategory.entries()) {\n if (definitions.some(def => def.name === activityName)) {\n return categoryId;\n }\n }\n\n // ✅ Try loading the activity definition to find its category\n const definition = await this.getActivityByName(activityName);\n if (definition && definition.category) {\n // Try to find category by name/id\n const categories = await this.getCategories();\n const found = categories.find(cat => cat.id === definition.category || cat.title === definition.category);\n if (found) {\n return found.id;\n }\n }\n\n return undefined;\n }\n\n /**\n * Get category path for an activity\n */\n async getCategoriesPathByActivityName(activityName: string): Promise<AXPActivityCategory[]> {\n const categoryId = await this.getCategoryIdByActivityName(activityName);\n if (!categoryId) {\n throw new Error(`Activity '${activityName}' not found in any category`);\n }\n return this.getCategoriesPathById(categoryId);\n }\n\n //#endregion\n\n //#region ---- Private: Data Loading ----\n\n /**\n * Load categories from providers and cache results\n * \n * Optimization: Tracks provider ownership to avoid unnecessary API calls\n * - For root (parentId = undefined): Query ALL providers\n * - For children: Only query the provider that owns the parent\n */\n private async loadCategoriesFromProviders(parentId?: string): Promise<AXPActivityCategory[]> {\n try {\n const resolvedProviders = await Promise.allSettled(this.categoryProviders);\n const categories: AXPActivityCategory[] = [];\n\n // Determine which provider(s) to query\n const providerIndicesToQuery = parentId\n ? this.getProviderIndexForCategory(parentId)\n : null; // Root: query all providers\n\n for (let i = 0; i < resolvedProviders.length; i++) {\n const p = resolvedProviders[i];\n\n // Skip if we have a specific provider index and this isn't it\n if (providerIndicesToQuery !== null && !providerIndicesToQuery.includes(i)) {\n continue;\n }\n\n if (p.status === 'fulfilled' && p.value && typeof p.value.getList === 'function') {\n try {\n const cats = await p.value.getList(parentId);\n if (Array.isArray(cats) && cats.length > 0) {\n categories.push(...cats);\n\n // ✅ Track ownership: This provider INDEX owns these categories\n cats.forEach(cat => this.categoryOwnership.set(cat.id, i));\n }\n } catch {\n // Continue on error - try other providers\n }\n }\n }\n\n // ✅ Cache results for fast subsequent access\n this.categoriesByParentId.set(parentId, categories);\n categories.forEach(cat => this.categoriesById.set(cat.id, cat));\n\n return categories;\n } finally {\n this.pendingCategoriesRequests.delete(parentId);\n }\n }\n\n /**\n * Get the provider index that owns a specific category\n * \n * @returns Array with provider index, or null if ownership unknown (query all)\n */\n private getProviderIndexForCategory(categoryId: string): number[] | null {\n const ownerIndex = this.categoryOwnership.get(categoryId);\n\n if (ownerIndex !== undefined) {\n return [ownerIndex];\n }\n\n // Ownership unknown - will query all providers (fallback)\n return null;\n }\n\n /**\n * Load activity definitions from providers and cache results\n * \n * Optimization: Only queries the provider that owns the category\n * Uses provider INDEX to match category provider with activity provider\n */\n private async loadActivitiesFromProviders(categoryId: string): Promise<AXPActivityDefinition[]> {\n try {\n const resolvedProviders = await Promise.allSettled(this.activityProviders);\n const definitions: AXPActivityDefinition[] = [];\n\n // ✅ Smart routing: Get provider INDEX that owns this category\n const ownerIndex = this.categoryOwnership.get(categoryId);\n const providerIndicesToQuery = ownerIndex !== undefined ? [ownerIndex] : null;\n\n for (let i = 0; i < resolvedProviders.length; i++) {\n const p = resolvedProviders[i];\n\n // Skip if we have a specific provider index and this isn't it\n if (providerIndicesToQuery !== null && !providerIndicesToQuery.includes(i)) {\n continue;\n }\n\n if (p.status === 'fulfilled' && p.value && typeof p.value.getList === 'function') {\n try {\n const defs = await p.value.getList(categoryId);\n if (Array.isArray(defs)) {\n definitions.push(...defs);\n }\n } catch {\n // Continue on error - try other providers\n }\n }\n }\n\n // ✅ Cache results for fast subsequent access\n this.activitiesByCategory.set(categoryId, definitions);\n definitions.forEach(def => {\n if (def.name) {\n this.activitiesByName.set(def.name, def);\n }\n });\n\n return definitions;\n } finally {\n this.pendingActivitiesRequests.delete(categoryId);\n }\n }\n\n /**\n * Load single activity definition from providers and cache result\n */\n private async loadActivityFromProviders(name: string): Promise<AXPActivityDefinition | undefined> {\n try {\n const resolvedProviders = await Promise.allSettled(this.activityProviders);\n\n // Try providers first\n for (const p of resolvedProviders) {\n if (p.status === 'fulfilled' && p.value && typeof p.value.getById === 'function') {\n try {\n const result = await p.value.getById(name);\n if (result) {\n this.activitiesByName.set(name, result);\n return result;\n }\n } catch {\n // Continue on error\n }\n }\n }\n\n // Fallback: Search in cached activity definitions\n for (const definitions of this.activitiesByCategory.values()) {\n const found = definitions.find(def => def.name === name);\n if (found) {\n this.activitiesByName.set(name, found);\n return found;\n }\n }\n\n return undefined;\n } finally {\n this.pendingActivityRequests.delete(name);\n }\n }\n\n /**\n * Breadth-first search through category hierarchy\n */\n private async searchCategoryInHierarchy(categoryId: string): Promise<AXPActivityCategory | undefined> {\n const searchQueue: (string | undefined)[] = [undefined];\n const searched = new Set<string | undefined>();\n\n while (searchQueue.length > 0) {\n const parentId = searchQueue.shift()!;\n if (searched.has(parentId)) continue;\n searched.add(parentId);\n\n const categories = await this.getCategories(parentId);\n const found = categories.find(cat => cat.id === categoryId);\n\n if (found) {\n return found;\n }\n\n // ✅ Optimization: Only search children if childrenCount > 0\n for (const category of categories) {\n if (category.childrenCount > 0 && !searched.has(category.id)) {\n searchQueue.push(category.id);\n }\n }\n }\n\n return undefined;\n }\n\n //#endregion\n\n //#region ---- Cache Management ----\n\n /**\n * Check if category has children (uses cached count)\n */\n categoryHasChildren(categoryId: string): boolean {\n const category = this.categoriesById.get(categoryId);\n return category ? category.childrenCount > 0 : false;\n }\n\n /**\n * Check if category has activities (uses cached count)\n */\n categoryHasActivities(categoryId: string): boolean {\n const category = this.categoriesById.get(categoryId);\n return category ? (category.itemsCount ?? 0) > 0 : false;\n }\n\n /**\n * Clear all caches\n */\n clearAllCache(): void {\n this.categoriesById.clear();\n this.categoriesByParentId.clear();\n this.activitiesByCategory.clear();\n this.activitiesByName.clear();\n this.categoryOwnership.clear();\n this.pendingCategoriesRequests.clear();\n this.pendingActivitiesRequests.clear();\n this.pendingActivityRequests.clear();\n }\n\n /**\n * Clear categories cache only\n */\n clearCategoriesCache(): void {\n this.categoriesById.clear();\n this.categoriesByParentId.clear();\n this.categoryOwnership.clear();\n this.pendingCategoriesRequests.clear();\n }\n\n /**\n * Clear activities cache only\n */\n clearActivitiesCache(): void {\n this.activitiesByCategory.clear();\n this.activitiesByName.clear();\n this.pendingActivitiesRequests.clear();\n this.pendingActivityRequests.clear();\n }\n\n //#endregion\n}\n\n","import { InjectionToken } from '@angular/core';\nimport {\n AXPFrontActivityCompleteRequest,\n AXPFrontActivityCompleteResponse,\n AXPGetWorkflowStateRequest,\n AXPResumeWorkflowRequest,\n AXPResumeWorkflowResponse,\n AXPStartWorkflowRequest,\n AXPStartWorkflowResponse,\n AXPWorkflowInstanceState,\n} from './workflow-runtime.types';\n\n/**\n * Interface for workflow engine operations.\n */\nexport interface AXPWorkflowEngine {\n /**\n * Start a new workflow instance.\n *\n * Creates a new workflow instance in backend and returns instance ID.\n *\n * @param request - Start workflow request\n * @returns Response with instanceId and initial state\n *\n */\n start(request: AXPStartWorkflowRequest): Promise<AXPStartWorkflowResponse>;\n\n /**\n * Resume a suspended workflow instance.\n *\n * Resumes workflow instance after user interaction (e.g., after show-dialog).\n *\n * @param request - Resume workflow request\n * @returns Resume response with next step and updated state\n *\n */\n resume(request: AXPResumeWorkflowRequest): Promise<AXPResumeWorkflowResponse>;\n\n /**\n * Get current workflow instance state.\n *\n * Retrieves current state of a workflow instance from backend.\n *\n * @param request - Get state request\n * @returns Current workflow instance state\n *\n */\n getState(request: AXPGetWorkflowStateRequest): Promise<AXPWorkflowInstanceState>;\n\n frontActivtyComplete(request: AXPFrontActivityCompleteRequest): Promise<AXPFrontActivityCompleteResponse>;\n}\n\n/**\n * Injection token for workflow engine.\n * Default implementation is AXPWorkflowLocalEngine.\n */\nexport const AXP_WORKFLOW_ENGINE = new InjectionToken<AXPWorkflowEngine>('AXP_WORKFLOW_ENGINE');\n","import { Injectable } from '@angular/core';\nimport { AXPExpressionEvaluatorScope } from '@acorex/platform/core';\nimport { get } from 'lodash-es';\nimport { AXPWorkflowInstanceState } from './workflow-runtime.types';\n\n//#region ---- Types & Interfaces ----\n\n/**\n * Workflow expression evaluation context.\n * Contains workflow state data needed for expression evaluation.\n */\nexport interface WorkflowExpressionContext {\n /** Workflow input values */\n inputs: Record<string, any>;\n \n /** Workflow state variables */\n variables: Record<string, any>;\n \n /** Previous activity outputs (activityId -> output) */\n outputs: Record<string, any>;\n}\n\n//#endregion\n\n/**\n * Workflow Expression Scope Service\n * \n * Shared service for building expression evaluation scope from workflow data.\n * Used by both Local Engine and Mock Runtime to manage workflow data (inputs, variables, outputs).\n * \n * Responsibilities:\n * - Build expression evaluation scope from workflow state\n * - Provide context.eval() function for accessing workflow data\n * - Manage workflow data structure (inputs, variables, outputs)\n * \n * This service does NOT:\n * - Execute activities\n * - Evaluate expressions (delegates to AXPExpressionEvaluatorService)\n * - Manage workflow state (handled by runtime)\n * \n * @example\n * ```typescript\n * const scopeService = inject(WorkflowExpressionScopeService);\n * \n * // Build scope from workflow state\n * const scope = scopeService.buildScope({\n * inputs: state.input || {},\n * variables: state.variables || {},\n * outputs: activityOutputs\n * });\n * \n * // Or build from state directly\n * const scope = scopeService.buildScopeFromState(state, activityOutputs);\n * ```\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class WorkflowExpressionScopeService {\n //#region ---- Private Helpers (dot-notation input normalization) ----\n\n /**\n * Collect dot-notation key-value pairs from nested objects so that e.g.\n * { metadata: { \"metadata.questionnaire.id\": \"x\" } } becomes { \"metadata.questionnaire.id\": \"x\" } at root.\n * Top-level non-dot keys are kept as-is.\n */\n private flattenDotKeysFromTree(obj: Record<string, any>): Record<string, any> {\n if (obj === null || typeof obj !== 'object') return obj;\n const result: Record<string, any> = {};\n for (const [key, value] of Object.entries(obj)) {\n if (key.includes('.')) {\n result[key] = value;\n } else if (value !== null && typeof value === 'object' && !Array.isArray(value)) {\n for (const [k, v] of Object.entries(value)) {\n if (k.includes('.')) {\n result[k] = v;\n } else {\n result[key + '.' + k] = v;\n }\n }\n } else {\n result[key] = value;\n }\n }\n return result;\n }\n\n /**\n * Expand flat keys with dots into nested objects.\n * e.g. { \"metadata.questionnaire.id\": \"x\" } -> { metadata: { questionnaire: { id: \"x\" } } }.\n */\n private expandDotKeys(obj: Record<string, any>): Record<string, any> {\n if (obj === null || typeof obj !== 'object') return obj;\n const result: Record<string, any> = {};\n const dotKeys: [string, any][] = [];\n const simpleKeys: [string, any][] = [];\n for (const [key, value] of Object.entries(obj)) {\n if (key.includes('.')) {\n dotKeys.push([key, value]);\n } else {\n simpleKeys.push([key, value]);\n }\n }\n for (const [key, value] of dotKeys) {\n const parts = key.split('.');\n let current = result;\n for (let i = 0; i < parts.length - 1; i++) {\n const part = parts[i];\n if (!(part in current) || typeof current[part] !== 'object' || current[part] === null) {\n current[part] = {};\n }\n current = current[part];\n }\n current[parts[parts.length - 1]] = value;\n }\n for (const [key, value] of simpleKeys) {\n result[key] = value;\n }\n return result;\n }\n\n /**\n * Normalize workflow input so that flat dot-notation keys (e.g. from form schema\n * \"metadata.questionnaire.id\") become nested for expression access (inputs.metadata.questionnaire.id).\n */\n private normalizeInputs(input: Record<string, any> | undefined): Record<string, any> {\n if (!input || typeof input !== 'object') return {};\n const flattened = this.flattenDotKeysFromTree(input);\n return this.expandDotKeys(flattened);\n }\n\n //#endregion\n\n //#region ---- Public Methods ----\n\n /**\n * Build expression evaluation scope for workflow activities.\n * \n * Provides workflow-specific data (inputs, variables, outputs) and context.eval() function.\n * Other data (session, current user, etc.) are provided by expression evaluator scope providers.\n * \n * Scope includes:\n * - inputs: Workflow input values (accessible as inputs.propertyName)\n * - variables: Workflow state variables (accessible as variables.propertyName or vars.propertyName)\n * - outputs: Previous activity outputs (accessible as outputs.activityId)\n * - context.eval(path): Function to access nested properties from workflow data\n * \n * Expressions can use:\n * - {{inputs.userName}} - Direct access to workflow input\n * - {{variables.someVar}} or {{vars.someVar}} - Direct access to workflow variable\n * - {{outputs.activityId.property}} - Direct access to previous activity output\n * - {{context.eval(\"inputs.userName\")}} - Access via context.eval (supports nested paths)\n * - {{context.eval(\"variables.someVar\")}} - Access variables via context.eval\n * - {{context.eval(\"outputs.activityId.property\")}} - Access outputs via context.eval\n * - {{session.currentUser().name}} - Access current user via expression evaluator scope providers\n * \n * The context.eval() function provides a unified way to access all workflow data,\n * similar to how entity-detail-list uses context.eval() to access parent data.\n * \n * @param context - Workflow expression context containing inputs, variables, and outputs\n * @returns Expression evaluator scope with workflow data and context.eval() function\n */\n buildScope(context: WorkflowExpressionContext): AXPExpressionEvaluatorScope {\n // Normalize inputs so flat dot-notation keys (e.g. metadata.questionnaire.id from forms) become nested for expressions\n const inputs = this.normalizeInputs(context.inputs || {});\n\n // Build merged workflow data object for context.eval()\n // This allows expressions like: context.eval(\"inputs.userName\") or context.eval(\"variables.count\")\n const workflowData = {\n inputs,\n variables: context.variables || {},\n vars: context.variables || {}, // Alias for convenience\n outputs: context.outputs || {},\n };\n\n // Build scope object with workflow-specific data and context.eval()\n // Note: AXPExpressionEvaluatorScope type expects { [namespace]: { [name]: Function } }\n // but evaluate() method actually accepts flat objects with values too\n // We'll use 'any' to allow both values and functions\n const scope: any = {\n // Direct access to workflow data\n inputs: workflowData.inputs,\n variables: workflowData.variables,\n vars: workflowData.vars,\n outputs: workflowData.outputs,\n \n // Context object with eval function (similar to entity-detail-list pattern)\n context: {\n eval: (path: string) => {\n // Use lodash get to access nested properties\n // Supports paths like: \"inputs.userName\", \"variables.count\", \"outputs.activityId.property\"\n return get(workflowData, path);\n },\n },\n };\n\n return scope as AXPExpressionEvaluatorScope;\n }\n\n /**\n * Build expression evaluation scope from workflow instance state.\n * \n * Convenience method that extracts data from AXPWorkflowInstanceState.\n * \n * @param state - Workflow instance state\n * @param activityOutputs - Map of activity outputs (activityId -> output)\n * @returns Expression evaluator scope with workflow data and context.eval() function\n */\n buildScopeFromState(\n state: AXPWorkflowInstanceState,\n activityOutputs?: Map<string, any> | Record<string, any>\n ): AXPExpressionEvaluatorScope {\n // Convert activity outputs to record format\n const outputs: Record<string, any> = {};\n if (activityOutputs) {\n if (activityOutputs instanceof Map) {\n activityOutputs.forEach((output, activityId) => {\n outputs[activityId] = output;\n });\n } else {\n Object.assign(outputs, activityOutputs);\n }\n }\n\n // Convenience alias for the last activity output (if available).\n // This allows expressions like: {{outputs.last.someField}}\n if (outputs['last'] === undefined && state.lastActivityOutput !== undefined) {\n outputs['last'] = state.lastActivityOutput;\n }\n\n return this.buildScope({\n inputs: this.normalizeInputs((state.input || {}) as Record<string, any>),\n variables: state.variables || {},\n outputs: outputs,\n });\n }\n\n //#endregion\n}\n\n","import { Injectable, inject } from '@angular/core';\nimport { AXPCommandService } from '@acorex/platform/runtime';\nimport { AXPExpressionEvaluatorService } from '@acorex/platform/core';\nimport { AXPWorkflowTask, AXPWorkflowInstanceState } from './workflow-runtime.types';\nimport { WorkflowExpressionScopeService } from './workflow-expression-scope.service';\n\n//#region ---- Constants ----\n\n/**\n * Activity types handled internally by the workflow engine (e.g. mock backend).\n * When such an activity is not registered as Command on the client, we skip execution\n * without warning — the engine will run it when executing the workflow.\n */\nconst ENGINE_BUILTIN_ACTIVITY_TYPES = new Set<string>([\n 'workflow-activity:set-variable',\n 'workflow-activity:http-request',\n]);\n\n//#endregion\n\n//#region ---- Types & Interfaces ----\n\n/**\n * Result of executing a workflow activity.\n */\nexport interface ActivityExecutionResult {\n /**\n * Activity execution output.\n */\n output: any;\n\n /**\n * Activity execution outcome (e.g., 'Done', 'Confirmed', 'Cancelled', 'Failed').\n */\n outcome: string;\n}\n\n//#endregion\n\n/**\n * Activity Executor Service\n * \n * Service for executing workflow activities via CommandBus.\n * Automatically evaluates expressions in activity inputs before execution.\n * \n * @example\n * ```typescript\n * const executor = inject(ActivityExecutor);\n * \n * // Execute activity with task and workflow state (expressions will be evaluated)\n * const result = await executor.execute(task, workflowState, activityOutputs);\n * ```\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class ActivityExecutor {\n //#region ---- Services & Dependencies ----\n\n private readonly commandService = inject(AXPCommandService);\n private readonly expressionEvaluator = inject(AXPExpressionEvaluatorService);\n private readonly expressionScopeService = inject(WorkflowExpressionScopeService);\n\n //#endregion\n\n //#region ---- Public Methods ----\n\n /**\n * Execute a workflow activity with expression evaluation.\n * \n * Evaluates expressions in activity inputs using workflow state,\n * then executes the activity via CommandBus.\n * \n * @param task - Workflow task containing activity information\n * @param workflowState - Current workflow instance state (for expression evaluation)\n * @param activityOutputs - Map of previous activity outputs (for expression evaluation)\n * @returns Execution result with output and outcome\n */\n async execute(\n task: AXPWorkflowTask,\n workflowState?: AXPWorkflowInstanceState,\n activityOutputs?: Map<string, any> | Record<string, any>\n ): Promise<ActivityExecutionResult> {\n \n try {\n const activityName = task.activityType;\n\n // Evaluate inputs if workflow state is provided\n let evaluatedInputs = task.input || {};\n if (workflowState) {\n // Prefer explicit outputs, fallback to outputs stored in state\n const outputsForScope =\n activityOutputs ??\n (workflowState.activityOutputs as Record<string, any> | undefined) ??\n undefined;\n\n // Build expression scope from workflow state\n const scope = this.expressionScopeService.buildScopeFromState(workflowState, outputsForScope);\n \n // Evaluate all inputs recursively (handles nested objects and arrays)\n evaluatedInputs = await this.expressionEvaluator.evaluate(task.input || {}, scope);\n }\n\n // Check if command exists\n const commandExists = this.commandService.exists(activityName);\n\n if (!commandExists) {\n if (!ENGINE_BUILTIN_ACTIVITY_TYPES.has(activityName)) {\n console.warn(\n `[ActivityExecutor] ⚠️ Activity '${activityName}' is not registered as Command. ` +\n `Skipping execution.`\n );\n }\n return {\n output: null,\n outcome: 'Done'\n };\n }\n\n // Flatten properties if nested (workflow-studio format)\n let commandInput = evaluatedInputs;\n if (commandInput['properties'] && typeof commandInput['properties'] === 'object') {\n // Flatten: {properties: {text: \"...\"}} -> {text: \"...\"}\n commandInput = { ...commandInput['properties'] };\n }\n\n // Execute activity via CommandBus\n // Activities (AXPActivity) return {output, outcome}; legacy may return {output, outcomes}\n const result = await this.commandService.execute<Record<string, any>, {\n output?: any;\n outcome?: string;\n outcomes?: Record<string, any>;\n }>(activityName, commandInput);\n \n if (!result) {\n return {\n output: null,\n outcome: 'Failed',\n };\n }\n\n if (!result.success) {\n return {\n output: {\n error: result.message?.text,\n },\n outcome: 'Failed',\n };\n }\n\n const commandResult = result.data as any;\n\n // Prefer unified outcome in result.metadata; fall back to legacy data.outcome/outcomes.\n const metadataOutcome = (result as any)?.metadata?.['outcome'];\n let outcome = 'Done';\n if (typeof metadataOutcome === 'string' && metadataOutcome.length > 0) {\n outcome = metadataOutcome;\n } else if (typeof commandResult?.outcome === 'string' && commandResult.outcome.length > 0) {\n outcome = commandResult.outcome;\n } else {\n const outcomes = (commandResult?.outcomes ?? {}) as Record<string, any>;\n if (outcomes && typeof outcomes === 'object' && Object.keys(outcomes).length > 0) {\n outcome = outcomes['Done'] ? 'Done' : Object.keys(outcomes)[0] || 'Done';\n }\n }\n\n // Prefer output wrapper when present; otherwise treat data itself as output.\n const output =\n commandResult && typeof commandResult === 'object' && 'output' in commandResult\n ? commandResult.output\n : commandResult;\n\n return {\n output: output ?? null,\n outcome,\n };\n } catch (error: any) {\n console.error(`[ActivityExecutor] ❌ Error evaluating expressions or executing activity:`, error);\n return {\n output: { error: error.message || 'Unknown error' },\n outcome: 'Failed'\n };\n }\n }\n\n //#endregion\n}\n\n","import { Injectable, inject } from '@angular/core';\nimport { ActivityExecutionResult, ActivityExecutor } from './activity-executor.service';\nimport { AXP_WORKFLOW_ENGINE } from './workflow-engine';\nimport { AXPWorkflowInstanceState, AXPWorkflowTask } from './workflow-runtime.types';\n\n//#region ---- Types & Interfaces ----\n\n/**\n * Result of starting a workflow.\n */\nexport interface WorkflowStartResult {\n /**\n * Whether the operation succeeded.\n */\n success: boolean;\n\n /**\n * Workflow instance ID.\n */\n instanceId?: string;\n\n /**\n * Initial workflow state.\n */\n state?: AXPWorkflowInstanceState;\n\n /**\n * First task to execute (if any).\n */\n nextTask?: AXPWorkflowTask | null;\n\n /**\n * Workflow output (if completed immediately).\n */\n output?: any;\n\n /**\n * Error message (if failed).\n */\n error?: string;\n}\n\n/**\n * Result of completing a task.\n */\nexport interface WorkflowCompleteResult {\n /**\n * Whether the operation succeeded.\n */\n success: boolean;\n\n /**\n * Workflow instance ID.\n */\n instanceId: string;\n\n /**\n * Updated workflow state.\n */\n state?: AXPWorkflowInstanceState;\n\n /**\n * Next task to execute (if any).\n */\n nextTask?: AXPWorkflowTask | null;\n\n /**\n * Workflow output (if completed).\n */\n output?: any;\n\n /**\n * Error message (if failed).\n */\n error?: string;\n}\n\n/**\n * Result of resuming a workflow.\n */\nexport interface WorkflowResumeResult {\n /**\n * Whether the operation succeeded.\n */\n success: boolean;\n\n /**\n * Workflow instance ID.\n */\n instanceId: string;\n\n /**\n * Updated workflow state.\n */\n state?: AXPWorkflowInstanceState;\n\n /**\n * Next task to execute (if any).\n */\n nextTask?: AXPWorkflowTask | null;\n\n /**\n * Workflow output (if completed).\n */\n output?: any;\n\n /**\n * Error message (if failed).\n */\n error?: string;\n}\n\n//#endregion\n\n/**\n * Workflow Manager - Facade for workflow lifecycle orchestration.\n *\n * This service is the ONLY interface the frontend uses to interact with workflows.\n * It follows Clean Architecture principles and does NOT contain execution or business logic.\n *\n * Responsibilities:\n * - Orchestrate workflow lifecycle (start, execute, complete, resume)\n * - Delegate execution to ActivityExecutor\n * - Cache workflow state in memory\n * - Expose a stable API for UI\n *\n * Rules:\n * - No HTTP calls (delegates to AXPWorkflowEngine)\n * - No CommandBus / Command execution (delegates to ActivityExecutor)\n * - No workflow branching logic (backend decides)\n * - No business validation (backend validates)\n * - No backend assumptions (uses abstract runtime service)\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPWorkflowManager {\n //#region ---- Services & Dependencies ----\n\n private readonly workflowEngine = inject(AXP_WORKFLOW_ENGINE);\n private readonly activityExecutor = inject(ActivityExecutor); \n\n //#endregion\n\n //#region ---- State Cache ----\n\n /**\n * Cache workflow states in memory for quick access.\n * Key: instanceId\n * Value: AXPWorkflowInstanceState\n */\n private stateCache = new Map<string, AXPWorkflowInstanceState>();\n\n /**\n * Cache TTL in milliseconds (5 minutes).\n */\n private readonly CACHE_TTL = 5 * 60 * 1000;\n\n //#endregion\n\n //#region ---- Public Methods ----\n\n /**\n * Execute frontend activities interactively until reaching workflow-activity:human-task or completion.\n *\n * Interactive = show form/popup immediately (user sees and acts). Only workflow-activity:human-task\n * is not interactive (goes to task board). Other frontend activities (show-layout-popup, show-toast, etc.)\n * even with taskType human-task in definition are executed here.\n *\n * @param instanceId - Workflow instance ID\n * @param task - Current task to execute\n * @param state - Current workflow state\n * @param lastActivityOutput - Last activity output (for expression evaluation)\n * @returns Final result with nextTask (if workflow-activity:human-task) or completion status\n */\n private async executeInteractiveFlow(\n instanceId: string,\n task: AXPWorkflowTask,\n state: AXPWorkflowInstanceState,\n activityOutputs?: Record<string, any>\n ): Promise<{ nextTask: AXPWorkflowTask | null; state: AXPWorkflowInstanceState; output?: any }> {\n let currentTask: AXPWorkflowTask | null = task;\n let currentState = state;\n let currentActivityOutputs: Record<string, any> = {\n ...(currentState.activityOutputs || {}),\n ...(activityOutputs || {}),\n };\n const maxIterations = 100; // Prevent infinite loops\n let iterationCount = 0;\n\n while (currentTask && iterationCount < maxIterations) {\n iterationCount++;\n\n // Interactive = frontend executionMode and NOT workflow-activity:human-task (that one goes to task board)\n const isInteractive =\n (currentTask.executionMode === 'frontend' || currentTask.executionMode === 'both') &&\n currentTask.activityType !== 'workflow-activity:human-task';\n\n if (isInteractive) {\n // Execute frontend activity\n const execResult = await this.activityExecutor.execute(\n currentTask,\n currentState,\n currentActivityOutputs\n );\n\n // Track outputs locally (backend should also persist and return them)\n currentActivityOutputs = {\n ...currentActivityOutputs,\n [currentTask.activityId]: execResult.output,\n };\n\n // Send result to backend\n const completeResponse = await this.workflowEngine.frontActivtyComplete({\n instanceId,\n activityNode: currentTask.activityId,\n output: execResult.output || {},\n outcome: execResult.outcome,\n });\n\n // Update state cache\n if (completeResponse.state) {\n const normalizedState = { ...completeResponse.state };\n if (normalizedState.lastUpdated && !(normalizedState.lastUpdated instanceof Date)) {\n normalizedState.lastUpdated = new Date(normalizedState.lastUpdated);\n }\n currentState = normalizedState;\n // Prefer outputs returned by backend; fallback to local cache\n currentActivityOutputs = {\n ...currentActivityOutputs,\n ...(normalizedState.activityOutputs || {}),\n };\n this.stateCache.set(instanceId, normalizedState);\n }\n\n // Backend decides: if no nextTask, workflow is completed\n if (!completeResponse.nextTask) {\n return {\n nextTask: null,\n state: currentState,\n output: completeResponse.output,\n };\n }\n\n // Backend decides: if nextTask is workflow-activity:human-task or not frontend, return it (task board or done)\n const nextInteractive =\n (completeResponse.nextTask.executionMode === 'frontend' || completeResponse.nextTask.executionMode === 'both') &&\n completeResponse.nextTask.activityType !== 'workflow-activity:human-task';\n if (!nextInteractive) {\n return {\n nextTask: completeResponse.nextTask,\n state: currentState,\n };\n }\n\n // Continue with next interactive frontend task\n currentTask = completeResponse.nextTask;\n } else {\n // Not interactive (e.g. workflow-activity:human-task) - return as-is for task board\n return {\n nextTask: currentTask,\n state: currentState,\n };\n }\n }\n\n // Max iterations reached\n if (iterationCount >= maxIterations) {\n console.warn(`[AXPWorkflowManager] ⚠️ Maximum iterations (${maxIterations}) reached`);\n }\n\n return {\n nextTask: currentTask,\n state: currentState,\n };\n }\n\n /**\n * Start a new workflow instance.\n *\n * Creates a new workflow instance in backend and returns instance ID.\n * Backend decides what to do: returns pendingTask or indicates completion.\n *\n * @param workflowId - Workflow ID to start\n * @param input - Initial input data (optional)\n * @returns Start result with instanceId, state, and nextTask\n *\n * @example\n * ```typescript\n * const result = await workflowManager.start('my-workflow', { userId: '123' });\n *\n * if (result.success && result.nextTask) {\n * // Execute task if frontend\n * if (result.nextTask.executionMode === 'frontend') {\n * const execResult = await workflowManager.execute(result.nextTask);\n * await workflowManager.complete(result.instanceId!, result.nextTask, execResult.outcome, execResult.output);\n * }\n * }\n * ```\n */\n async start(workflowId: string, input: Record<string, any> = {}): Promise<WorkflowStartResult> {\n try {\n const response = await this.workflowEngine.start({\n workflowId,\n input,\n });\n\n // Cache state (normalize Date)\n let startNormalizedState = { ...response.state };\n if (startNormalizedState.lastUpdated && !(startNormalizedState.lastUpdated instanceof Date)) {\n startNormalizedState.lastUpdated = new Date(startNormalizedState.lastUpdated);\n }\n this.stateCache.set(response.instanceId, startNormalizedState);\n\n // 🎯 Interactive flow: Execute frontend activities that are NOT workflow-activity:human-task (those go to task board)\n let finalNextTask = response.pendingTask || null;\n let finalOutput = startNormalizedState.output;\n\n const pendingTask = response.pendingTask;\n if (\n pendingTask &&\n (pendingTask.executionMode === 'frontend' || pendingTask.executionMode === 'both') &&\n pendingTask.activityType !== 'workflow-activity:human-task'\n ) {\n const interactiveResult = await this.executeInteractiveFlow(\n response.instanceId,\n pendingTask,\n startNormalizedState,\n response.activityOutputs || response.state.activityOutputs\n );\n\n finalNextTask = interactiveResult.nextTask;\n startNormalizedState = interactiveResult.state;\n if (interactiveResult.output !== undefined) {\n finalOutput = interactiveResult.output;\n }\n\n // Update cache with final state\n this.stateCache.set(response.instanceId, startNormalizedState);\n }\n // If backend returned null or non-executable task, return it as-is\n // Backend already decided workflow status (suspended, completed, etc.)\n\n return {\n success: true,\n instanceId: response.instanceId,\n state: startNormalizedState,\n nextTask: finalNextTask,\n output: finalOutput,\n };\n } catch (error: any) {\n console.error('[AXPWorkflowManager] ❌ Error starting workflow:', error);\n return {\n success: false,\n error: error.message || 'Failed to start workflow',\n };\n }\n }\n\n /**\n * Resume a suspended workflow (e.g., after user interaction).\n *\n * Backend determines nextStep based on outcome and outcomeConnections.\n * Client only provides instanceId, stepId, outcome, and optional userInput.\n *\n * @param instanceId - Workflow instance ID\n * @param stepId - Step ID that was waiting for user input\n * @param outcome - User action outcome (e.g., 'Confirmed', 'Cancelled', 'Submitted')\n * @param userInput - Optional user input data\n * @param taskToken - Secure task token (required for secure resumption)\n * @returns Resume result with next task (if any)\n */\n async resume(\n instanceId: string,\n stepId: string,\n outcome: string,\n userInput?: any,\n taskToken?: string,\n ): Promise<WorkflowResumeResult> {\n try {\n // Ensure taskToken is provided for secure resumption\n if (!taskToken) {\n throw new Error('Missing taskToken for resume operation');\n }\n\n // Backend handles everything: checks outcomeConnections and determines nextStep\n const response = await this.workflowEngine.resume({\n instanceId,\n stepId,\n taskToken,\n outcome,\n userInput,\n });\n\n // Update cache with state from backend\n let normalizedState = response.state ? { ...response.state } : undefined;\n if (normalizedState && normalizedState.lastUpdated && !(normalizedState.lastUpdated instanceof Date)) {\n normalizedState.lastUpdated = new Date(normalizedState.lastUpdated);\n }\n \n if (normalizedState) {\n this.stateCache.set(instanceId, normalizedState);\n }\n\n // 🎯 Interactive flow: Execute frontend activities that are NOT workflow-activity:human-task (those go to task board)\n let finalNextTask = response.nextTask || null;\n let finalOutput = response.output;\n\n const nextTask = response.nextTask;\n if (\n nextTask &&\n (nextTask.executionMode === 'frontend' || nextTask.executionMode === 'both') &&\n nextTask.activityType !== 'workflow-activity:human-task'\n ) {\n const interactiveResult = await this.executeInteractiveFlow(\n instanceId,\n nextTask,\n normalizedState!,\n normalizedState?.activityOutputs\n );\n\n finalNextTask = interactiveResult.nextTask;\n normalizedState = interactiveResult.state;\n if (interactiveResult.output !== undefined) {\n finalOutput = interactiveResult.output;\n }\n\n // Update cache with final state\n this.stateCache.set(instanceId, normalizedState);\n }\n // If backend returned null or non-executable task, return it as-is\n // Backend already decided workflow status (suspended, completed, etc.)\n\n return {\n success: true,\n instanceId,\n state: normalizedState || response.state,\n nextTask: finalNextTask,\n output: finalOutput,\n };\n } catch (error: any) {\n console.error('[AXPWorkflowManager] ❌ Error resuming workflow:', error);\n return {\n success: false,\n instanceId,\n error: error.message || 'Failed to resume workflow',\n };\n }\n }\n\n /**\n * Get workflow instance state.\n *\n * Retrieves state from cache (if valid) or from backend.\n *\n * @param instanceId - Workflow instance ID\n * @returns Workflow instance state or null if not found\n */\n async getState(instanceId: string): Promise<AXPWorkflowInstanceState | null> {\n // Check cache first\n const cached = this.stateCache.get(instanceId);\n if (cached) {\n // Normalize lastUpdated to Date (for cache safety)\n const normalizedCached = { ...cached };\n if (normalizedCached.lastUpdated && !(normalizedCached.lastUpdated instanceof Date)) {\n normalizedCached.lastUpdated = new Date(normalizedCached.lastUpdated);\n }\n\n // Validate cache age\n const cacheAge = Date.now() - normalizedCached.lastUpdated.getTime();\n if (cacheAge < this.CACHE_TTL) {\n return normalizedCached;\n }\n }\n\n // Fetch from backend\n try {\n const state = await this.workflowEngine.getState({\n instanceId,\n });\n\n // Normalize lastUpdated to Date (for cache safety)\n const normalizedState = { ...state };\n if (normalizedState.lastUpdated && !(normalizedState.lastUpdated instanceof Date)) {\n normalizedState.lastUpdated = new Date(normalizedState.lastUpdated);\n }\n\n // Update cache\n this.stateCache.set(instanceId, normalizedState);\n\n return normalizedState;\n } catch (error: any) {\n console.error('[AXPWorkflowManager] ❌ Error getting workflow state:', error);\n return null;\n }\n }\n\n //#endregion\n}\n","import { InjectionToken } from '@angular/core';\nimport { AXPCategoryEntity } from '@acorex/platform/core';\nimport { AXPWorkflowDefinition } from '../workflow-definition.types';\n\n/**\n * Workflow Category - Extends AXPCategoryEntity for consistency and performance\n * \n * Inherited properties from AXPCategoryEntity:\n * - id: string - Unique identifier\n * - title: string - Display name\n * - description?: string - Category description\n * - parentId?: string - Parent category ID\n * - childrenCount: number - Direct child categories count (enables lazy loading)\n * - itemsCount?: number - Direct workflows count\n * - totalChildrenCount?: number - Total nested categories (optional, for analytics)\n * - totalItemsCount?: number - Total workflows in tree (optional, for analytics)\n */\nexport interface AXPWorkflowCategory extends AXPCategoryEntity {\n // No additional properties needed - all inherited from AXPCategoryEntity\n // Use: childrenCount instead of hasChild\n // Use: itemsCount instead of hasWorkflow\n}\n\nexport type AXPWorkflowProviderToken =\n | AXPWorkflowProvider\n | Promise<AXPWorkflowProvider>;\n\nexport const AXP_WORKFLOW_PROVIDER = new InjectionToken<AXPWorkflowProviderToken[]>('AXP_WORKFLOW_PROVIDER', {\n factory: () => [],\n});\n\nexport interface AXPWorkflowProvider {\n /**\n * Get list of workflow definitions for a category.\n * @param categoryId - Category ID to filter workflows\n * @returns Promise of workflow definition array\n */\n getList(categoryId: string): Promise<AXPWorkflowDefinition[]>;\n \n /**\n * Get full workflow definition by name (unique identifier).\n * Used by workflow engines for execution and UI for metadata.\n * @param name - Workflow name (unique identifier)\n * @returns Promise of full workflow definition or null if not found\n */\n getByName(name: string): Promise<AXPWorkflowDefinition | null>;\n}\n\nexport type AXPWorkflowCategoryProviderToken =\n | AXPWorkflowCategoryProvider\n | Promise<AXPWorkflowCategoryProvider>;\n\nexport const AXP_WORKFLOW_CATEGORY_PROVIDER = new InjectionToken<AXPWorkflowCategoryProviderToken[]>('AXP_WORKFLOW_CATEGORY_PROVIDER', {\n factory: () => [],\n});\n\nexport interface AXPWorkflowCategoryProvider {\n getList(parentId?: string): Promise<AXPWorkflowCategory[]>;\n getById(id: string): Promise<AXPWorkflowCategory | undefined>;\n}\n\n","import { Injectable, inject } from '@angular/core';\nimport { AXPWorkflowEngine } from './workflow-engine';\nimport {\n AXPStartWorkflowRequest,\n AXPStartWorkflowResponse,\n AXPResumeWorkflowRequest,\n AXPResumeWorkflowResponse,\n AXPGetWorkflowStateRequest,\n AXPWorkflowInstanceState,\n AXPWorkflowTask,\n AXPFrontActivityCompleteRequest,\n AXPFrontActivityCompleteResponse,\n} from './workflow-runtime.types';\nimport {\n AXPWorkflowDefinition,\n AXPWorkflowGraph,\n AXPWorkflowActivityInstance,\n AXPConnection,\n} from '../workflow-definition.types';\nimport {\n AXP_WORKFLOW_PROVIDER,\n AXPWorkflowProvider,\n} from '../workflow/workflow-definition.provider';\nimport { AXPActivityDefinitionService } from '../activity/activity-definition.service';\nimport { AXPDataGenerator } from '@acorex/platform/core';\n\n//#region ---- Types & Interfaces ----\n\n/**\n * Internal workflow execution state.\n */\ninterface LocalWorkflowState {\n instanceId: string;\n workflowId: string;\n definition: AXPWorkflowDefinition;\n state: AXPWorkflowInstanceState;\n currentActivityId?: string;\n completedActivities: Set<string>;\n activityResults: Map<string, { output: any; outcome?: string }>;\n}\n\n//#endregion\n\n/**\n * Local engine implementation that manages workflow progression and state.\n * \n * This engine:\n * - Returns frontend/both activities as pendingTask (does NOT execute them)\n * - Skips backend activities (does not error, continues execution)\n * - Maintains workflow state in memory\n * - Does not require backend API calls\n * \n * Execution of frontend tasks is handled by AXPWorkflowManager via ActivityExecutor.\n * This engine only manages workflow progression and state storage.\n * \n * This is the DEFAULT engine provider. Applications can override it with\n * an API-based engine implementation.\n */\n@Injectable()\nexport class AXPWorkflowLocalEngine implements AXPWorkflowEngine {\n //#region ---- Services & Dependencies ----\n\n private readonly activityDefinitionService = inject(AXPActivityDefinitionService);\n private readonly workflowProviders = inject(AXP_WORKFLOW_PROVIDER, { optional: true }) || [];\n\n //#endregion\n\n //#region ---- Instance Storage ----\n\n /**\n * In-memory storage for workflow instances.\n * Key: instanceId\n * Value: LocalWorkflowState\n */\n private instances = new Map<string, LocalWorkflowState>();\n\n /**\n * Task token storage for secure resume operations.\n * Key: taskToken\n * Value: { instanceId, activityId }\n */\n private taskTokens = new Map<string, { instanceId: string; activityId: string }>();\n\n //#endregion\n\n //#region ---- Public Methods (AXPWorkflowEngine) ----\n\n /**\n * Start a new workflow instance.\n * \n * Creates an in-memory workflow instance and progresses it.\n * Frontend/both activities are returned as pendingTask for external execution.\n * Backend activities are skipped.\n */\n async start(request: AXPStartWorkflowRequest): Promise<AXPStartWorkflowResponse> {\n console.log(`[WorkflowLocalEngine] 🚀 Starting workflow: ${request.workflowId}`, request);\n \n // Generate instance ID\n const instanceId = AXPDataGenerator.uuid();\n const now = new Date();\n\n // Load workflow definition\n console.log(`[WorkflowLocalEngine] 📥 Loading workflow definition: ${request.workflowId}`);\n const definition = await this.getDefinition(request.workflowId);\n if (!definition) {\n console.error(`[WorkflowLocalEngine] ❌ Workflow definition not found: ${request.workflowId}`);\n throw new Error(`Workflow definition not found: ${request.workflowId}`);\n }\n\n console.log(`[WorkflowLocalEngine] ✅ Definition loaded:`, {\n name: definition.name,\n activitiesCount: definition.graph?.activities?.length || 0,\n connectionsCount: definition.graph?.connections?.length || 0,\n });\n\n // Initialize workflow state\n const state: AXPWorkflowInstanceState = {\n instanceId,\n workflowId: request.workflowId,\n status: 'running',\n variables: {},\n activityOutputs: {},\n lastActivityOutput: undefined,\n input: request.input || {},\n output: undefined,\n lastUpdated: now,\n };\n\n // Create local state\n const localState: LocalWorkflowState = {\n instanceId,\n workflowId: request.workflowId,\n definition,\n state,\n completedActivities: new Set(),\n activityResults: new Map(),\n };\n\n // Store instance\n this.instances.set(instanceId, localState);\n\n // Execute workflow steps\n console.log(`[WorkflowLocalEngine] ⚙️ Executing workflow steps...`);\n const pendingTask = await this.executeWorkflowSteps(localState);\n\n // Update state\n localState.state.lastUpdated = new Date();\n\n console.log(`[WorkflowLocalEngine] ✅ Workflow started:`, {\n instanceId,\n status: localState.state.status,\n hasPendingTask: !!pendingTask,\n pendingTaskType: pendingTask?.activityType,\n });\n\n return {\n instanceId,\n state: localState.state,\n pendingTask: pendingTask || null,\n activityOutputs: localState.state.activityOutputs,\n lastActivityOutput: localState.state.lastActivityOutput,\n };\n }\n\n /**\n * Resume a suspended workflow instance.\n * \n * Validates task token, applies externally executed result,\n * and continues progressing workflow steps.\n */\n async resume(request: AXPResumeWorkflowRequest): Promise<AXPResumeWorkflowResponse> {\n // Validate task token\n const tokenInfo = this.taskTokens.get(request.taskToken);\n if (!tokenInfo || tokenInfo.instanceId !== request.instanceId || tokenInfo.activityId !== request.stepId) {\n throw new Error('Invalid task token');\n }\n\n // Get instance\n const localState = this.instances.get(request.instanceId);\n if (!localState) {\n throw new Error(`Workflow instance not found: ${request.instanceId}`);\n }\n\n // Store activity result (from external execution)\n const outcome = request.outcome ?? 'Done';\n localState.activityResults.set(request.stepId, {\n output: request.userInput || {},\n outcome,\n });\n localState.completedActivities.add(request.stepId);\n\n // Store activity output for expression evaluation\n localState.state.activityOutputs = {\n ...(localState.state.activityOutputs || {}),\n [request.stepId]: request.userInput || {},\n };\n localState.state.lastActivityOutput = request.userInput || {};\n\n // Merge output/userInput into state variables\n if (request.userInput) {\n localState.state.variables = {\n ...localState.state.variables,\n ...(request.userInput || {}),\n };\n }\n\n // Mark activity as completed and continue progression\n // Continue progressing workflow steps (skipping backend activities)\n const nextTask = await this.executeWorkflowSteps(localState);\n\n // Update state\n localState.state.lastUpdated = new Date();\n\n // Determine final status\n if (!nextTask && localState.state.status === 'running') {\n localState.state.status = 'completed';\n localState.state.output = localState.state.variables;\n }\n\n return {\n output: request.userInput || {},\n outcomes: { [outcome]: true },\n state: localState.state,\n nextTask: nextTask || null,\n };\n }\n\n /**\n * Get current workflow instance state.\n */\n async getState(request: AXPGetWorkflowStateRequest): Promise<AXPWorkflowInstanceState> {\n const localState = this.instances.get(request.instanceId);\n if (!localState) {\n throw new Error(`Workflow instance not found: ${request.instanceId}`);\n }\n\n // Normalize lastUpdated to Date (for cache safety)\n const state = { ...localState.state };\n if (state.lastUpdated && !(state.lastUpdated instanceof Date)) {\n state.lastUpdated = new Date(state.lastUpdated);\n }\n\n return state;\n }\n\n //#endregion\n\n //#region ---- Private Methods ----\n\n /**\n * Get workflow definition from available providers.\n */\n private async getDefinition(workflowId: string): Promise<AXPWorkflowDefinition | null> {\n // Try all providers in order\n const resolvedProviders = await Promise.allSettled(this.workflowProviders);\n for (const p of resolvedProviders) {\n if (p.status === 'fulfilled' && p.value) {\n const provider = p.value;\n // Check if provider has getByName method\n if (typeof provider.getByName === 'function') {\n try {\n const definition = await provider.getByName(workflowId);\n if (definition) {\n return definition;\n }\n } catch {\n // Continue on error - try other providers\n }\n }\n }\n }\n\n return null;\n }\n\n /**\n * Progress workflow steps starting from the current position.\n * \n * For frontend/both activities: returns task immediately (suspends workflow).\n * For backend activities: skips and continues.\n * \n * Returns the next pending task (if frontend activity found) or null (if completed).\n */\n private async executeWorkflowSteps(localState: LocalWorkflowState): Promise<AXPWorkflowTask | null> {\n const graph = localState.definition.graph;\n const activities = graph.activities || [];\n const connections = graph.connections || [];\n\n // Build activity map\n const activityMap = new Map<string, AXPWorkflowActivityInstance>();\n activities.forEach(activity => {\n activityMap.set(activity.id, activity);\n });\n\n // Build connection graph\n const outgoingConnections = new Map<string, AXPConnection[]>();\n const incomingConnections = new Map<string, AXPConnection[]>();\n\n connections.forEach(conn => {\n const sourceId = conn.source.activtyName;\n const targetId = conn.target.activtyName;\n\n if (!outgoingConnections.has(sourceId)) {\n outgoingConnections.set(sourceId, []);\n }\n outgoingConnections.get(sourceId)!.push(conn);\n\n if (!incomingConnections.has(targetId)) {\n incomingConnections.set(targetId, []);\n }\n incomingConnections.get(targetId)!.push(conn);\n });\n\n // Find starting activity (use startActivityId or no incoming connections, or first activity)\n let currentActivityId = localState.currentActivityId;\n if (!currentActivityId) {\n // Use startActivityId if available\n if (graph.startActivityId) {\n currentActivityId = graph.startActivityId;\n } else {\n // Find root activity (no incoming connections)\n for (const activity of activities) {\n if (!incomingConnections.has(activity.id)) {\n currentActivityId = activity.id;\n break;\n }\n }\n // If no root found, use first activity\n if (!currentActivityId && activities.length > 0) {\n currentActivityId = activities[0].id;\n }\n }\n }\n\n // Execute workflow steps\n while (currentActivityId) {\n const activity = activityMap.get(currentActivityId);\n if (!activity) {\n break;\n }\n\n // Skip if already completed\n if (localState.completedActivities.has(currentActivityId)) {\n // Move to next activity\n const nextId = this.getNextActivityId(\n currentActivityId,\n outgoingConnections,\n localState.activityResults\n );\n currentActivityId = nextId ?? undefined;\n continue;\n }\n\n // Get activity definition to retrieve executionMode and title\n console.log(`[WorkflowLocalEngine] 🔍 Getting activity definition for: ${activity.name}`);\n const activityDefinition = await this.activityDefinitionService.getActivityByName(activity.name);\n console.log(`[WorkflowLocalEngine] 📋 Activity definition:`, {\n name: activityDefinition?.name,\n type: activityDefinition?.type,\n executionMode: activityDefinition?.executionMode,\n title: activityDefinition?.title,\n found: !!activityDefinition,\n });\n \n const executionMode = activityDefinition?.executionMode || 'frontend';\n const activityTitle = activityDefinition?.title;\n\n // Handle backend activities: skip\n if (executionMode === 'backend') {\n console.log(\n `[WorkflowLocalEngine] ⏭️ Skipping backend activity: ${activity.name} (${activity.id})`\n );\n localState.completedActivities.add(currentActivityId);\n localState.activityResults.set(currentActivityId, {\n output: null,\n outcome: 'Done',\n });\n\n // Move to next activity\n const nextId = this.getNextActivityId(\n currentActivityId,\n outgoingConnections,\n localState.activityResults\n );\n currentActivityId = nextId ?? undefined;\n continue;\n }\n\n // Handle frontend/both activities: return as pendingTask (do NOT execute)\n if (executionMode === 'frontend' || executionMode === 'both') {\n // Create task for external execution\n // Note: Expression evaluation will be done by ActivityExecutor\n const task: AXPWorkflowTask = {\n taskToken: AXPDataGenerator.uuid(),\n activityId: activity.id,\n activityType: activity.name,\n activityName: activityTitle || undefined,\n executionMode: executionMode as 'frontend' | 'backend' | 'both',\n input: activity.inputs || {}, // Pass raw inputs - executor will evaluate\n };\n\n // Store task token for secure resume\n this.taskTokens.set(task.taskToken, {\n instanceId: localState.instanceId,\n activityId: activity.id,\n });\n\n // Update state to indicate suspension\n localState.currentActivityId = currentActivityId;\n localState.state.status = 'suspended';\n localState.state.currentStepId = currentActivityId;\n\n // Return task immediately - AXPWorkflowManager will execute it\n return task;\n }\n\n // Move to next activity\n const nextId = this.getNextActivityId(\n currentActivityId,\n outgoingConnections,\n localState.activityResults\n );\n currentActivityId = nextId ?? undefined;\n }\n\n // Workflow completed\n localState.state.status = 'completed';\n localState.state.output = localState.state.variables;\n localState.currentActivityId = undefined;\n\n return null;\n }\n\n /**\n * Get next activity ID based on connections and outcomes.\n */\n private getNextActivityId(\n currentActivityId: string,\n outgoingConnections: Map<string, AXPConnection[]>,\n activityResults: Map<string, { output: any; outcome?: string }>\n ): string | null {\n const connections = outgoingConnections.get(currentActivityId) || [];\n\n if (connections.length === 0) {\n return null; // No outgoing connections - workflow ends\n }\n\n // Get current activity result\n const result = activityResults.get(currentActivityId);\n const outcome = result?.outcome || 'Done';\n\n // Find connection matching outcome\n // Outcome matching is typically done via port name (e.g., \"Done\", \"Failed\")\n for (const conn of connections) {\n const sourcePort = conn.source.port || 'Done';\n if (sourcePort === outcome) {\n return conn.target.activtyName;\n }\n }\n\n // If no matching outcome, use first connection (default path)\n if (connections.length > 0) {\n return connections[0].target.activtyName;\n }\n\n return null;\n }\n\n async frontActivtyComplete(request: AXPFrontActivityCompleteRequest): Promise<AXPFrontActivityCompleteResponse> {\n const localState = this.instances.get(request.instanceId);\n if (!localState) {\n throw new Error(`Workflow instance not found: ${request.instanceId}`);\n }\n\n // Store activity result\n const outcome = request.outcome ?? 'Done';\n localState.activityResults.set(request.activityNode, {\n output: request.output || {},\n outcome,\n });\n localState.completedActivities.add(request.activityNode);\n\n // Store outputs for expression evaluation\n localState.state.activityOutputs = {\n ...(localState.state.activityOutputs || {}),\n [request.activityNode]: request.output || {},\n };\n localState.state.lastActivityOutput = request.output || {};\n\n // Merge output into workflow variables\n localState.state.variables = {\n ...localState.state.variables,\n ...(request.output || {}),\n };\n\n // Continue workflow progression\n const nextTask = await this.executeWorkflowSteps(localState);\n\n // Update state timestamp\n localState.state.lastUpdated = new Date();\n\n // Determine final status\n if (!nextTask && localState.state.status === 'running') {\n localState.state.status = 'completed';\n localState.state.output = localState.state.variables;\n }\n\n return {\n output: request.output || {},\n outcomes: { [outcome]: true },\n nextTask: nextTask || null,\n state: localState.state,\n };\n }\n\n\n //#endregion\n}\n\n","// Workflow Runtime Services\nexport * from './workflow-engine';\nexport * from './workflow-runtime.types';\nexport * from './workflow-manager.service';\nexport * from './workflow-local-engine';\nexport * from './activity-executor.service';\nexport * from './workflow-expression-scope.service';\nexport * from './workflow-engine';","//#region ---- Imports ----\n\nimport { inject, Injectable } from '@angular/core';\nimport { AXPWorkflowCategory } from './workflow-definition.provider';\nimport { AXPWorkflowDefinition } from '../workflow-definition.types';\nimport { AXP_WORKFLOW_CATEGORY_PROVIDER, AXP_WORKFLOW_PROVIDER } from './workflow-definition.provider';\n\n//#endregion\n\n/**\n * Optimized Workflow Definition Service\n * \n * Manages workflow definitions (metadata) for UI and tooling.\n * Similar to AXPActivityDefinitionService - only handles metadata, not execution.\n * \n * Performance optimizations:\n * 1. Uses childrenCount to determine if category has children (no query needed)\n * 2. Uses itemsCount to determine if category has workflows (no query needed)\n * 3. Aggressive caching prevents duplicate API calls\n * 4. Single pending request per resource prevents race conditions\n * 5. Lazy loading - only loads data when needed\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPWorkflowDefinitionService {\n //#region ---- Providers & Caches ----\n\n private readonly categoryProviders = inject(AXP_WORKFLOW_CATEGORY_PROVIDER, { optional: true }) || [];\n private readonly workflowProviders = inject(AXP_WORKFLOW_PROVIDER, { optional: true }) || [];\n\n //#endregion\n\n //#region ---- Cache Storage ----\n\n /** Cache for categories by id - O(1) lookup */\n private categoriesById = new Map<string, AXPWorkflowCategory>();\n\n /** Cache for categories by parentId - O(1) lookup */\n private categoriesByParentId = new Map<string | undefined, AXPWorkflowCategory[]>();\n\n /** Cache for workflow definitions by categoryId - O(1) lookup */\n private workflowsByCategory = new Map<string, AXPWorkflowDefinition[]>();\n\n /** Cache for individual workflow definitions by name - O(1) lookup */\n private workflowsByName = new Map<string, AXPWorkflowDefinition>();\n\n /** Track which provider index owns each category (by category ID) */\n private categoryOwnership = new Map<string, number>(); // Maps categoryId → provider index\n\n /** Pending API requests to prevent duplicate calls */\n private pendingCategoriesRequests = new Map<string | undefined, Promise<AXPWorkflowCategory[]>>();\n private pendingWorkflowsRequests = new Map<string, Promise<AXPWorkflowDefinition[]>>();\n private pendingWorkflowRequests = new Map<string, Promise<AXPWorkflowDefinition | undefined>>();\n\n //#endregion\n\n //#region ---- Public API: Categories ----\n\n /**\n * Get categories by parentId with aggressive caching\n * \n * Optimization: Returns cached result immediately if available,\n * preventing unnecessary API calls during navigation\n * \n * @param parentId - Parent category ID (undefined = root categories)\n * @returns Array of categories with count metadata (childrenCount, itemsCount)\n */\n async getCategories(parentId?: string): Promise<AXPWorkflowCategory[]> {\n // ✅ Fast path: Return cached result\n if (this.categoriesByParentId.has(parentId)) {\n return this.categoriesByParentId.get(parentId)!;\n }\n\n // ✅ Prevent duplicate requests: Return pending promise\n if (this.pendingCategoriesRequests.has(parentId)) {\n return this.pendingCategoriesRequests.get(parentId)!;\n }\n\n // ✅ Create single request and cache it\n const requestPromise = this.loadCategoriesFromProviders(parentId);\n this.pendingCategoriesRequests.set(parentId, requestPromise);\n\n return requestPromise;\n }\n\n /**\n * Get single category by ID with O(1) lookup\n * \n * Optimization: Uses Map for instant retrieval, falls back to\n * searching cache, then providers if not found\n */\n async getCategoryById(categoryId: string): Promise<AXPWorkflowCategory | undefined> {\n // ✅ Fast path: O(1) lookup in cache\n if (this.categoriesById.has(categoryId)) {\n return this.categoriesById.get(categoryId);\n }\n\n // ✅ Search in cached parent-child lists\n for (const categories of this.categoriesByParentId.values()) {\n const found = categories.find(cat => cat.id === categoryId);\n if (found) {\n this.categoriesById.set(categoryId, found);\n return found;\n }\n }\n\n // ✅ Load root categories if not loaded\n if (!this.categoriesByParentId.has(undefined)) {\n await this.getCategories();\n if (this.categoriesById.has(categoryId)) {\n return this.categoriesById.get(categoryId);\n }\n }\n\n // ✅ Breadth-first search through hierarchy\n return this.searchCategoryInHierarchy(categoryId);\n }\n\n /**\n * Get category path from root to specified category\n * \n * Optimization: Builds path using cached categories only\n */\n async getCategoriesPathById(categoryId: string): Promise<AXPWorkflowCategory[]> {\n const path: AXPWorkflowCategory[] = [];\n let currentCategoryId: string | undefined = categoryId;\n\n while (currentCategoryId) {\n const category = await this.getCategoryById(currentCategoryId);\n if (!category) {\n throw new Error(`Category '${currentCategoryId}' not found`);\n }\n path.unshift(category);\n currentCategoryId = category.parentId;\n }\n\n return path;\n }\n\n //#endregion\n\n //#region ---- Public API: Workflow Definitions ----\n\n /**\n * Get workflow definitions for a category with smart caching\n * \n * Optimization: Checks itemsCount before querying\n * - If itemsCount = 0, returns empty array (no API call)\n * - If itemsCount > 0, loads and caches workflow definitions\n * - Returns cached result on subsequent calls\n * \n * @param categoryId - Category ID to get workflow definitions from\n * @returns Array of workflow definitions\n */\n async getWorkflowsByCategoryId(categoryId: string): Promise<AXPWorkflowDefinition[]> {\n // ✅ Fast path: Return cached result\n if (this.workflowsByCategory.has(categoryId)) {\n return this.workflowsByCategory.get(categoryId)!;\n }\n\n // ✅ Smart optimization: Check itemsCount before querying\n const category = await this.getCategoryById(categoryId);\n if (category && category.itemsCount !== undefined && category.itemsCount === 0) {\n // Category has no workflows - cache empty array and skip API call\n const emptyArray: AXPWorkflowDefinition[] = [];\n this.workflowsByCategory.set(categoryId, emptyArray);\n return emptyArray;\n }\n\n // ✅ Prevent duplicate requests\n if (this.pendingWorkflowsRequests.has(categoryId)) {\n return this.pendingWorkflowsRequests.get(categoryId)!;\n }\n\n // ✅ Load from providers\n const requestPromise = this.loadWorkflowsFromProviders(categoryId);\n this.pendingWorkflowsRequests.set(categoryId, requestPromise);\n\n return requestPromise;\n }\n\n /**\n * Get single workflow definition by name with O(1) lookup\n * \n * Optimization: Uses Map for instant retrieval\n * \n * @param name - Workflow name (unique identifier)\n * @returns Workflow definition or undefined if not found\n */\n async getWorkflowByName(name: string): Promise<AXPWorkflowDefinition | undefined> {\n // ✅ Fast path: O(1) lookup in cache\n if (this.workflowsByName.has(name)) {\n return this.workflowsByName.get(name);\n }\n\n // ✅ Prevent duplicate requests\n if (this.pendingWorkflowRequests.has(name)) {\n return this.pendingWorkflowRequests.get(name)!;\n }\n\n // ✅ Load from providers\n const requestPromise = this.loadWorkflowFromProviders(name);\n this.pendingWorkflowRequests.set(name, requestPromise);\n\n return requestPromise;\n }\n\n /**\n * Get category ID containing a specific workflow definition\n * \n * Optimization: Searches cache first, loads on-demand if needed\n */\n async getCategoryIdByWorkflowName(workflowName: string): Promise<string | undefined> {\n // ✅ Search in cached workflow definitions\n for (const [categoryId, definitions] of this.workflowsByCategory.entries()) {\n if (definitions.some(def => def.name === workflowName)) {\n return categoryId;\n }\n }\n\n // ✅ Try loading the workflow definition to find its category\n // Note: AXPWorkflowDefinition doesn't have category field\n // Category is managed separately through category providers\n // This method searches through cached categories\n const definition = await this.getWorkflowByName(workflowName);\n if (definition) {\n // Search through all categories to find which one contains this workflow\n const categories = await this.getCategories();\n for (const category of categories) {\n const workflows = await this.getWorkflowsByCategoryId(category.id);\n if (workflows.some(w => w.name === workflowName)) {\n return category.id;\n }\n }\n }\n\n return undefined;\n }\n\n /**\n * Get category path for a workflow\n */\n async getCategoriesPathByWorkflowName(workflowName: string): Promise<AXPWorkflowCategory[]> {\n const categoryId = await this.getCategoryIdByWorkflowName(workflowName);\n if (!categoryId) {\n throw new Error(`Workflow '${workflowName}' not found in any category`);\n }\n return this.getCategoriesPathById(categoryId);\n }\n\n //#endregion\n\n //#region ---- Private: Data Loading ----\n\n /**\n * Load categories from providers and cache results\n * \n * Optimization: Tracks provider ownership to avoid unnecessary API calls\n * - For root (parentId = undefined): Query ALL providers\n * - For children: Only query the provider that owns the parent\n */\n private async loadCategoriesFromProviders(parentId?: string): Promise<AXPWorkflowCategory[]> {\n try {\n const resolvedProviders = await Promise.allSettled(this.categoryProviders);\n const categories: AXPWorkflowCategory[] = [];\n\n // Determine which provider(s) to query\n const providerIndicesToQuery = parentId\n ? this.getProviderIndexForCategory(parentId)\n : null; // Root: query all providers\n\n for (let i = 0; i < resolvedProviders.length; i++) {\n const p = resolvedProviders[i];\n\n // Skip if we have a specific provider index and this isn't it\n if (providerIndicesToQuery !== null && !providerIndicesToQuery.includes(i)) {\n continue;\n }\n\n if (p.status === 'fulfilled' && p.value && typeof p.value.getList === 'function') {\n try {\n const cats = await p.value.getList(parentId);\n if (Array.isArray(cats) && cats.length > 0) {\n categories.push(...cats);\n\n // ✅ Track ownership: This provider INDEX owns these categories\n cats.forEach(cat => this.categoryOwnership.set(cat.id, i));\n }\n } catch {\n // Continue on error - try other providers\n }\n }\n }\n\n // ✅ Cache results for fast subsequent access\n this.categoriesByParentId.set(parentId, categories);\n categories.forEach(cat => this.categoriesById.set(cat.id, cat));\n\n return categories;\n } finally {\n this.pendingCategoriesRequests.delete(parentId);\n }\n }\n\n /**\n * Get the provider index that owns a specific category\n * \n * @returns Array with provider index, or null if ownership unknown (query all)\n */\n private getProviderIndexForCategory(categoryId: string): number[] | null {\n const ownerIndex = this.categoryOwnership.get(categoryId);\n\n if (ownerIndex !== undefined) {\n return [ownerIndex];\n }\n\n // Ownership unknown - will query all providers (fallback)\n return null;\n }\n\n /**\n * Load workflow definitions from providers and cache results\n * \n * Optimization: Only queries the provider that owns the category\n * Uses provider INDEX to match category provider with workflow provider\n */\n private async loadWorkflowsFromProviders(categoryId: string): Promise<AXPWorkflowDefinition[]> {\n try {\n const resolvedProviders = await Promise.allSettled(this.workflowProviders);\n const definitions: AXPWorkflowDefinition[] = [];\n\n // ✅ Smart routing: Get provider INDEX that owns this category\n const ownerIndex = this.categoryOwnership.get(categoryId);\n const providerIndicesToQuery = ownerIndex !== undefined ? [ownerIndex] : null;\n\n for (let i = 0; i < resolvedProviders.length; i++) {\n const p = resolvedProviders[i];\n\n // Skip if we have a specific provider index and this isn't it\n if (providerIndicesToQuery !== null && !providerIndicesToQuery.includes(i)) {\n continue;\n }\n\n if (p.status === 'fulfilled' && p.value && typeof p.value.getList === 'function') {\n try {\n const defs = await p.value.getList(categoryId);\n if (Array.isArray(defs)) {\n definitions.push(...defs);\n }\n } catch {\n // Continue on error - try other providers\n }\n }\n }\n\n // ✅ Cache results for fast subsequent access\n this.workflowsByCategory.set(categoryId, definitions);\n definitions.forEach(def => {\n if (def.name) {\n this.workflowsByName.set(def.name, def);\n }\n });\n\n return definitions;\n } finally {\n this.pendingWorkflowsRequests.delete(categoryId);\n }\n }\n\n /**\n * Load single workflow definition from providers and cache result\n */\n private async loadWorkflowFromProviders(name: string): Promise<AXPWorkflowDefinition | undefined> {\n try {\n const resolvedProviders = await Promise.allSettled(this.workflowProviders);\n\n // Try providers first\n for (const p of resolvedProviders) {\n if (p.status === 'fulfilled' && p.value && typeof p.value.getByName === 'function') {\n try {\n const definition = await p.value.getByName(name);\n if (definition) {\n this.workflowsByName.set(name, definition);\n return definition;\n }\n } catch {\n // Continue on error\n }\n }\n }\n\n // Fallback: Search in cached workflow definitions\n for (const definitions of this.workflowsByCategory.values()) {\n const found = definitions.find(def => def.name === name);\n if (found) {\n this.workflowsByName.set(name, found);\n return found;\n }\n }\n\n return undefined;\n } finally {\n this.pendingWorkflowRequests.delete(name);\n }\n }\n\n /**\n * Breadth-first search through category hierarchy\n */\n private async searchCategoryInHierarchy(categoryId: string): Promise<AXPWorkflowCategory | undefined> {\n const searchQueue: (string | undefined)[] = [undefined];\n const searched = new Set<string | undefined>();\n\n while (searchQueue.length > 0) {\n const parentId = searchQueue.shift()!;\n if (searched.has(parentId)) continue;\n searched.add(parentId);\n\n const categories = await this.getCategories(parentId);\n const found = categories.find(cat => cat.id === categoryId);\n\n if (found) {\n return found;\n }\n\n // ✅ Optimization: Only search children if childrenCount > 0\n for (const category of categories) {\n if (category.childrenCount > 0 && !searched.has(category.id)) {\n searchQueue.push(category.id);\n }\n }\n }\n\n return undefined;\n }\n\n //#endregion\n\n //#region ---- Cache Management ----\n\n /**\n * Check if category has children (uses cached count)\n */\n categoryHasChildren(categoryId: string): boolean {\n const category = this.categoriesById.get(categoryId);\n return category ? category.childrenCount > 0 : false;\n }\n\n /**\n * Check if category has workflows (uses cached count)\n */\n categoryHasWorkflows(categoryId: string): boolean {\n const category = this.categoriesById.get(categoryId);\n return category ? (category.itemsCount ?? 0) > 0 : false;\n }\n\n /**\n * Clear all caches\n */\n clearAllCache(): void {\n this.categoriesById.clear();\n this.categoriesByParentId.clear();\n this.workflowsByCategory.clear();\n this.workflowsByName.clear();\n this.categoryOwnership.clear();\n this.pendingCategoriesRequests.clear();\n this.pendingWorkflowsRequests.clear();\n this.pendingWorkflowRequests.clear();\n }\n\n /**\n * Clear categories cache only\n */\n clearCategoriesCache(): void {\n this.categoriesById.clear();\n this.categoriesByParentId.clear();\n this.categoryOwnership.clear();\n this.pendingCategoriesRequests.clear();\n }\n\n /**\n * Clear workflows cache only\n */\n clearWorkflowsCache(): void {\n this.workflowsByCategory.clear();\n this.workflowsByName.clear();\n this.pendingWorkflowsRequests.clear();\n this.pendingWorkflowRequests.clear();\n }\n\n //#endregion\n}\n\n","// Workflow Definition Types (Storage/Database)\n// Export workflow definition types\nexport type {\n AXPWorkflowDefinition,\n AXPWorkflowGraph,\n AXPWorkflowActivityInstance,\n AXPConnection,\n AXPWorkflowDescriptorSchemaBase,\n AXPWorkflowDescriptorBase,\n AXPVariableDefinition,\n AXPWorkflowInputDescriptor,\n AXPWorkflowOutputDescriptor,\n AXPWorkflowExtensions,\n AXPElsaWorkflowExtensions,\n AXPWorkflowBinding,\n} from './workflow-definition.types';\n\n// Workflow Instance Types (Storage/Database)\nexport * from './workflow-instance.types';\n\n\n// Re-export Workflow Instance types\nexport type {\n AXPWorkflowInstance,\n AXPWorkflowState,\n AXPWorkflowStatus,\n AXPWorkflowSubStatus,\n AXPActivityStatus,\n AXPExceptionState,\n AXPActivityIncident,\n AXPWorkflowFaultState,\n AXPBookmark,\n AXPCompletionCallbackState,\n AXPActivityVariable,\n AXPActivityExecutionContextState,\n} from './workflow-instance.types';\n\n// Activity System Types (Simplified)\nexport * from './activity/activity.types';\n\nexport * from './activity';\n\n// Simple Runtime (Coordinator only)\nexport * from './runtime';\n\n// Workflow Definition System (Category + Metadata)\nexport * from './workflow/workflow-definition.provider';\nexport * from './workflow/workflow-definition.service';","import { Inject, ModuleWithProviders, NgModule, Optional, Type, inject } from '@angular/core';\nimport { AXPWorkflowDecideAction } from './actions/decide.action';\nimport { AXPStartWorkflowAction } from './actions/start-workflow.action';\nimport { AXPWorkflowRegistryService } from './workflow-registery.service';\nimport { AXPWorkflow, AXPWorkflowAction, AXPWorkflowFunction } from './workflow.types';\nimport { AXP_WORKFLOW_ENGINE, AXPWorkflowLocalEngine } from './engine';\nimport { AXPWorkflowManager } from './engine/runtime/workflow-manager.service';\nexport interface AXPWorkflowModuleConfigs {\n functions?: {\n [name: string]: Type<AXPWorkflowFunction>;\n };\n actions?: {\n [name: string]: Type<AXPWorkflowAction>;\n };\n workflows?: {\n [name: string]: AXPWorkflow;\n };\n}\n\n@NgModule({\n imports: [],\n exports: [],\n declarations: [],\n providers: [\n AXPWorkflowLocalEngine,\n {\n provide: AXP_WORKFLOW_ENGINE,\n useExisting: AXPWorkflowLocalEngine,\n },\n AXPWorkflowManager,\n ],\n})\nexport class AXPWorkflowModule {\n\n static forRoot(config?: AXPWorkflowModuleConfigs): ModuleWithProviders<AXPWorkflowModule> {\n return {\n ngModule: AXPWorkflowModule,\n providers: [\n {\n provide: 'AXPWorkflowModuleFactory',\n useFactory: (registry: AXPWorkflowRegistryService) => () => {\n registry.registerAction('start-workflow', AXPStartWorkflowAction);\n registry.registerAction('decide', AXPWorkflowDecideAction);\n //\n if (config?.functions) {\n for (const [key, type] of Object.entries(config.functions)) {\n registry.registerFunction(key, type);\n }\n }\n //\n if (config?.actions) {\n for (const [key, type] of Object.entries(config.actions)) {\n registry.registerAction(key, type);\n }\n }\n //\n if (config?.workflows) {\n for (const [key, type] of Object.entries(config.workflows)) {\n registry.registerWorkflow(key, type);\n }\n }\n },\n deps: [AXPWorkflowRegistryService],\n multi: true,\n },\n ...Object.values(config?.actions ?? { AXPStartWorkflowAction }),\n ...Object.values(config?.functions ?? {}),\n ],\n };\n }\n\n static forChild(config?: AXPWorkflowModuleConfigs): ModuleWithProviders<AXPWorkflowModule> {\n return {\n ngModule: AXPWorkflowModule,\n providers: [\n // Built-in activities are already registered in forRoot via @NgModule providers\n // No need to register again in forChild\n {\n provide: 'AXPWorkflowModuleFactory',\n useFactory: (registry: AXPWorkflowRegistryService) => () => {\n registry.registerAction('start-workflow', AXPStartWorkflowAction);\n registry.registerAction('decide', AXPWorkflowDecideAction);\n //\n if (config?.functions) {\n for (const [key, type] of Object.entries(config.functions)) {\n registry.registerFunction(key, type);\n }\n }\n //\n if (config?.actions) {\n for (const [key, type] of Object.entries(config.actions)) {\n registry.registerAction(key, type);\n }\n }\n //\n if (config?.workflows) {\n for (const [key, type] of Object.entries(config.workflows)) {\n registry.registerWorkflow(key, type);\n }\n }\n },\n deps: [AXPWorkflowRegistryService],\n multi: true,\n },\n ...Object.values(config?.actions ?? {}),\n ...Object.values(config?.functions ?? {}),\n ],\n };\n }\n\n /**\n * @ignore\n */\n constructor(@Optional() @Inject('AXPWorkflowModuleFactory') instances: any[]) {\n instances?.forEach((f) => {\n f();\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.AXPWorkflowRegistryService"],"mappings":";;;;;;;AAAM,MAAO,gBAAiB,SAAQ,KAAK,CAAA;IACvC,WAAA,CAAY,OAAe,EAAS,KAAA,GAAsB,IAAI,EAAA;QAC1D,KAAK,CAAC,OAAO,CAAC;QADkB,IAAA,CAAA,KAAK,GAAL,KAAK;AAErC,QAAA,IAAI,CAAC,IAAI,GAAG,kBAAkB;IAClC;AACH;;MCEY,uBAAuB,CAAA;AAHpC,IAAA,WAAA,GAAA;AAIU,QAAA,IAAA,CAAA,YAAY,GAAG,IAAI,OAAO,EAAoB;AASvD,IAAA;AAPC,IAAA,QAAQ,CAAC,KAAuB,EAAA;AAC9B,QAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;IAC/B;AAEA,IAAA,IAAI,OAAO,GAAA;AACT,QAAA,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE;IACzC;8GATW,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAvB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uBAAuB,cA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kB;AACnB,qBAAA;AACF,iBAAA;;0BAkFc;;0BAAY,MAAM;2BAAC,0BAA0B;;;ACjH5D;;AAEG;;;;"}
1
+ {"version":3,"file":"acorex-platform-workflow.mjs","sources":["../../../../libs/platform/workflow/src/lib/errors.types.ts","../../../../libs/platform/workflow/src/lib/workflow-event-dispatcher.service.ts","../../../../libs/platform/workflow/src/lib/workflow-registery.service.ts","../../../../libs/platform/workflow/src/lib/workflow.types.ts","../../../../libs/platform/workflow/src/lib/actions/decide.action.ts","../../../../libs/platform/workflow/src/lib/workflow.service.ts","../../../../libs/platform/workflow/src/lib/actions/start-workflow.action.ts","../../../../libs/platform/workflow/src/lib/engine/workflow-instance.types.ts","../../../../libs/platform/workflow/src/lib/engine/activity/activity.types.ts","../../../../libs/platform/workflow/src/lib/engine/activity/activity-definition.provider.ts","../../../../libs/platform/workflow/src/lib/engine/activity/activity-definition.service.ts","../../../../libs/platform/workflow/src/lib/engine/runtime/workflow-engine.ts","../../../../libs/platform/workflow/src/lib/engine/runtime/workflow-expression-scope.service.ts","../../../../libs/platform/workflow/src/lib/engine/runtime/activity-executor.service.ts","../../../../libs/platform/workflow/src/lib/engine/runtime/workflow-manager.service.ts","../../../../libs/platform/workflow/src/lib/engine/workflow/workflow-definition.provider.ts","../../../../libs/platform/workflow/src/lib/engine/runtime/workflow-local-engine.ts","../../../../libs/platform/workflow/src/lib/engine/runtime/index.ts","../../../../libs/platform/workflow/src/lib/engine/workflow/workflow-definition.service.ts","../../../../libs/platform/workflow/src/lib/engine/index.ts","../../../../libs/platform/workflow/src/lib/workflow.module.ts","../../../../libs/platform/workflow/src/acorex-platform-workflow.ts"],"sourcesContent":["export class AXPWorkflowError extends Error {\n constructor(message: string, public inner: Error | null = null) {\n super(message);\n this.name = 'AXPWorkflowError';\n }\n}","import { Injectable } from '@angular/core';\nimport { Observable, Subject } from 'rxjs';\nimport { AXPWorkflowEvent } from './workflow.types';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPWorkflowEventService {\n private eventSubject = new Subject<AXPWorkflowEvent>();\n\n dispatch(event: AXPWorkflowEvent): void {\n this.eventSubject.next(event);\n }\n\n get events$(): Observable<AXPWorkflowEvent> {\n return this.eventSubject.asObservable();\n }\n}\n","import { Injectable, Type } from '@angular/core';\nimport { AXPWorkflow, AXPWorkflowAction, AXPWorkflowFunction, AXPWorkflowStep } from './workflow.types';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPWorkflowRegistryService {\n private functionsMap = new Map<string, Type<AXPWorkflowFunction>>();\n private actionsMap = new Map<string, Type<AXPWorkflowAction>>();\n private workflowsMap = new Map<string, AXPWorkflow>();\n\n registerWorkflow(name: string, workflow: AXPWorkflow): void {\n this.workflowsMap.set(name, workflow);\n }\n\n getWorkflow(name: string): AXPWorkflow | undefined {\n return this.workflowsMap.get(name);\n }\n\n registerAction(name: string, action: Type<AXPWorkflowAction>): void {\n this.actionsMap.set(name, action);\n }\n\n getAction(name: string): Type<AXPWorkflowAction> | undefined {\n return this.actionsMap.get(name);\n }\n\n registerFunction(name: string, func: Type<AXPWorkflowFunction>): void {\n this.functionsMap.set(name, func);\n }\n\n getFunction(name: string): Type<AXPWorkflowFunction> | undefined {\n return this.functionsMap.get(name);\n }\n\n getFunctionNames(): string[] {\n return Array.from(this.functionsMap.keys());\n }\n\n getStep(workflowName: string, stepName: string): AXPWorkflowStep | undefined {\n const workflow = this.workflowsMap.get(workflowName);\n if (workflow) {\n const steps = workflow.steps as { [key: string]: AXPWorkflowStep };\n return steps[stepName];\n }\n return undefined;\n }\n\n updateStepInWorkflow(workflowName: string, stepName: string, step: AXPWorkflowStep): void {\n const workflow = this.workflowsMap.get(workflowName);\n if (workflow) {\n const steps = workflow.steps as { [key: string]: AXPWorkflowStep };\n if (steps[stepName]) {\n steps[stepName] = step;\n } else {\n throw new Error(`Step with name ${stepName} does not exist in workflow ${workflowName}.`);\n }\n } else {\n throw new Error(`Workflow with name ${workflowName} does not exist.`);\n }\n }\n\n addStepToWorkflow(workflowName: string, stepName: string, step: AXPWorkflowStep): void {\n const workflow = this.workflowsMap.get(workflowName);\n if (workflow) {\n const steps = workflow.steps as { [key: string]: AXPWorkflowStep };\n if (!steps[stepName]) {\n steps[stepName] = step;\n } else {\n throw new Error(`Step with name ${stepName} already exists in workflow ${workflowName}.`);\n }\n } else {\n throw new Error(`Workflow with name ${workflowName} does not exist.`);\n }\n }\n\n addAfterStep(\n workflowId: string,\n stepId: string,\n newStepId: string,\n newStepAction: string,\n conditionExpression: string\n ): void {\n const step = this.getStep(workflowId, stepId);\n if (step != undefined) {\n this.addStepToWorkflow(workflowId, newStepId, {\n action: newStepAction,\n nextSteps: step.nextSteps,\n });\n\n this.updateStepInWorkflow(workflowId, stepId, {\n ...step,\n nextSteps: [\n {\n conditions: [{ type: 'SINGLE', expression: conditionExpression }],\n nextStepId: newStepId,\n },\n ],\n });\n }\n }\n}\n","import { Injectable, inject } from '@angular/core';\nimport { filter } from 'rxjs';\nimport { AXPWorkflowEventService } from './workflow-event-dispatcher.service';\nimport { cloneDeep, get } from 'lodash-es';\nimport { setSmart } from '@acorex/platform/core';\n\nexport interface AXPWorkflow {\n steps: { [stepName: string]: AXPWorkflowStep };\n startStepId: string;\n}\n\n\nexport class AXPWorkflowContext {\n\n constructor(initialData: any = {}) {\n this.variables = cloneDeep(initialData);\n }\n\n private variables: any = {};\n private stepOutputs: Map<string, any> = new Map();\n\n setVariable(key: string, value: any): void {\n setSmart(this.variables, key, value);\n }\n\n\n setVariables(context: any = {}) {\n this.variables = { ...this.variables, ...context };\n }\n\n getVariable<T = any>(key?: string | null): T {\n return !key ? this.variables : get(this.variables, key);\n }\n\n setOutput(key: string, output: any): void {\n this.stepOutputs.set(key, output);\n }\n\n setOutputs(values: Map<string, any>): void {\n this.stepOutputs = new Map([...this.stepOutputs, ...values])\n }\n\n getOutput<T = any>(key: string): T {\n return this.stepOutputs.get(key);\n }\n}\n\nexport type AXPWorkflowActionInput = any;\n\nexport type AXPWorkflowConditionType = 'AND' | 'OR' | 'SINGLE';\n\nexport interface AXPWorkflowCondition {\n type: AXPWorkflowConditionType;\n conditions?: AXPWorkflowCondition[]; // Nested conditions\n expression?: string; // Used if type is 'SINGLE'\n}\n\nexport interface AXPWorkflowNextStep {\n conditions: AXPWorkflowCondition[];\n nextStepId: string;\n}\n\nexport interface AXPWorkflowStep {\n id?: string;\n action: AXPWorkflowAction | string;\n input?: AXPWorkflowActionInput;\n nextSteps?: AXPWorkflowNextStep[];\n conditions?: AXPWorkflowCondition[];\n}\n@Injectable()\nexport abstract class AXPWorkflowAction {\n private eventService = inject(AXPWorkflowEventService);\n\n protected dispatch(event: AXPWorkflowEvent): void {\n this.eventService.dispatch(event);\n }\n\n abstract execute(context: AXPWorkflowContext): Promise<void>;\n}\n\n@Injectable()\nexport abstract class AXPWorkflowFunction {\n abstract execute(...args: any[]): Promise<any> | any;\n}\n\nexport interface AXPWorkflowEvent<T = any> {\n type: string;\n payload?: T;\n}\n\n\n\nexport function createWorkFlowEvent<T>(type: string) {\n const eventCreator = (payload: T) => ({ type, payload });\n eventCreator.type = type;\n return eventCreator;\n}\n\nexport function ofType<T extends { type: string }>(...allowedTypes: Array<{ type: string }>) {\n return filter((event: T) => allowedTypes.some((type) => event.type === type.type));\n}\n","import { Injectable } from \"@angular/core\";\nimport { AXPWorkflowAction, AXPWorkflowContext } from \"../workflow.types\";\n\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPWorkflowDecideAction extends AXPWorkflowAction {\n async execute(context: AXPWorkflowContext): Promise<void> {\n // its a fake action\n }\n}","import { Injectable, Injector, inject } from '@angular/core';\nimport { cloneDeep, set } from 'lodash-es';\nimport { Observable } from 'rxjs';\nimport { AXPWorkflowError } from './errors.types';\nimport { AXPWorkflowEventService } from './workflow-event-dispatcher.service';\nimport { AXPWorkflowRegistryService } from './workflow-registery.service';\nimport {\n AXPWorkflow,\n AXPWorkflowAction,\n AXPWorkflowCondition,\n AXPWorkflowContext,\n AXPWorkflowEvent,\n AXPWorkflowFunction,\n AXPWorkflowNextStep,\n AXPWorkflowStep,\n} from './workflow.types';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPWorkflowService {\n private eventService = inject(AXPWorkflowEventService);\n\n get events$(): Observable<AXPWorkflowEvent> {\n return this.eventService.events$;\n }\n\n constructor(private registryService: AXPWorkflowRegistryService, private injector: Injector) { }\n\n exists(name: string): boolean {\n return !!this.registryService.getWorkflow(name);\n }\n\n\n async execute(\n workflow: AXPWorkflow | string,\n initialContext: AXPWorkflowContext | any | null = null\n ): Promise<AXPWorkflowContext> {\n // Instantiate or retrieve the workflow\n const wk = typeof workflow === 'string' ? this.getWorkflowInstance(workflow) : workflow;\n\n let currentStepId = wk.startStepId;\n const context =\n initialContext instanceof AXPWorkflowContext\n ? initialContext\n : new AXPWorkflowContext(this.processData(initialContext) ?? {});\n // Initialize context with initial variables\n\n while (currentStepId) {\n const currentStep = wk.steps[currentStepId];\n if (!currentStep) {\n throw new AXPWorkflowError(`Step '${currentStepId}' not found in the workflow steps.`);\n }\n\n // Instantiate or retrieve the action\n const action =\n typeof currentStep.action === 'string' ? this.getActionInstance(currentStep.action) : currentStep.action;\n //\n if (currentStep.input) {\n let inputs: any = {};\n await this.processInputs(cloneDeep(currentStep.input), inputs, '', context);\n await new Promise((resolve) =>\n setTimeout(async () => {\n Object.assign(action, inputs);\n resolve(0);\n })\n );\n }\n try {\n await new Promise((resolve) =>\n setTimeout(async () => {\n await action.execute(context);\n resolve(0);\n }, 0)\n );\n } catch (error) {\n console.error(error);\n throw new AXPWorkflowError('Workflow Error', error as Error);\n }\n // Determine the next step based on the conditions\n const nextStepInfo = await this.determineNextStep(currentStep, context);\n if (nextStepInfo) {\n currentStepId = nextStepInfo.nextStepId;\n } else {\n break; // Exit the loop if no next step is determined\n }\n }\n return context;\n }\n\n private processData(initialContext: any): any {\n //TODO: update values with expressions and return new object\n return initialContext;\n }\n\n\n\n private getActionInstance(actionName: string): AXPWorkflowAction {\n const actionType = this.registryService.getAction(actionName);\n if (!actionType) {\n throw new AXPWorkflowError(`Action type '${actionName}' not found in the registry.`);\n }\n return this.injector.get(actionType);\n }\n\n private getWorkflowInstance(workflowName: string): AXPWorkflow {\n const workflowType = this.registryService.getWorkflow(workflowName);\n if (!workflowType) {\n throw new AXPWorkflowError(`Workflow type '${workflowName}' not found in the registry.`);\n }\n return workflowType;\n }\n\n private async determineNextStep(\n currentStep: AXPWorkflowStep,\n context: AXPWorkflowContext\n ): Promise<AXPWorkflowNextStep | null> {\n if (!currentStep.nextSteps) {\n return null;\n }\n for (const nextStep of currentStep.nextSteps) {\n if (await this.evaluateCondition(nextStep.conditions, context)) {\n return nextStep;\n }\n }\n return null;\n }\n\n private async evaluateCondition(conditions: AXPWorkflowCondition[], context: AXPWorkflowContext): Promise<boolean> {\n if (!conditions || conditions.length === 0) {\n return true; // If no conditions, the step proceeds\n }\n\n // Map each condition to a promise using evaluateSingleCondition\n const conditionPromises = conditions.map((condition) => this.evaluateSingleCondition(condition, context));\n\n // Wait for all promises to resolve\n const results = await Promise.all(conditionPromises);\n\n // Check if every condition is true\n return results.every((result) => result);\n }\n\n private async evaluateSingleCondition(\n condition: AXPWorkflowCondition,\n context: AXPWorkflowContext\n ): Promise<boolean> {\n switch (condition.type) {\n case 'SINGLE':\n return (!condition.expression ? true : await this.evaluateExpression(condition.expression, context)) as boolean;\n case 'AND':\n // Evaluate all conditions with 'AND' logic\n const andConditions = condition.conditions ?? [];\n const andResults = await Promise.all(andConditions.map((cond) => this.evaluateSingleCondition(cond, context)));\n return andResults.every((result) => result);\n\n case 'OR':\n // Evaluate all conditions with 'OR' logic\n const orConditions = condition.conditions ?? [];\n const orResults = await Promise.all(orConditions.map((cond) => this.evaluateSingleCondition(cond, context)));\n return orResults.some((result) => result);\n\n default:\n throw new AXPWorkflowError(`Unsupported condition type: ${condition.type}`);\n }\n }\n\n //TODO: return any and recursively update object, update scopes\n private async evaluateExpression(templateExpression: string, context: AXPWorkflowContext): Promise<Boolean> {\n try {\n let expression = '';\n if (typeof templateExpression === 'string' && templateExpression.trim().includes('{{')) {\n const expressionMatch = templateExpression.match(/\\{\\{\\s*(.*?)\\s*\\}\\}/);\n if (!expressionMatch) {\n throw Error(`No valid expression found in \"${templateExpression}\"`);\n }\n expression = expressionMatch[1];\n } else {\n expression = templateExpression;\n }\n // Create a scope that includes context and registered functions\n const scope = { context, ...this.createFunctionScope() };\n // Evaluating the expression within the created scope\n const sandbox = new Function('scope', `return (async function() { with (scope) { return ${expression}; } })();`);\n const result = await sandbox(scope);\n return result;\n } catch (error) {\n console.error('Error evaluating expression:', error);\n return false;\n }\n }\n\n private async processInputs(obj: any, inputs: any, pathPrefix: string = '', context: any = {}): Promise<void> {\n if (!obj) {\n return;\n }\n\n for await (const i of Object.entries(obj)) {\n const key = i[0];\n const value = i[1];\n const currentPath = pathPrefix ? `${pathPrefix}.${key}` : key;\n if (typeof value === 'string' && value.trim().includes('{{')) {\n const expValue = await this.evaluateExpression(value, context);\n set(inputs, currentPath, expValue);\n } else if (\n typeof value === 'object' &&\n value !== null &&\n (value.constructor === Object || Array.isArray(value))\n ) {\n // Recursively handle nested objects\n this.processInputs(value, inputs, currentPath, context);\n } else {\n // Apply static values directly\n set(inputs, currentPath, value);\n }\n }\n }\n\n private createFunctionScope(): any {\n const scope: any = {};\n this.registryService.getFunctionNames().forEach((name) => {\n scope[name] = this.getFunctionInstance(name).execute;\n });\n return { methods: { scope } };\n }\n\n private getFunctionInstance(functionName: string): AXPWorkflowFunction {\n const functionType = this.registryService.getFunction(functionName);\n if (!functionType) {\n throw new AXPWorkflowError(`Function type '${functionName}' not found in the registry.`);\n }\n return this.injector.get(functionType);\n }\n}\n","import { inject, Injectable } from \"@angular/core\";\nimport { AXPWorkflowAction, AXPWorkflowContext } from \"../workflow.types\";\nimport { AXPWorkflowService } from \"../workflow.service\";\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPStartWorkflowAction extends AXPWorkflowAction {\n\n private workflowService = inject(AXPWorkflowService)\n private workflow: string;\n private context: any;\n\n async execute(context: AXPWorkflowContext): Promise<void> {\n //console.log(\"start WK current context\", context);\n //console.log(\"start WK input context\", this.context);\n if (this.context)\n context.setVariables(this.context)\n //console.log(\"start WK merged context\", context);\n try {\n await this.workflowService.execute(this.workflow, context);\n }\n catch (e: unknown) {\n throw e;\n }\n\n }\n}\n\n","// ============================================\n// WORKFLOW INSTANCE v3.0.0 TYPES\n// Based on Elsa Workflow Instance schema: https://elsaworkflows.io/schemas/workflow-instance/v3.0.0/schema.json\n// Compatible with Elsa backend while using ACoreX naming conventions\n// ============================================\n\n/**\n * Workflow status.\n */\nexport type AXPWorkflowStatus = 'Running' | 'Finished';\n\n/**\n * Workflow sub-status.\n */\nexport type AXPWorkflowSubStatus = 'Pending' | 'Executing' | 'Suspended' | 'Finished' | 'Cancelled' | 'Faulted';\n\n/**\n * Activity status.\n */\nexport type AXPActivityStatus = 'Running' | 'Completed' | 'Canceled' | 'Faulted';\n\n/**\n * Exception state.\n */\nexport interface AXPExceptionState {\n /**\n * Exception type name.\n */\n type: string;\n\n /**\n * Exception message.\n */\n message: string;\n\n /**\n * Stack trace (nullable).\n */\n stackTrace?: string | null;\n\n /**\n * Inner exception (nullable).\n */\n innerException?: AXPExceptionState | null;\n}\n\n/**\n * Activity incident.\n */\nexport interface AXPActivityIncident {\n /**\n * Activity ID that caused the incident.\n */\n activityId: string;\n\n /**\n * Activity node ID.\n */\n activityNodeId: string;\n\n /**\n * Activity type.\n */\n activityType: string;\n\n /**\n * Incident message.\n */\n message: string;\n\n /**\n * Exception (nullable).\n */\n exception?: AXPExceptionState | null;\n\n /**\n * Timestamp (ISO date-time).\n */\n timestamp: string;\n}\n\n/**\n * Workflow fault state.\n */\nexport interface AXPWorkflowFaultState {\n /**\n * Exception (nullable).\n */\n exception?: AXPExceptionState | null;\n\n /**\n * Fault message.\n */\n message: string;\n\n /**\n * Faulted activity ID (nullable).\n */\n faultedActivityId?: string | null;\n}\n\n/**\n * Bookmark.\n */\nexport interface AXPBookmark {\n /**\n * Bookmark ID.\n */\n id: string;\n\n /**\n * Bookmark name.\n */\n name: string;\n\n /**\n * Bookmark hash.\n */\n hash: string;\n\n /**\n * Bookmark payload (nullable).\n */\n payload?: any | null;\n\n /**\n * Activity node ID.\n */\n activityNodeId: string;\n\n /**\n * Activity instance ID.\n */\n activityInstanceId: string;\n\n /**\n * Auto burn flag.\n */\n autoBurn?: boolean;\n\n /**\n * Callback method name (nullable).\n */\n callbackMethodName?: string | null;\n\n /**\n * Metadata (nullable).\n */\n metadata?: Record<string, string> | null;\n}\n\n/**\n * Completion callback state.\n */\nexport interface AXPCompletionCallbackState {\n /**\n * Owner activity instance ID.\n */\n ownerInstanceId: string;\n\n /**\n * Child activity node ID.\n */\n childNodeId: string;\n\n /**\n * Method name (nullable).\n */\n methodName?: string | null;\n}\n\n/**\n * Variable (for activity context).\n */\nexport interface AXPActivityVariable {\n /**\n * Variable ID.\n */\n id: string;\n\n /**\n * Variable name.\n */\n name: string;\n\n /**\n * Type name.\n */\n typeName: string;\n\n /**\n * Is array flag.\n */\n isArray?: boolean;\n\n /**\n * Variable value (nullable).\n */\n value?: any | null;\n\n /**\n * Storage driver type name (nullable).\n */\n storageDriverTypeName?: string | null;\n}\n\n/**\n * Activity execution context state.\n */\nexport interface AXPActivityExecutionContextState {\n /**\n * Context ID (activity instance ID).\n */\n id: string;\n\n /**\n * Parent context ID (nullable).\n */\n parentContextId?: string | null;\n\n /**\n * Scheduled activity node ID.\n */\n scheduledActivityNodeId: string;\n\n /**\n * Owner activity node ID (nullable).\n */\n ownerActivityNodeId?: string | null;\n\n /**\n * Properties bag.\n */\n properties: Record<string, any>;\n\n /**\n * Activity state (evaluated properties) (nullable).\n */\n activityState?: Record<string, any> | null;\n\n /**\n * Dynamic variables.\n */\n dynamicVariables: AXPActivityVariable[];\n\n /**\n * Activity status.\n */\n status: AXPActivityStatus;\n\n /**\n * Is executing flag.\n */\n isExecuting: boolean;\n\n /**\n * Fault count.\n */\n faultCount: number;\n\n /**\n * Started at timestamp (ISO date-time).\n */\n startedAt: string;\n\n /**\n * Completed at timestamp (ISO date-time, nullable).\n */\n completedAt?: string | null;\n\n /**\n * Tag (nullable).\n */\n tag?: any | null;\n}\n\n/**\n * Workflow state (internal execution state).\n */\nexport interface AXPWorkflowState {\n /**\n * State ID.\n */\n id: string;\n\n /**\n * Workflow definition ID.\n */\n definitionId: string;\n\n /**\n * Workflow definition version.\n */\n definitionVersion: number;\n\n /**\n * Correlation ID (nullable).\n */\n correlationId?: string | null;\n\n /**\n * Workflow status.\n */\n status: AXPWorkflowStatus;\n\n /**\n * Workflow sub-status.\n */\n subStatus: AXPWorkflowSubStatus;\n\n /**\n * Bookmarks.\n */\n bookmarks: AXPBookmark[];\n\n /**\n * Incidents.\n */\n incidents: AXPActivityIncident[];\n\n /**\n * Fault (nullable).\n */\n fault?: AXPWorkflowFaultState | null;\n\n /**\n * Completion callbacks.\n */\n completionCallbacks: AXPCompletionCallbackState[];\n\n /**\n * Activity execution contexts.\n */\n activityExecutionContexts: AXPActivityExecutionContextState[];\n\n /**\n * Input data.\n */\n input: Record<string, any>;\n\n /**\n * Output data.\n */\n output: Record<string, any>;\n\n /**\n * Properties bag.\n */\n properties: Record<string, any>;\n\n /**\n * Created at timestamp (ISO date-time).\n */\n createdAt: string;\n\n /**\n * Updated at timestamp (ISO date-time).\n */\n updatedAt: string;\n\n /**\n * Finished at timestamp (ISO date-time, nullable).\n */\n finishedAt?: string | null;\n\n /**\n * Total number of activities/steps in the workflow (for progress display).\n */\n totalSteps?: number;\n}\n\n/**\n * Workflow instance (stored in database).\n * This matches the Elsa Workflow Instance schema for backend compatibility.\n */\nexport interface AXPWorkflowInstance {\n /**\n * Schema reference.\n */\n $schema?: string;\n\n /**\n * Unique instance ID.\n */\n id: string;\n\n /**\n * Workflow definition ID.\n */\n definitionId: string;\n\n /**\n * Workflow definition version ID.\n */\n definitionVersionId: string;\n\n /**\n * Workflow definition version number.\n */\n version: number;\n\n /**\n * Parent workflow instance ID (nullable, for child workflows).\n */\n parentWorkflowInstanceId?: string | null;\n\n /**\n * Workflow state (internal execution state).\n */\n workflowState: AXPWorkflowState;\n\n /**\n * Workflow status.\n */\n status: AXPWorkflowStatus;\n\n /**\n * Workflow sub-status.\n */\n subStatus: AXPWorkflowSubStatus;\n\n /**\n * Correlation ID (nullable).\n */\n correlationId?: string | null;\n\n /**\n * Instance name (nullable).\n */\n name?: string | null;\n\n /**\n * Incident count.\n */\n incidentCount: number;\n\n /**\n * Created at timestamp (ISO date-time).\n */\n createdAt: string;\n\n /**\n * Updated at timestamp (ISO date-time).\n */\n updatedAt: string;\n\n /**\n * Finished at timestamp (ISO date-time, nullable).\n */\n finishedAt?: string | null;\n\n /**\n * Entity reference ID (for linking workflow instances to business entities).\n */\n entityRefId?: string | null;\n\n /**\n * Entity reference type (e.g., 'HumanCapitalManagement.LeaveRequest').\n */\n entityRefType?: string | null;\n}\n\n","import type { AXPProperty } from '@acorex/platform/core';\nimport { AXPCategoryEntity, AXPMultiLanguageString } from '@acorex/platform/core';\nimport type { AXPWorkflowOutputProperty } from '../workflow-definition.types';\n\n// ============================================\n// SIMPLIFIED ACTIVITY SYSTEM\n// ============================================\n\n/**\n * Type of task for inbox handling.\n * - 'human-task': Requires inbox - needs human interaction\n * - 'ui-activity': UI-only activity (no inbox) - immediate execution\n * - 'system-activity': System/backend activity (no inbox) - automated execution\n */\nexport type AXPTaskType = 'human-task' | 'ui-activity' | 'system-activity';\n\n/**\n * Activity Category - Extends AXPCategoryEntity for consistency and performance\n * \n * Inherited properties from AXPCategoryEntity:\n * - id: string - Unique identifier\n * - title: string - Display name\n * - description?: string - Category description\n * - parentId?: string - Parent category ID\n * - childrenCount: number - Direct child categories count (enables lazy loading)\n * - itemsCount?: number - Direct activities count\n * - totalChildrenCount?: number - Total nested categories (optional, for analytics)\n * - totalItemsCount?: number - Total activities in tree (optional, for analytics)\n */\nexport interface AXPActivityCategory extends AXPCategoryEntity {\n // No additional properties needed - all inherited from AXPCategoryEntity\n // Use: childrenCount instead of hasChild\n // Use: itemsCount instead of hasActivity\n}\n\n/**\n * Activity Definition - Metadata for UI and tooling.\n * Contains all metadata needed for displaying activities in toolbox and designer.\n * The `name` property is used as the command key for execution.\n */\nexport interface AXPActivityDefinition {\n /**\n * Activity name - used as command key for execution.\n * This is the unique identifier for the activity.\n */\n name: string;\n \n /**\n * Activity type (e.g., \"workflow-activity:check-permission\").\n */\n type: string;\n \n /**\n * Display name for UI (plain or per-locale map).\n */\n title?: AXPMultiLanguageString;\n \n /**\n * Description of what the activity does (plain or per-locale map).\n */\n description?: AXPMultiLanguageString;\n \n /**\n * Category for grouping in toolbox.\n */\n category?: string;\n \n /**\n * Icon name or class.\n */\n icon?: string;\n \n /**\n * Where this activity should be executed.\n * - 'frontend': Execute in browser (UI activities, console, events)\n * - 'backend': Execute in backend (business logic, API calls)\n * - 'both': Execute in both frontend and backend (hybrid activities)\n * \n * Default: 'frontend'\n */\n executionMode?: 'frontend' | 'backend' | 'both';\n \n /**\n * Type of task for inbox handling.\n * - 'human-task': Requires inbox - needs human interaction\n * - 'ui-activity': UI-only activity (no inbox) - immediate execution\n * - 'system-activity': System/backend activity (no inbox) - automated execution\n * \n * Default: 'ui-activity' (for backward compatibility)\n */\n taskType?: AXPTaskType;\n \n /**\n * Input properties (form/schema for activity parameters).\n */\n inputs?: AXPProperty[];\n\n /**\n * Output properties (result shape + optional path/metadata).\n */\n outputs?: AXPWorkflowOutputProperty[];\n \n /**\n * Static outcomes (exit points).\n * Example: ['Done', 'Success', 'Failed']\n */\n outcomes?: string[];\n\n /**\n * Whether this activity is browsable in the toolbox.\n * Default: true\n */\n isBrowsable?: boolean;\n \n /**\n * Whether this activity is a container (can have children).\n * Default: false\n */\n isContainer?: boolean;\n}\n\n// Note:\n// Previous versions defined dedicated activity result/command types here\n// (AXPActivityResult / AXPActivity) that wrapped output and outcome.\n// Activities are now modeled directly as AXPCommand with outcome stored in\n// AXPExecuteCommandResult.metadata.outcome.\n\n","import { InjectionToken } from '@angular/core';\nimport { AXPActivityCategory, AXPActivityDefinition } from './activity.types';\n\nexport type AXPActivityProviderToken =\n | AXPActivityProvider\n | Promise<AXPActivityProvider>;\n\nexport const AXP_ACTIVITY_PROVIDER = new InjectionToken<AXPActivityProviderToken[]>('AXP_ACTIVITY_PROVIDER', {\n factory: () => [],\n});\n\nexport interface AXPActivityProvider {\n /**\n * Get list of activity definitions for a category.\n * @param categoryId - Category ID to filter activities\n * @returns Promise of activity definitions array\n */\n getList(categoryId: string): Promise<AXPActivityDefinition[]>;\n \n /**\n * Get activity definition by name (unique identifier).\n * The name is used as the command key for execution.\n * @param name - Activity name (unique identifier and command key)\n * @returns Promise of activity definition or undefined if not found\n */\n getById(name: string): Promise<AXPActivityDefinition | undefined>;\n}\n\nexport type AXPActivityCategoryProviderToken =\n | AXPActivityCategoryProvider\n | Promise<AXPActivityCategoryProvider>;\n\nexport const AXP_ACTIVITY_CATEGORY_PROVIDER = new InjectionToken<AXPActivityCategoryProviderToken[]>('AXP_ACTIVITY_CATEGORY_PROVIDER', {\n factory: () => [],\n});\n\nexport interface AXPActivityCategoryProvider {\n getList(parentId?: string): Promise<AXPActivityCategory[]>;\n getById(id: string): Promise<AXPActivityCategory | undefined>;\n}\n\n","//#region ---- Imports ----\n\nimport { inject, Injectable } from '@angular/core';\nimport { AXPActivityCategory, AXPActivityDefinition } from './activity.types';\nimport { AXP_ACTIVITY_CATEGORY_PROVIDER, AXP_ACTIVITY_PROVIDER } from './activity-definition.provider';\n\n//#endregion\n\n/**\n * Optimized Activity Definition Service\n * \n * Manages activity definitions (metadata) for UI and tooling.\n * Similar to AXPReportDefinitionService - only handles metadata, not execution.\n * \n * Performance optimizations:\n * 1. Uses childrenCount to determine if category has children (no query needed)\n * 2. Uses itemsCount to determine if category has activities (no query needed)\n * 3. Aggressive caching prevents duplicate API calls\n * 4. Single pending request per resource prevents race conditions\n * 5. Lazy loading - only loads data when needed\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPActivityDefinitionService {\n //#region ---- Providers & Caches ----\n\n private readonly categoryProviders = inject(AXP_ACTIVITY_CATEGORY_PROVIDER, { optional: true }) || [];\n private readonly activityProviders = inject(AXP_ACTIVITY_PROVIDER, { optional: true }) || [];\n\n //#endregion\n\n //#region ---- Cache Storage ----\n\n /** Cache for categories by id - O(1) lookup */\n private categoriesById = new Map<string, AXPActivityCategory>();\n\n /** Cache for categories by parentId - O(1) lookup */\n private categoriesByParentId = new Map<string | undefined, AXPActivityCategory[]>();\n\n /** Cache for activity definitions by categoryId - O(1) lookup */\n private activitiesByCategory = new Map<string, AXPActivityDefinition[]>();\n\n /** Cache for individual activity definitions by name - O(1) lookup */\n private activitiesByName = new Map<string, AXPActivityDefinition>();\n\n /** Track which provider index owns each category (by category ID) */\n private categoryOwnership = new Map<string, number>(); // Maps categoryId → provider index\n\n /** Pending API requests to prevent duplicate calls */\n private pendingCategoriesRequests = new Map<string | undefined, Promise<AXPActivityCategory[]>>();\n private pendingActivitiesRequests = new Map<string, Promise<AXPActivityDefinition[]>>();\n private pendingActivityRequests = new Map<string, Promise<AXPActivityDefinition | undefined>>();\n\n //#endregion\n\n //#region ---- Initialization ----\n\n\n //#endregion\n\n //#region ---- Public API: Categories ----\n\n /**\n * Get categories by parentId with aggressive caching\n * \n * Optimization: Returns cached result immediately if available,\n * preventing unnecessary API calls during navigation\n * \n * @param parentId - Parent category ID (undefined = root categories)\n * @returns Array of categories with count metadata (childrenCount, itemsCount)\n */\n async getCategories(parentId?: string): Promise<AXPActivityCategory[]> {\n // ✅ Fast path: Return cached result\n if (this.categoriesByParentId.has(parentId)) {\n return this.categoriesByParentId.get(parentId)!;\n }\n\n // ✅ Prevent duplicate requests: Return pending promise\n if (this.pendingCategoriesRequests.has(parentId)) {\n return this.pendingCategoriesRequests.get(parentId)!;\n }\n\n // ✅ Create single request and cache it\n const requestPromise = this.loadCategoriesFromProviders(parentId);\n this.pendingCategoriesRequests.set(parentId, requestPromise);\n\n return requestPromise;\n }\n\n /**\n * Get single category by ID with O(1) lookup\n * \n * Optimization: Uses Map for instant retrieval, falls back to\n * searching cache, then providers if not found\n */\n async getCategoryById(categoryId: string): Promise<AXPActivityCategory | undefined> {\n // ✅ Fast path: O(1) lookup in cache\n if (this.categoriesById.has(categoryId)) {\n return this.categoriesById.get(categoryId);\n }\n\n // ✅ Search in cached parent-child lists\n for (const categories of this.categoriesByParentId.values()) {\n const found = categories.find(cat => cat.id === categoryId);\n if (found) {\n this.categoriesById.set(categoryId, found);\n return found;\n }\n }\n\n // ✅ Load root categories if not loaded\n if (!this.categoriesByParentId.has(undefined)) {\n await this.getCategories();\n if (this.categoriesById.has(categoryId)) {\n return this.categoriesById.get(categoryId);\n }\n }\n\n // ✅ Breadth-first search through hierarchy\n return this.searchCategoryInHierarchy(categoryId);\n }\n\n /**\n * Get category path from root to specified category\n * \n * Optimization: Builds path using cached categories only\n */\n async getCategoriesPathById(categoryId: string): Promise<AXPActivityCategory[]> {\n const path: AXPActivityCategory[] = [];\n let currentCategoryId: string | undefined = categoryId;\n\n while (currentCategoryId) {\n const category = await this.getCategoryById(currentCategoryId);\n if (!category) {\n throw new Error(`Category '${currentCategoryId}' not found`);\n }\n path.unshift(category);\n currentCategoryId = category.parentId;\n }\n\n return path;\n }\n\n //#endregion\n\n //#region ---- Public API: Activity Definitions ----\n\n /**\n * Get activity definitions for a category with smart caching\n * \n * Optimization: Checks itemsCount before querying\n * - If itemsCount = 0, returns empty array (no API call)\n * - If itemsCount > 0, loads and caches activity definitions\n * - Returns cached result on subsequent calls\n * \n * @param categoryId - Category ID to get activity definitions from\n * @returns Array of activity definitions\n */\n async getActivitiesByCategoryId(categoryId: string): Promise<AXPActivityDefinition[]> {\n // ✅ Fast path: Return cached result\n if (this.activitiesByCategory.has(categoryId)) {\n return this.activitiesByCategory.get(categoryId)!;\n }\n\n // ✅ Smart optimization: Check itemsCount before querying\n const category = await this.getCategoryById(categoryId);\n if (category && category.itemsCount !== undefined && category.itemsCount === 0) {\n // Category has no activities - cache empty array and skip API call\n const emptyArray: AXPActivityDefinition[] = [];\n this.activitiesByCategory.set(categoryId, emptyArray);\n return emptyArray;\n }\n\n // ✅ Prevent duplicate requests\n if (this.pendingActivitiesRequests.has(categoryId)) {\n return this.pendingActivitiesRequests.get(categoryId)!;\n }\n\n // ✅ Load from providers\n const requestPromise = this.loadActivitiesFromProviders(categoryId);\n this.pendingActivitiesRequests.set(categoryId, requestPromise);\n\n return requestPromise;\n }\n\n /**\n * Get single activity definition by name with O(1) lookup\n * \n * Optimization: Uses Map for instant retrieval\n * \n * @param name - Activity name (unique identifier and command key)\n * @returns Activity definition or undefined if not found\n */\n async getActivityByName(name: string): Promise<AXPActivityDefinition | undefined> {\n // ✅ Fast path: O(1) lookup in cache\n if (this.activitiesByName.has(name)) {\n return this.activitiesByName.get(name);\n }\n\n // ✅ Prevent duplicate requests\n if (this.pendingActivityRequests.has(name)) {\n return this.pendingActivityRequests.get(name)!;\n }\n\n // ✅ Load from providers\n const requestPromise = this.loadActivityFromProviders(name);\n this.pendingActivityRequests.set(name, requestPromise);\n\n return requestPromise;\n }\n\n /**\n * Get all activity definitions (flat list) by loading root categories and their activities.\n * Used by activity selector UIs (e.g. automation command configurator).\n */\n async getAllActivities(): Promise<AXPActivityDefinition[]> {\n const categories = await this.getCategories(undefined);\n const all: AXPActivityDefinition[] = [];\n for (const cat of categories) {\n const activities = await this.getActivitiesByCategoryId(cat.id);\n all.push(...activities);\n }\n return all;\n }\n\n /**\n * Get category ID containing a specific activity definition\n * \n * Optimization: Searches cache first, loads on-demand if needed\n */\n async getCategoryIdByActivityName(activityName: string): Promise<string | undefined> {\n // ✅ Search in cached activity definitions\n for (const [categoryId, definitions] of this.activitiesByCategory.entries()) {\n if (definitions.some(def => def.name === activityName)) {\n return categoryId;\n }\n }\n\n // ✅ Try loading the activity definition to find its category\n const definition = await this.getActivityByName(activityName);\n if (definition && definition.category) {\n // Try to find category by name/id\n const categories = await this.getCategories();\n const found = categories.find((cat) => cat.id === definition.category);\n if (found) {\n return found.id;\n }\n }\n\n return undefined;\n }\n\n /**\n * Get category path for an activity\n */\n async getCategoriesPathByActivityName(activityName: string): Promise<AXPActivityCategory[]> {\n const categoryId = await this.getCategoryIdByActivityName(activityName);\n if (!categoryId) {\n throw new Error(`Activity '${activityName}' not found in any category`);\n }\n return this.getCategoriesPathById(categoryId);\n }\n\n //#endregion\n\n //#region ---- Private: Data Loading ----\n\n /**\n * Load categories from providers and cache results\n * \n * Optimization: Tracks provider ownership to avoid unnecessary API calls\n * - For root (parentId = undefined): Query ALL providers\n * - For children: Only query the provider that owns the parent\n */\n private async loadCategoriesFromProviders(parentId?: string): Promise<AXPActivityCategory[]> {\n try {\n const resolvedProviders = await Promise.allSettled(this.categoryProviders);\n const categories: AXPActivityCategory[] = [];\n\n // Determine which provider(s) to query\n const providerIndicesToQuery = parentId\n ? this.getProviderIndexForCategory(parentId)\n : null; // Root: query all providers\n\n for (let i = 0; i < resolvedProviders.length; i++) {\n const p = resolvedProviders[i];\n\n // Skip if we have a specific provider index and this isn't it\n if (providerIndicesToQuery !== null && !providerIndicesToQuery.includes(i)) {\n continue;\n }\n\n if (p.status === 'fulfilled' && p.value && typeof p.value.getList === 'function') {\n try {\n const cats = await p.value.getList(parentId);\n if (Array.isArray(cats) && cats.length > 0) {\n categories.push(...cats);\n\n // ✅ Track ownership: This provider INDEX owns these categories\n cats.forEach(cat => this.categoryOwnership.set(cat.id, i));\n }\n } catch {\n // Continue on error - try other providers\n }\n }\n }\n\n // ✅ Cache results for fast subsequent access\n this.categoriesByParentId.set(parentId, categories);\n categories.forEach(cat => this.categoriesById.set(cat.id, cat));\n\n return categories;\n } finally {\n this.pendingCategoriesRequests.delete(parentId);\n }\n }\n\n /**\n * Get the provider index that owns a specific category\n * \n * @returns Array with provider index, or null if ownership unknown (query all)\n */\n private getProviderIndexForCategory(categoryId: string): number[] | null {\n const ownerIndex = this.categoryOwnership.get(categoryId);\n\n if (ownerIndex !== undefined) {\n return [ownerIndex];\n }\n\n // Ownership unknown - will query all providers (fallback)\n return null;\n }\n\n /**\n * Load activity definitions from providers and cache results\n * \n * Optimization: Only queries the provider that owns the category\n * Uses provider INDEX to match category provider with activity provider\n */\n private async loadActivitiesFromProviders(categoryId: string): Promise<AXPActivityDefinition[]> {\n try {\n const resolvedProviders = await Promise.allSettled(this.activityProviders);\n const definitions: AXPActivityDefinition[] = [];\n\n // ✅ Smart routing: Get provider INDEX that owns this category\n const ownerIndex = this.categoryOwnership.get(categoryId);\n const providerIndicesToQuery = ownerIndex !== undefined ? [ownerIndex] : null;\n\n for (let i = 0; i < resolvedProviders.length; i++) {\n const p = resolvedProviders[i];\n\n // Skip if we have a specific provider index and this isn't it\n if (providerIndicesToQuery !== null && !providerIndicesToQuery.includes(i)) {\n continue;\n }\n\n if (p.status === 'fulfilled' && p.value && typeof p.value.getList === 'function') {\n try {\n const defs = await p.value.getList(categoryId);\n if (Array.isArray(defs)) {\n definitions.push(...defs);\n }\n } catch {\n // Continue on error - try other providers\n }\n }\n }\n\n // ✅ Cache results for fast subsequent access\n this.activitiesByCategory.set(categoryId, definitions);\n definitions.forEach(def => {\n if (def.name) {\n this.activitiesByName.set(def.name, def);\n }\n });\n\n return definitions;\n } finally {\n this.pendingActivitiesRequests.delete(categoryId);\n }\n }\n\n /**\n * Load single activity definition from providers and cache result\n */\n private async loadActivityFromProviders(name: string): Promise<AXPActivityDefinition | undefined> {\n try {\n const resolvedProviders = await Promise.allSettled(this.activityProviders);\n\n // Try providers first\n for (const p of resolvedProviders) {\n if (p.status === 'fulfilled' && p.value && typeof p.value.getById === 'function') {\n try {\n const result = await p.value.getById(name);\n if (result) {\n this.activitiesByName.set(name, result);\n return result;\n }\n } catch {\n // Continue on error\n }\n }\n }\n\n // Fallback: Search in cached activity definitions\n for (const definitions of this.activitiesByCategory.values()) {\n const found = definitions.find(def => def.name === name);\n if (found) {\n this.activitiesByName.set(name, found);\n return found;\n }\n }\n\n return undefined;\n } finally {\n this.pendingActivityRequests.delete(name);\n }\n }\n\n /**\n * Breadth-first search through category hierarchy\n */\n private async searchCategoryInHierarchy(categoryId: string): Promise<AXPActivityCategory | undefined> {\n const searchQueue: (string | undefined)[] = [undefined];\n const searched = new Set<string | undefined>();\n\n while (searchQueue.length > 0) {\n const parentId = searchQueue.shift()!;\n if (searched.has(parentId)) continue;\n searched.add(parentId);\n\n const categories = await this.getCategories(parentId);\n const found = categories.find(cat => cat.id === categoryId);\n\n if (found) {\n return found;\n }\n\n // ✅ Optimization: Only search children if childrenCount > 0\n for (const category of categories) {\n if (category.childrenCount > 0 && !searched.has(category.id)) {\n searchQueue.push(category.id);\n }\n }\n }\n\n return undefined;\n }\n\n //#endregion\n\n //#region ---- Cache Management ----\n\n /**\n * Check if category has children (uses cached count)\n */\n categoryHasChildren(categoryId: string): boolean {\n const category = this.categoriesById.get(categoryId);\n return category ? category.childrenCount > 0 : false;\n }\n\n /**\n * Check if category has activities (uses cached count)\n */\n categoryHasActivities(categoryId: string): boolean {\n const category = this.categoriesById.get(categoryId);\n return category ? (category.itemsCount ?? 0) > 0 : false;\n }\n\n /**\n * Clear all caches\n */\n clearAllCache(): void {\n this.categoriesById.clear();\n this.categoriesByParentId.clear();\n this.activitiesByCategory.clear();\n this.activitiesByName.clear();\n this.categoryOwnership.clear();\n this.pendingCategoriesRequests.clear();\n this.pendingActivitiesRequests.clear();\n this.pendingActivityRequests.clear();\n }\n\n /**\n * Clear categories cache only\n */\n clearCategoriesCache(): void {\n this.categoriesById.clear();\n this.categoriesByParentId.clear();\n this.categoryOwnership.clear();\n this.pendingCategoriesRequests.clear();\n }\n\n /**\n * Clear activities cache only\n */\n clearActivitiesCache(): void {\n this.activitiesByCategory.clear();\n this.activitiesByName.clear();\n this.pendingActivitiesRequests.clear();\n this.pendingActivityRequests.clear();\n }\n\n //#endregion\n}\n\n","import { InjectionToken } from '@angular/core';\nimport {\n AXPFrontActivityCompleteRequest,\n AXPFrontActivityCompleteResponse,\n AXPGetWorkflowStateRequest,\n AXPResumeWorkflowRequest,\n AXPResumeWorkflowResponse,\n AXPStartWorkflowRequest,\n AXPStartWorkflowResponse,\n AXPWorkflowInstanceState,\n} from './workflow-runtime.types';\n\n/**\n * Interface for workflow engine operations.\n */\nexport interface AXPWorkflowEngine {\n /**\n * Start a new workflow instance.\n *\n * Creates a new workflow instance in backend and returns instance ID.\n *\n * @param request - Start workflow request\n * @returns Response with instanceId and initial state\n *\n */\n start(request: AXPStartWorkflowRequest): Promise<AXPStartWorkflowResponse>;\n\n /**\n * Resume a suspended workflow instance.\n *\n * Resumes workflow instance after user interaction (e.g., after show-dialog).\n *\n * @param request - Resume workflow request\n * @returns Resume response with next step and updated state\n *\n */\n resume(request: AXPResumeWorkflowRequest): Promise<AXPResumeWorkflowResponse>;\n\n /**\n * Get current workflow instance state.\n *\n * Retrieves current state of a workflow instance from backend.\n *\n * @param request - Get state request\n * @returns Current workflow instance state\n *\n */\n getState(request: AXPGetWorkflowStateRequest): Promise<AXPWorkflowInstanceState>;\n\n frontActivtyComplete(request: AXPFrontActivityCompleteRequest): Promise<AXPFrontActivityCompleteResponse>;\n}\n\n/**\n * Injection token for workflow engine.\n * Default implementation is AXPWorkflowLocalEngine.\n */\nexport const AXP_WORKFLOW_ENGINE = new InjectionToken<AXPWorkflowEngine>('AXP_WORKFLOW_ENGINE');\n","import { Injectable } from '@angular/core';\nimport { AXPExpressionEvaluatorScope } from '@acorex/platform/core';\nimport { get } from 'lodash-es';\nimport { AXPWorkflowInstanceState } from './workflow-runtime.types';\n\n//#region ---- Types & Interfaces ----\n\n/**\n * Workflow expression evaluation context.\n * Contains workflow state data needed for expression evaluation.\n */\nexport interface WorkflowExpressionContext {\n /** Workflow input values */\n inputs: Record<string, any>;\n \n /** Workflow state variables */\n variables: Record<string, any>;\n \n /** Previous activity outputs (activityId -> output) */\n outputs: Record<string, any>;\n}\n\n//#endregion\n\n/**\n * Workflow Expression Scope Service\n * \n * Shared service for building expression evaluation scope from workflow data.\n * Used by both Local Engine and Mock Runtime to manage workflow data (inputs, variables, outputs).\n * \n * Responsibilities:\n * - Build expression evaluation scope from workflow state\n * - Provide context.eval() function for accessing workflow data\n * - Manage workflow data structure (inputs, variables, outputs)\n * \n * This service does NOT:\n * - Execute activities\n * - Evaluate expressions (delegates to AXPExpressionEvaluatorService)\n * - Manage workflow state (handled by runtime)\n * \n * @example\n * ```typescript\n * const scopeService = inject(WorkflowExpressionScopeService);\n * \n * // Build scope from workflow state\n * const scope = scopeService.buildScope({\n * inputs: state.input || {},\n * variables: state.variables || {},\n * outputs: activityOutputs\n * });\n * \n * // Or build from state directly\n * const scope = scopeService.buildScopeFromState(state, activityOutputs);\n * ```\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class WorkflowExpressionScopeService {\n //#region ---- Private Helpers (dot-notation input normalization) ----\n\n /**\n * Collect dot-notation key-value pairs from nested objects so that e.g.\n * { metadata: { \"metadata.questionnaire.id\": \"x\" } } becomes { \"metadata.questionnaire.id\": \"x\" } at root.\n * Top-level non-dot keys are kept as-is.\n */\n private flattenDotKeysFromTree(obj: Record<string, any>): Record<string, any> {\n if (obj === null || typeof obj !== 'object') return obj;\n const result: Record<string, any> = {};\n for (const [key, value] of Object.entries(obj)) {\n if (key.includes('.')) {\n result[key] = value;\n } else if (value !== null && typeof value === 'object' && !Array.isArray(value)) {\n for (const [k, v] of Object.entries(value)) {\n if (k.includes('.')) {\n result[k] = v;\n } else {\n result[key + '.' + k] = v;\n }\n }\n } else {\n result[key] = value;\n }\n }\n return result;\n }\n\n /**\n * Expand flat keys with dots into nested objects.\n * e.g. { \"metadata.questionnaire.id\": \"x\" } -> { metadata: { questionnaire: { id: \"x\" } } }.\n */\n private expandDotKeys(obj: Record<string, any>): Record<string, any> {\n if (obj === null || typeof obj !== 'object') return obj;\n const result: Record<string, any> = {};\n const dotKeys: [string, any][] = [];\n const simpleKeys: [string, any][] = [];\n for (const [key, value] of Object.entries(obj)) {\n if (key.includes('.')) {\n dotKeys.push([key, value]);\n } else {\n simpleKeys.push([key, value]);\n }\n }\n for (const [key, value] of dotKeys) {\n const parts = key.split('.');\n let current = result;\n for (let i = 0; i < parts.length - 1; i++) {\n const part = parts[i];\n if (!(part in current) || typeof current[part] !== 'object' || current[part] === null) {\n current[part] = {};\n }\n current = current[part];\n }\n current[parts[parts.length - 1]] = value;\n }\n for (const [key, value] of simpleKeys) {\n result[key] = value;\n }\n return result;\n }\n\n /**\n * Normalize workflow input so that flat dot-notation keys (e.g. from form schema\n * \"metadata.questionnaire.id\") become nested for expression access (inputs.metadata.questionnaire.id).\n */\n private normalizeInputs(input: Record<string, any> | undefined): Record<string, any> {\n if (!input || typeof input !== 'object') return {};\n const flattened = this.flattenDotKeysFromTree(input);\n return this.expandDotKeys(flattened);\n }\n\n //#endregion\n\n //#region ---- Public Methods ----\n\n /**\n * Build expression evaluation scope for workflow activities.\n * \n * Provides workflow-specific data (inputs, variables, outputs) and context.eval() function.\n * Other data (session, current user, etc.) are provided by expression evaluator scope providers.\n * \n * Scope includes:\n * - inputs: Workflow input values (accessible as inputs.propertyName)\n * - variables: Workflow state variables (accessible as variables.propertyName or vars.propertyName)\n * - outputs: Previous activity outputs (accessible as outputs.activityId)\n * - context.eval(path): Function to access nested properties from workflow data\n * \n * Expressions can use:\n * - {{inputs.userName}} - Direct access to workflow input\n * - {{variables.someVar}} or {{vars.someVar}} - Direct access to workflow variable\n * - {{outputs.activityId.property}} - Direct access to previous activity output\n * - {{context.eval(\"inputs.userName\")}} - Access via context.eval (supports nested paths)\n * - {{context.eval(\"variables.someVar\")}} - Access variables via context.eval\n * - {{context.eval(\"outputs.activityId.property\")}} - Access outputs via context.eval\n * - {{session.currentUser().name}} - Access current user via expression evaluator scope providers\n * \n * The context.eval() function provides a unified way to access all workflow data,\n * similar to how entity-detail-list uses context.eval() to access parent data.\n * \n * @param context - Workflow expression context containing inputs, variables, and outputs\n * @returns Expression evaluator scope with workflow data and context.eval() function\n */\n buildScope(context: WorkflowExpressionContext): AXPExpressionEvaluatorScope {\n // Normalize inputs so flat dot-notation keys (e.g. metadata.questionnaire.id from forms) become nested for expressions\n const inputs = this.normalizeInputs(context.inputs || {});\n\n // Build merged workflow data object for context.eval()\n // This allows expressions like: context.eval(\"inputs.userName\") or context.eval(\"variables.count\")\n const workflowData = {\n inputs,\n variables: context.variables || {},\n vars: context.variables || {}, // Alias for convenience\n outputs: context.outputs || {},\n };\n\n // Build scope object with workflow-specific data and context.eval()\n // Note: AXPExpressionEvaluatorScope type expects { [namespace]: { [name]: Function } }\n // but evaluate() method actually accepts flat objects with values too\n // We'll use 'any' to allow both values and functions\n const scope: any = {\n // Direct access to workflow data\n inputs: workflowData.inputs,\n variables: workflowData.variables,\n vars: workflowData.vars,\n outputs: workflowData.outputs,\n \n // Context object with eval function (similar to entity-detail-list pattern)\n context: {\n eval: (path: string) => {\n // Use lodash get to access nested properties\n // Supports paths like: \"inputs.userName\", \"variables.count\", \"outputs.activityId.property\"\n return get(workflowData, path);\n },\n },\n };\n\n return scope as AXPExpressionEvaluatorScope;\n }\n\n /**\n * Build expression evaluation scope from workflow instance state.\n * \n * Convenience method that extracts data from AXPWorkflowInstanceState.\n * \n * @param state - Workflow instance state\n * @param activityOutputs - Map of activity outputs (activityId -> output)\n * @returns Expression evaluator scope with workflow data and context.eval() function\n */\n buildScopeFromState(\n state: AXPWorkflowInstanceState,\n activityOutputs?: Map<string, any> | Record<string, any>\n ): AXPExpressionEvaluatorScope {\n // Convert activity outputs to record format\n const outputs: Record<string, any> = {};\n if (activityOutputs) {\n if (activityOutputs instanceof Map) {\n activityOutputs.forEach((output, activityId) => {\n outputs[activityId] = output;\n });\n } else {\n Object.assign(outputs, activityOutputs);\n }\n }\n\n // Convenience alias for the last activity output (if available).\n // This allows expressions like: {{outputs.last.someField}}\n if (outputs['last'] === undefined && state.lastActivityOutput !== undefined) {\n outputs['last'] = state.lastActivityOutput;\n }\n\n return this.buildScope({\n inputs: this.normalizeInputs((state.input || {}) as Record<string, any>),\n variables: state.variables || {},\n outputs: outputs,\n });\n }\n\n //#endregion\n}\n\n","import { Injectable, inject } from '@angular/core';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPCommandService } from '@acorex/platform/runtime';\nimport { AXPExpressionEvaluatorService, AXPMultiLanguageString } from '@acorex/platform/core';\nimport { AXPWorkflowTask, AXPWorkflowInstanceState } from './workflow-runtime.types';\nimport { WorkflowExpressionScopeService } from './workflow-expression-scope.service';\n\n//#region ---- Constants ----\n\n/**\n * Activity types handled internally by the workflow engine (e.g. mock backend).\n * When such an activity is not registered as Command on the client, we skip execution\n * without warning — the engine will run it when executing the workflow.\n */\nconst ENGINE_BUILTIN_ACTIVITY_TYPES = new Set<string>([\n 'workflow-activity:set-variable',\n 'workflow-activity:http-request',\n]);\n\n//#endregion\n\n//#region ---- Types & Interfaces ----\n\n/**\n * Result of executing a workflow activity.\n */\nexport interface ActivityExecutionResult {\n /**\n * Activity execution output.\n */\n output: any;\n\n /**\n * Activity execution outcome (e.g., 'Done', 'Confirmed', 'Cancelled', 'Failed').\n */\n outcome: string;\n}\n\n//#endregion\n\n/**\n * Activity Executor Service\n * \n * Service for executing workflow activities via CommandBus.\n * Automatically evaluates expressions in activity inputs before execution.\n * \n * @example\n * ```typescript\n * const executor = inject(ActivityExecutor);\n * \n * // Execute activity with task and workflow state (expressions will be evaluated)\n * const result = await executor.execute(task, workflowState, activityOutputs);\n * ```\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class ActivityExecutor {\n //#region ---- Services & Dependencies ----\n\n private readonly commandService = inject(AXPCommandService);\n private readonly expressionEvaluator = inject(AXPExpressionEvaluatorService);\n private readonly expressionScopeService = inject(WorkflowExpressionScopeService);\n private readonly translateService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Public Methods ----\n\n /**\n * Execute a workflow activity with expression evaluation.\n * \n * Evaluates expressions in activity inputs using workflow state,\n * then executes the activity via CommandBus.\n * \n * @param task - Workflow task containing activity information\n * @param workflowState - Current workflow instance state (for expression evaluation)\n * @param activityOutputs - Map of previous activity outputs (for expression evaluation)\n * @returns Execution result with output and outcome\n */\n async execute(\n task: AXPWorkflowTask,\n workflowState?: AXPWorkflowInstanceState,\n activityOutputs?: Map<string, any> | Record<string, any>\n ): Promise<ActivityExecutionResult> {\n \n try {\n const activityName = task.activityType;\n\n // Evaluate inputs if workflow state is provided\n let evaluatedInputs = task.input || {};\n if (workflowState) {\n // Prefer explicit outputs, fallback to outputs stored in state\n const outputsForScope =\n activityOutputs ??\n (workflowState.activityOutputs as Record<string, any> | undefined) ??\n undefined;\n\n // Build expression scope from workflow state\n const scope = this.expressionScopeService.buildScopeFromState(workflowState, outputsForScope);\n \n // Evaluate all inputs recursively (handles nested objects and arrays)\n evaluatedInputs = await this.expressionEvaluator.evaluate(task.input || {}, scope);\n }\n\n // Check if command exists\n const commandExists = this.commandService.exists(activityName);\n\n if (!commandExists) {\n if (!ENGINE_BUILTIN_ACTIVITY_TYPES.has(activityName)) {\n console.warn(\n `[ActivityExecutor] ⚠️ Activity '${activityName}' is not registered as Command. ` +\n `Skipping execution.`\n );\n }\n return {\n output: null,\n outcome: 'Done'\n };\n }\n\n // Flatten properties if nested (workflow-studio format)\n let commandInput = evaluatedInputs;\n if (commandInput['properties'] && typeof commandInput['properties'] === 'object') {\n // Flatten: {properties: {text: \"...\"}} -> {text: \"...\"}\n commandInput = { ...commandInput['properties'] };\n }\n\n // Execute activity via CommandBus\n // Activities (AXPActivity) return {output, outcome}; legacy may return {output, outcomes}\n const result = await this.commandService.execute<Record<string, any>, {\n output?: any;\n outcome?: string;\n outcomes?: Record<string, any>;\n }>(activityName, commandInput);\n \n if (!result) {\n return {\n output: null,\n outcome: 'Failed',\n };\n }\n\n if (!result.success) {\n return {\n output: {\n error: await this.resolveCommandMessageTextForError(result.message?.text),\n },\n outcome: 'Failed',\n };\n }\n\n const commandResult = result.data as any;\n\n // Prefer unified outcome in result.metadata; fall back to legacy data.outcome/outcomes.\n const metadataOutcome = (result as any)?.metadata?.['outcome'];\n let outcome = 'Done';\n if (typeof metadataOutcome === 'string' && metadataOutcome.length > 0) {\n outcome = metadataOutcome;\n } else if (typeof commandResult?.outcome === 'string' && commandResult.outcome.length > 0) {\n outcome = commandResult.outcome;\n } else {\n const outcomes = (commandResult?.outcomes ?? {}) as Record<string, any>;\n if (outcomes && typeof outcomes === 'object' && Object.keys(outcomes).length > 0) {\n outcome = outcomes['Done'] ? 'Done' : Object.keys(outcomes)[0] || 'Done';\n }\n }\n\n // Prefer output wrapper when present; otherwise treat data itself as output.\n const output =\n commandResult && typeof commandResult === 'object' && 'output' in commandResult\n ? commandResult.output\n : commandResult;\n\n return {\n output: output ?? null,\n outcome,\n };\n } catch (error: any) {\n console.error(`[ActivityExecutor] ❌ Error evaluating expressions or executing activity:`, error);\n return {\n output: { error: error.message || 'Unknown error' },\n outcome: 'Failed'\n };\n }\n }\n\n /**\n * Resolves command failure message text for workflow output: `@` keys via translate, MLS maps via resolve.\n */\n private async resolveCommandMessageTextForError(\n value: AXPMultiLanguageString | undefined | null,\n ): Promise<string> {\n if (value == null) {\n return '';\n }\n if (typeof value === 'string') {\n return value.startsWith('@') ? await this.translateService.translateAsync(value) : value;\n }\n return this.translateService.resolve(value);\n }\n\n //#endregion\n}\n\n","import { Injectable, inject } from '@angular/core';\nimport { ActivityExecutionResult, ActivityExecutor } from './activity-executor.service';\nimport { AXP_WORKFLOW_ENGINE } from './workflow-engine';\nimport { AXPWorkflowInstanceState, AXPWorkflowTask } from './workflow-runtime.types';\n\n//#region ---- Types & Interfaces ----\n\n/**\n * Result of starting a workflow.\n */\nexport interface WorkflowStartResult {\n /**\n * Whether the operation succeeded.\n */\n success: boolean;\n\n /**\n * Workflow instance ID.\n */\n instanceId?: string;\n\n /**\n * Initial workflow state.\n */\n state?: AXPWorkflowInstanceState;\n\n /**\n * First task to execute (if any).\n */\n nextTask?: AXPWorkflowTask | null;\n\n /**\n * Workflow output (if completed immediately).\n */\n output?: any;\n\n /**\n * Error message (if failed).\n */\n error?: string;\n}\n\n/**\n * Result of completing a task.\n */\nexport interface WorkflowCompleteResult {\n /**\n * Whether the operation succeeded.\n */\n success: boolean;\n\n /**\n * Workflow instance ID.\n */\n instanceId: string;\n\n /**\n * Updated workflow state.\n */\n state?: AXPWorkflowInstanceState;\n\n /**\n * Next task to execute (if any).\n */\n nextTask?: AXPWorkflowTask | null;\n\n /**\n * Workflow output (if completed).\n */\n output?: any;\n\n /**\n * Error message (if failed).\n */\n error?: string;\n}\n\n/**\n * Result of resuming a workflow.\n */\nexport interface WorkflowResumeResult {\n /**\n * Whether the operation succeeded.\n */\n success: boolean;\n\n /**\n * Workflow instance ID.\n */\n instanceId: string;\n\n /**\n * Updated workflow state.\n */\n state?: AXPWorkflowInstanceState;\n\n /**\n * Next task to execute (if any).\n */\n nextTask?: AXPWorkflowTask | null;\n\n /**\n * Workflow output (if completed).\n */\n output?: any;\n\n /**\n * Error message (if failed).\n */\n error?: string;\n}\n\n//#endregion\n\n/**\n * Workflow Manager - Facade for workflow lifecycle orchestration.\n *\n * This service is the ONLY interface the frontend uses to interact with workflows.\n * It follows Clean Architecture principles and does NOT contain execution or business logic.\n *\n * Responsibilities:\n * - Orchestrate workflow lifecycle (start, execute, complete, resume)\n * - Delegate execution to ActivityExecutor\n * - Cache workflow state in memory\n * - Expose a stable API for UI\n *\n * Rules:\n * - No HTTP calls (delegates to AXPWorkflowEngine)\n * - No CommandBus / Command execution (delegates to ActivityExecutor)\n * - No workflow branching logic (backend decides)\n * - No business validation (backend validates)\n * - No backend assumptions (uses abstract runtime service)\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPWorkflowManager {\n //#region ---- Services & Dependencies ----\n\n private readonly workflowEngine = inject(AXP_WORKFLOW_ENGINE);\n private readonly activityExecutor = inject(ActivityExecutor); \n\n //#endregion\n\n //#region ---- State Cache ----\n\n /**\n * Cache workflow states in memory for quick access.\n * Key: instanceId\n * Value: AXPWorkflowInstanceState\n */\n private stateCache = new Map<string, AXPWorkflowInstanceState>();\n\n /**\n * Cache TTL in milliseconds (5 minutes).\n */\n private readonly CACHE_TTL = 5 * 60 * 1000;\n\n //#endregion\n\n //#region ---- Public Methods ----\n\n /**\n * Execute frontend activities interactively until reaching workflow-activity:human-task or completion.\n *\n * Interactive = show form/popup immediately (user sees and acts). Only workflow-activity:human-task\n * is not interactive (goes to task board). Other frontend activities (show-layout-popup, show-toast, etc.)\n * even with taskType human-task in definition are executed here.\n *\n * @param instanceId - Workflow instance ID\n * @param task - Current task to execute\n * @param state - Current workflow state\n * @param lastActivityOutput - Last activity output (for expression evaluation)\n * @returns Final result with nextTask (if workflow-activity:human-task) or completion status\n */\n private async executeInteractiveFlow(\n instanceId: string,\n task: AXPWorkflowTask,\n state: AXPWorkflowInstanceState,\n activityOutputs?: Record<string, any>\n ): Promise<{ nextTask: AXPWorkflowTask | null; state: AXPWorkflowInstanceState; output?: any }> {\n let currentTask: AXPWorkflowTask | null = task;\n let currentState = state;\n let currentActivityOutputs: Record<string, any> = {\n ...(currentState.activityOutputs || {}),\n ...(activityOutputs || {}),\n };\n const maxIterations = 100; // Prevent infinite loops\n let iterationCount = 0;\n\n while (currentTask && iterationCount < maxIterations) {\n iterationCount++;\n\n // Interactive = frontend executionMode and NOT workflow-activity:human-task (that one goes to task board)\n const isInteractive =\n (currentTask.executionMode === 'frontend' || currentTask.executionMode === 'both') &&\n currentTask.activityType !== 'workflow-activity:human-task';\n\n if (isInteractive) {\n // Execute frontend activity\n const execResult = await this.activityExecutor.execute(\n currentTask,\n currentState,\n currentActivityOutputs\n );\n\n // Track outputs locally (backend should also persist and return them)\n currentActivityOutputs = {\n ...currentActivityOutputs,\n [currentTask.activityId]: execResult.output,\n };\n\n // Send result to backend\n const completeResponse = await this.workflowEngine.frontActivtyComplete({\n instanceId,\n activityNode: currentTask.activityId,\n output: execResult.output || {},\n outcome: execResult.outcome,\n });\n\n // Update state cache\n if (completeResponse.state) {\n const normalizedState = { ...completeResponse.state };\n if (normalizedState.lastUpdated && !(normalizedState.lastUpdated instanceof Date)) {\n normalizedState.lastUpdated = new Date(normalizedState.lastUpdated);\n }\n currentState = normalizedState;\n // Prefer outputs returned by backend; fallback to local cache\n currentActivityOutputs = {\n ...currentActivityOutputs,\n ...(normalizedState.activityOutputs || {}),\n };\n this.stateCache.set(instanceId, normalizedState);\n }\n\n // Backend decides: if no nextTask, workflow is completed\n if (!completeResponse.nextTask) {\n return {\n nextTask: null,\n state: currentState,\n output: completeResponse.output,\n };\n }\n\n // Backend decides: if nextTask is workflow-activity:human-task or not frontend, return it (task board or done)\n const nextInteractive =\n (completeResponse.nextTask.executionMode === 'frontend' || completeResponse.nextTask.executionMode === 'both') &&\n completeResponse.nextTask.activityType !== 'workflow-activity:human-task';\n if (!nextInteractive) {\n return {\n nextTask: completeResponse.nextTask,\n state: currentState,\n };\n }\n\n // Continue with next interactive frontend task\n currentTask = completeResponse.nextTask;\n } else {\n // Not interactive (e.g. workflow-activity:human-task) - return as-is for task board\n return {\n nextTask: currentTask,\n state: currentState,\n };\n }\n }\n\n // Max iterations reached\n if (iterationCount >= maxIterations) {\n console.warn(`[AXPWorkflowManager] ⚠️ Maximum iterations (${maxIterations}) reached`);\n }\n\n return {\n nextTask: currentTask,\n state: currentState,\n };\n }\n\n /**\n * Start a new workflow instance.\n *\n * Creates a new workflow instance in backend and returns instance ID.\n * Backend decides what to do: returns pendingTask or indicates completion.\n *\n * @param workflowId - Workflow ID to start\n * @param input - Initial input data (optional)\n * @returns Start result with instanceId, state, and nextTask\n *\n * @example\n * ```typescript\n * const result = await workflowManager.start('my-workflow', { userId: '123' });\n *\n * if (result.success && result.nextTask) {\n * // Execute task if frontend\n * if (result.nextTask.executionMode === 'frontend') {\n * const execResult = await workflowManager.execute(result.nextTask);\n * await workflowManager.complete(result.instanceId!, result.nextTask, execResult.outcome, execResult.output);\n * }\n * }\n * ```\n */\n async start(workflowId: string, input: Record<string, any> = {}): Promise<WorkflowStartResult> {\n try {\n const response = await this.workflowEngine.start({\n workflowId,\n input,\n });\n\n // Cache state (normalize Date)\n let startNormalizedState = { ...response.state };\n if (startNormalizedState.lastUpdated && !(startNormalizedState.lastUpdated instanceof Date)) {\n startNormalizedState.lastUpdated = new Date(startNormalizedState.lastUpdated);\n }\n this.stateCache.set(response.instanceId, startNormalizedState);\n\n // 🎯 Interactive flow: Execute frontend activities that are NOT workflow-activity:human-task (those go to task board)\n let finalNextTask = response.pendingTask || null;\n let finalOutput = startNormalizedState.output;\n\n const pendingTask = response.pendingTask;\n if (\n pendingTask &&\n (pendingTask.executionMode === 'frontend' || pendingTask.executionMode === 'both') &&\n pendingTask.activityType !== 'workflow-activity:human-task'\n ) {\n const interactiveResult = await this.executeInteractiveFlow(\n response.instanceId,\n pendingTask,\n startNormalizedState,\n response.activityOutputs || response.state.activityOutputs\n );\n\n finalNextTask = interactiveResult.nextTask;\n startNormalizedState = interactiveResult.state;\n if (interactiveResult.output !== undefined) {\n finalOutput = interactiveResult.output;\n }\n\n // Update cache with final state\n this.stateCache.set(response.instanceId, startNormalizedState);\n }\n // If backend returned null or non-executable task, return it as-is\n // Backend already decided workflow status (suspended, completed, etc.)\n\n return {\n success: true,\n instanceId: response.instanceId,\n state: startNormalizedState,\n nextTask: finalNextTask,\n output: finalOutput,\n };\n } catch (error: any) {\n console.error('[AXPWorkflowManager] ❌ Error starting workflow:', error);\n return {\n success: false,\n error: error.message || 'Failed to start workflow',\n };\n }\n }\n\n /**\n * Resume a suspended workflow (e.g., after user interaction).\n *\n * Backend determines nextStep based on outcome and outcomeConnections.\n * Client only provides instanceId, stepId, outcome, and optional userInput.\n *\n * @param instanceId - Workflow instance ID\n * @param stepId - Step ID that was waiting for user input\n * @param outcome - User action outcome (e.g., 'Confirmed', 'Cancelled', 'Submitted')\n * @param userInput - Optional user input data\n * @param taskToken - Secure task token (required for secure resumption)\n * @returns Resume result with next task (if any)\n */\n async resume(\n instanceId: string,\n stepId: string,\n outcome: string,\n userInput?: any,\n taskToken?: string,\n ): Promise<WorkflowResumeResult> {\n try {\n // Ensure taskToken is provided for secure resumption\n if (!taskToken) {\n throw new Error('Missing taskToken for resume operation');\n }\n\n // Backend handles everything: checks outcomeConnections and determines nextStep\n const response = await this.workflowEngine.resume({\n instanceId,\n stepId,\n taskToken,\n outcome,\n userInput,\n });\n\n // Update cache with state from backend\n let normalizedState = response.state ? { ...response.state } : undefined;\n if (normalizedState && normalizedState.lastUpdated && !(normalizedState.lastUpdated instanceof Date)) {\n normalizedState.lastUpdated = new Date(normalizedState.lastUpdated);\n }\n \n if (normalizedState) {\n this.stateCache.set(instanceId, normalizedState);\n }\n\n // 🎯 Interactive flow: Execute frontend activities that are NOT workflow-activity:human-task (those go to task board)\n let finalNextTask = response.nextTask || null;\n let finalOutput = response.output;\n\n const nextTask = response.nextTask;\n if (\n nextTask &&\n (nextTask.executionMode === 'frontend' || nextTask.executionMode === 'both') &&\n nextTask.activityType !== 'workflow-activity:human-task'\n ) {\n const interactiveResult = await this.executeInteractiveFlow(\n instanceId,\n nextTask,\n normalizedState!,\n normalizedState?.activityOutputs\n );\n\n finalNextTask = interactiveResult.nextTask;\n normalizedState = interactiveResult.state;\n if (interactiveResult.output !== undefined) {\n finalOutput = interactiveResult.output;\n }\n\n // Update cache with final state\n this.stateCache.set(instanceId, normalizedState);\n }\n // If backend returned null or non-executable task, return it as-is\n // Backend already decided workflow status (suspended, completed, etc.)\n\n return {\n success: true,\n instanceId,\n state: normalizedState || response.state,\n nextTask: finalNextTask,\n output: finalOutput,\n };\n } catch (error: any) {\n console.error('[AXPWorkflowManager] ❌ Error resuming workflow:', error);\n return {\n success: false,\n instanceId,\n error: error.message || 'Failed to resume workflow',\n };\n }\n }\n\n /**\n * Get workflow instance state.\n *\n * Retrieves state from cache (if valid) or from backend.\n *\n * @param instanceId - Workflow instance ID\n * @returns Workflow instance state or null if not found\n */\n async getState(instanceId: string): Promise<AXPWorkflowInstanceState | null> {\n // Check cache first\n const cached = this.stateCache.get(instanceId);\n if (cached) {\n // Normalize lastUpdated to Date (for cache safety)\n const normalizedCached = { ...cached };\n if (normalizedCached.lastUpdated && !(normalizedCached.lastUpdated instanceof Date)) {\n normalizedCached.lastUpdated = new Date(normalizedCached.lastUpdated);\n }\n\n // Validate cache age\n const cacheAge = Date.now() - normalizedCached.lastUpdated.getTime();\n if (cacheAge < this.CACHE_TTL) {\n return normalizedCached;\n }\n }\n\n // Fetch from backend\n try {\n const state = await this.workflowEngine.getState({\n instanceId,\n });\n\n // Normalize lastUpdated to Date (for cache safety)\n const normalizedState = { ...state };\n if (normalizedState.lastUpdated && !(normalizedState.lastUpdated instanceof Date)) {\n normalizedState.lastUpdated = new Date(normalizedState.lastUpdated);\n }\n\n // Update cache\n this.stateCache.set(instanceId, normalizedState);\n\n return normalizedState;\n } catch (error: any) {\n console.error('[AXPWorkflowManager] ❌ Error getting workflow state:', error);\n return null;\n }\n }\n\n //#endregion\n}\n","import { InjectionToken } from '@angular/core';\nimport { AXPCategoryEntity } from '@acorex/platform/core';\nimport { AXPWorkflowDefinition } from '../workflow-definition.types';\n\n/**\n * Workflow Category - Extends AXPCategoryEntity for consistency and performance\n * \n * Inherited properties from AXPCategoryEntity:\n * - id: string - Unique identifier\n * - title: string - Display name\n * - description?: string - Category description\n * - parentId?: string - Parent category ID\n * - childrenCount: number - Direct child categories count (enables lazy loading)\n * - itemsCount?: number - Direct workflows count\n * - totalChildrenCount?: number - Total nested categories (optional, for analytics)\n * - totalItemsCount?: number - Total workflows in tree (optional, for analytics)\n */\nexport interface AXPWorkflowCategory extends AXPCategoryEntity {\n // No additional properties needed - all inherited from AXPCategoryEntity\n // Use: childrenCount instead of hasChild\n // Use: itemsCount instead of hasWorkflow\n}\n\nexport type AXPWorkflowProviderToken =\n | AXPWorkflowProvider\n | Promise<AXPWorkflowProvider>;\n\nexport const AXP_WORKFLOW_PROVIDER = new InjectionToken<AXPWorkflowProviderToken[]>('AXP_WORKFLOW_PROVIDER', {\n factory: () => [],\n});\n\nexport interface AXPWorkflowProvider {\n /**\n * Get list of workflow definitions for a category.\n * @param categoryId - Category ID to filter workflows\n * @returns Promise of workflow definition array\n */\n getList(categoryId: string): Promise<AXPWorkflowDefinition[]>;\n \n /**\n * Get full workflow definition by name (unique identifier).\n * Used by workflow engines for execution and UI for metadata.\n * @param name - Workflow name (unique identifier)\n * @returns Promise of full workflow definition or null if not found\n */\n getByName(name: string): Promise<AXPWorkflowDefinition | null>;\n}\n\nexport type AXPWorkflowCategoryProviderToken =\n | AXPWorkflowCategoryProvider\n | Promise<AXPWorkflowCategoryProvider>;\n\nexport const AXP_WORKFLOW_CATEGORY_PROVIDER = new InjectionToken<AXPWorkflowCategoryProviderToken[]>('AXP_WORKFLOW_CATEGORY_PROVIDER', {\n factory: () => [],\n});\n\nexport interface AXPWorkflowCategoryProvider {\n getList(parentId?: string): Promise<AXPWorkflowCategory[]>;\n getById(id: string): Promise<AXPWorkflowCategory | undefined>;\n}\n\n","import { AXTranslationService } from '@acorex/core/translation';\nimport { AXPDataGenerator } from '@acorex/platform/core';\nimport { inject, Injectable } from '@angular/core';\nimport { AXPActivityDefinitionService } from '../activity/activity-definition.service';\nimport { AXPConnection, AXPWorkflowActivityInstance, AXPWorkflowDefinition } from '../workflow-definition.types';\nimport { AXP_WORKFLOW_PROVIDER } from '../workflow/workflow-definition.provider';\nimport { AXPWorkflowEngine } from './workflow-engine';\nimport {\n AXPFrontActivityCompleteRequest,\n AXPFrontActivityCompleteResponse,\n AXPGetWorkflowStateRequest,\n AXPResumeWorkflowRequest,\n AXPResumeWorkflowResponse,\n AXPStartWorkflowRequest,\n AXPStartWorkflowResponse,\n AXPWorkflowInstanceState,\n AXPWorkflowTask,\n} from './workflow-runtime.types';\n\n//#region ---- Types & Interfaces ----\n\n/**\n * Internal workflow execution state.\n */\ninterface LocalWorkflowState {\n instanceId: string;\n workflowId: string;\n definition: AXPWorkflowDefinition;\n state: AXPWorkflowInstanceState;\n currentActivityId?: string;\n completedActivities: Set<string>;\n activityResults: Map<string, { output: any; outcome?: string }>;\n}\n\n//#endregion\n\n/**\n * Local engine implementation that manages workflow progression and state.\n *\n * This engine:\n * - Returns frontend/both activities as pendingTask (does NOT execute them)\n * - Skips backend activities (does not error, continues execution)\n * - Maintains workflow state in memory\n * - Does not require backend API calls\n *\n * Execution of frontend tasks is handled by AXPWorkflowManager via ActivityExecutor.\n * This engine only manages workflow progression and state storage.\n *\n * This is the DEFAULT engine provider. Applications can override it with\n * an API-based engine implementation.\n */\n@Injectable()\nexport class AXPWorkflowLocalEngine implements AXPWorkflowEngine {\n //#region ---- Services & Dependencies ----\n\n private readonly activityDefinitionService = inject(AXPActivityDefinitionService);\n private readonly workflowProviders = inject(AXP_WORKFLOW_PROVIDER, { optional: true }) || [];\n private readonly multiLanguageResolver = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Instance Storage ----\n\n /**\n * In-memory storage for workflow instances.\n * Key: instanceId\n * Value: LocalWorkflowState\n */\n private instances = new Map<string, LocalWorkflowState>();\n\n /**\n * Task token storage for secure resume operations.\n * Key: taskToken\n * Value: { instanceId, activityId }\n */\n private taskTokens = new Map<string, { instanceId: string; activityId: string }>();\n\n //#endregion\n\n //#region ---- Public Methods (AXPWorkflowEngine) ----\n\n /**\n * Start a new workflow instance.\n *\n * Creates an in-memory workflow instance and progresses it.\n * Frontend/both activities are returned as pendingTask for external execution.\n * Backend activities are skipped.\n */\n async start(request: AXPStartWorkflowRequest): Promise<AXPStartWorkflowResponse> {\n console.log(`[WorkflowLocalEngine] 🚀 Starting workflow: ${request.workflowId}`, request);\n\n // Generate instance ID\n const instanceId = AXPDataGenerator.uuid();\n const now = new Date();\n\n // Load workflow definition\n console.log(`[WorkflowLocalEngine] 📥 Loading workflow definition: ${request.workflowId}`);\n const definition = await this.getDefinition(request.workflowId);\n if (!definition) {\n console.error(`[WorkflowLocalEngine] ❌ Workflow definition not found: ${request.workflowId}`);\n throw new Error(`Workflow definition not found: ${request.workflowId}`);\n }\n\n console.log(`[WorkflowLocalEngine] ✅ Definition loaded:`, {\n name: definition.name,\n activitiesCount: definition.graph?.activities?.length || 0,\n connectionsCount: definition.graph?.connections?.length || 0,\n });\n\n // Initialize workflow state\n const state: AXPWorkflowInstanceState = {\n instanceId,\n workflowId: request.workflowId,\n status: 'running',\n variables: {},\n activityOutputs: {},\n lastActivityOutput: undefined,\n input: request.input || {},\n output: undefined,\n lastUpdated: now,\n };\n\n // Create local state\n const localState: LocalWorkflowState = {\n instanceId,\n workflowId: request.workflowId,\n definition,\n state,\n completedActivities: new Set(),\n activityResults: new Map(),\n };\n\n // Store instance\n this.instances.set(instanceId, localState);\n\n // Execute workflow steps\n console.log(`[WorkflowLocalEngine] ⚙️ Executing workflow steps...`);\n const pendingTask = await this.executeWorkflowSteps(localState);\n\n // Update state\n localState.state.lastUpdated = new Date();\n\n console.log(`[WorkflowLocalEngine] ✅ Workflow started:`, {\n instanceId,\n status: localState.state.status,\n hasPendingTask: !!pendingTask,\n pendingTaskType: pendingTask?.activityType,\n });\n\n return {\n instanceId,\n state: localState.state,\n pendingTask: pendingTask || null,\n activityOutputs: localState.state.activityOutputs,\n lastActivityOutput: localState.state.lastActivityOutput,\n };\n }\n\n /**\n * Resume a suspended workflow instance.\n *\n * Validates task token, applies externally executed result,\n * and continues progressing workflow steps.\n */\n async resume(request: AXPResumeWorkflowRequest): Promise<AXPResumeWorkflowResponse> {\n // Validate task token\n const tokenInfo = this.taskTokens.get(request.taskToken);\n if (!tokenInfo || tokenInfo.instanceId !== request.instanceId || tokenInfo.activityId !== request.stepId) {\n throw new Error('Invalid task token');\n }\n\n // Get instance\n const localState = this.instances.get(request.instanceId);\n if (!localState) {\n throw new Error(`Workflow instance not found: ${request.instanceId}`);\n }\n\n // Store activity result (from external execution)\n const outcome = request.outcome ?? 'Done';\n localState.activityResults.set(request.stepId, {\n output: request.userInput || {},\n outcome,\n });\n localState.completedActivities.add(request.stepId);\n\n // Store activity output for expression evaluation\n localState.state.activityOutputs = {\n ...(localState.state.activityOutputs || {}),\n [request.stepId]: request.userInput || {},\n };\n localState.state.lastActivityOutput = request.userInput || {};\n\n // Merge output/userInput into state variables\n if (request.userInput) {\n localState.state.variables = {\n ...localState.state.variables,\n ...(request.userInput || {}),\n };\n }\n localState.state.variables = {\n ...localState.state.variables,\n [`${request.stepId}_outcome`]: outcome,\n [`${request.stepId}_activityOutput`]: request.userInput || {},\n };\n\n // Mark activity as completed and continue progression\n // Continue progressing workflow steps (skipping backend activities)\n const nextTask = await this.executeWorkflowSteps(localState);\n\n // Update state\n localState.state.lastUpdated = new Date();\n\n // Determine final status\n if (!nextTask && localState.state.status === 'running') {\n localState.state.status = 'completed';\n localState.state.output = localState.state.variables;\n }\n\n return {\n output: request.userInput || {},\n outcomes: { [outcome]: true },\n state: localState.state,\n nextTask: nextTask || null,\n };\n }\n\n /**\n * Get current workflow instance state.\n */\n async getState(request: AXPGetWorkflowStateRequest): Promise<AXPWorkflowInstanceState> {\n const localState = this.instances.get(request.instanceId);\n if (!localState) {\n throw new Error(`Workflow instance not found: ${request.instanceId}`);\n }\n\n // Normalize lastUpdated to Date (for cache safety)\n const state = { ...localState.state };\n if (state.lastUpdated && !(state.lastUpdated instanceof Date)) {\n state.lastUpdated = new Date(state.lastUpdated);\n }\n\n return state;\n }\n\n //#endregion\n\n //#region ---- Private Methods ----\n\n /**\n * Get workflow definition from available providers.\n */\n private async getDefinition(workflowId: string): Promise<AXPWorkflowDefinition | null> {\n // Try all providers in order\n const resolvedProviders = await Promise.allSettled(this.workflowProviders);\n for (const p of resolvedProviders) {\n if (p.status === 'fulfilled' && p.value) {\n const provider = p.value;\n // Check if provider has getByName method\n if (typeof provider.getByName === 'function') {\n try {\n const definition = await provider.getByName(workflowId);\n if (definition) {\n return definition;\n }\n } catch {\n // Continue on error - try other providers\n }\n }\n }\n }\n\n return null;\n }\n\n /**\n * Progress workflow steps starting from the current position.\n *\n * For frontend/both activities: returns task immediately (suspends workflow).\n * For backend activities: skips and continues.\n *\n * Returns the next pending task (if frontend activity found) or null (if completed).\n */\n private async executeWorkflowSteps(localState: LocalWorkflowState): Promise<AXPWorkflowTask | null> {\n const graph = localState.definition.graph;\n const activities = graph.activities || [];\n const connections = graph.connections || [];\n\n // Build activity map\n const activityMap = new Map<string, AXPWorkflowActivityInstance>();\n activities.forEach((activity) => {\n activityMap.set(activity.id, activity);\n });\n\n // Build connection graph\n const outgoingConnections = new Map<string, AXPConnection[]>();\n const incomingConnections = new Map<string, AXPConnection[]>();\n\n connections.forEach((conn) => {\n const sourceId = conn.source.activtyName;\n const targetId = conn.target.activtyName;\n\n if (!outgoingConnections.has(sourceId)) {\n outgoingConnections.set(sourceId, []);\n }\n outgoingConnections.get(sourceId)!.push(conn);\n\n if (!incomingConnections.has(targetId)) {\n incomingConnections.set(targetId, []);\n }\n incomingConnections.get(targetId)!.push(conn);\n });\n\n // Find starting activity (use startActivityId or no incoming connections, or first activity)\n let currentActivityId = localState.currentActivityId;\n if (!currentActivityId) {\n // Use startActivityId if available\n if (graph.startActivityId) {\n currentActivityId = graph.startActivityId;\n } else {\n // Find root activity (no incoming connections)\n for (const activity of activities) {\n if (!incomingConnections.has(activity.id)) {\n currentActivityId = activity.id;\n break;\n }\n }\n // If no root found, use first activity\n if (!currentActivityId && activities.length > 0) {\n currentActivityId = activities[0].id;\n }\n }\n }\n\n // Execute workflow steps\n while (currentActivityId) {\n const activity = activityMap.get(currentActivityId);\n if (!activity) {\n break;\n }\n\n // Skip if already completed\n if (localState.completedActivities.has(currentActivityId)) {\n // Move to next activity\n const nextId = this.getNextActivityId(currentActivityId, outgoingConnections, localState.activityResults);\n currentActivityId = nextId ?? undefined;\n continue;\n }\n\n // Get activity definition to retrieve executionMode and title\n console.log(`[WorkflowLocalEngine] 🔍 Getting activity definition for: ${activity.name}`);\n const activityDefinition = await this.activityDefinitionService.getActivityByName(activity.name);\n console.log(`[WorkflowLocalEngine] 📋 Activity definition:`, {\n name: activityDefinition?.name,\n type: activityDefinition?.type,\n executionMode: activityDefinition?.executionMode,\n title: activityDefinition?.title,\n found: !!activityDefinition,\n });\n\n const executionMode = activityDefinition?.executionMode || 'frontend';\n const activityTitle = this.multiLanguageResolver.resolve(activityDefinition?.title) || activityDefinition?.name;\n\n // Handle backend activities: skip\n if (executionMode === 'backend') {\n console.log(`[WorkflowLocalEngine] ⏭️ Skipping backend activity: ${activity.name} (${activity.id})`);\n localState.completedActivities.add(currentActivityId);\n localState.activityResults.set(currentActivityId, {\n output: null,\n outcome: 'Done',\n });\n\n // Move to next activity\n const nextId = this.getNextActivityId(currentActivityId, outgoingConnections, localState.activityResults);\n currentActivityId = nextId ?? undefined;\n continue;\n }\n\n // Handle frontend/both activities: return as pendingTask (do NOT execute)\n if (executionMode === 'frontend' || executionMode === 'both') {\n // Create task for external execution\n // Note: Expression evaluation will be done by ActivityExecutor\n const task: AXPWorkflowTask = {\n taskToken: AXPDataGenerator.uuid(),\n activityId: activity.id,\n activityType: activity.name,\n activityName: activityTitle || undefined,\n executionMode: executionMode as 'frontend' | 'backend' | 'both',\n input: activity.inputs || {}, // Pass raw inputs - executor will evaluate\n };\n\n // Store task token for secure resume\n this.taskTokens.set(task.taskToken, {\n instanceId: localState.instanceId,\n activityId: activity.id,\n });\n\n // Update state to indicate suspension\n localState.currentActivityId = currentActivityId;\n localState.state.status = 'suspended';\n localState.state.currentStepId = currentActivityId;\n\n // Return task immediately - AXPWorkflowManager will execute it\n return task;\n }\n\n // Move to next activity\n const nextId = this.getNextActivityId(currentActivityId, outgoingConnections, localState.activityResults);\n currentActivityId = nextId ?? undefined;\n }\n\n // Workflow completed\n localState.state.status = 'completed';\n localState.state.output = localState.state.variables;\n localState.currentActivityId = undefined;\n\n return null;\n }\n\n /**\n * Get next activity ID based on connections and outcomes.\n */\n private getNextActivityId(\n currentActivityId: string,\n outgoingConnections: Map<string, AXPConnection[]>,\n activityResults: Map<string, { output: any; outcome?: string }>,\n ): string | null {\n const connections = outgoingConnections.get(currentActivityId) || [];\n\n if (connections.length === 0) {\n return null; // No outgoing connections - workflow ends\n }\n\n // Get current activity result\n const result = activityResults.get(currentActivityId);\n const outcome = result?.outcome || 'Done';\n\n // Find connection matching outcome\n // Outcome matching is typically done via port name (e.g., \"Done\", \"Failed\")\n for (const conn of connections) {\n const sourcePort = conn.source.port || 'Done';\n if (sourcePort === outcome) {\n return conn.target.activtyName;\n }\n }\n\n // If no matching outcome, use first connection (default path)\n if (connections.length > 0) {\n return connections[0].target.activtyName;\n }\n\n return null;\n }\n\n async frontActivtyComplete(request: AXPFrontActivityCompleteRequest): Promise<AXPFrontActivityCompleteResponse> {\n const localState = this.instances.get(request.instanceId);\n if (!localState) {\n throw new Error(`Workflow instance not found: ${request.instanceId}`);\n }\n\n // Store activity result\n const outcome = request.outcome ?? 'Done';\n localState.activityResults.set(request.activityNode, {\n output: request.output || {},\n outcome,\n });\n localState.completedActivities.add(request.activityNode);\n\n // Store outputs for expression evaluation\n localState.state.activityOutputs = {\n ...(localState.state.activityOutputs || {}),\n [request.activityNode]: request.output || {},\n };\n localState.state.lastActivityOutput = request.output || {};\n\n // Merge output into workflow variables\n localState.state.variables = {\n ...localState.state.variables,\n ...(request.output || {}),\n };\n\n // Continue workflow progression\n const nextTask = await this.executeWorkflowSteps(localState);\n\n // Update state timestamp\n localState.state.lastUpdated = new Date();\n\n // Determine final status\n if (!nextTask && localState.state.status === 'running') {\n localState.state.status = 'completed';\n localState.state.output = localState.state.variables;\n }\n\n return {\n output: request.output || {},\n outcomes: { [outcome]: true },\n nextTask: nextTask || null,\n state: localState.state,\n };\n }\n\n //#endregion\n}\n","// Workflow Runtime Services\nexport * from './workflow-engine';\nexport * from './workflow-runtime.types';\nexport * from './workflow-manager.service';\nexport * from './workflow-local-engine';\nexport * from './activity-executor.service';\nexport * from './workflow-expression-scope.service';\nexport * from './workflow-engine';","//#region ---- Imports ----\n\nimport { inject, Injectable } from '@angular/core';\nimport { AXPWorkflowCategory } from './workflow-definition.provider';\nimport { AXPWorkflowDefinition } from '../workflow-definition.types';\nimport { AXP_WORKFLOW_CATEGORY_PROVIDER, AXP_WORKFLOW_PROVIDER } from './workflow-definition.provider';\n\n//#endregion\n\n/**\n * Optimized Workflow Definition Service\n * \n * Manages workflow definitions (metadata) for UI and tooling.\n * Similar to AXPActivityDefinitionService - only handles metadata, not execution.\n * \n * Performance optimizations:\n * 1. Uses childrenCount to determine if category has children (no query needed)\n * 2. Uses itemsCount to determine if category has workflows (no query needed)\n * 3. Aggressive caching prevents duplicate API calls\n * 4. Single pending request per resource prevents race conditions\n * 5. Lazy loading - only loads data when needed\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPWorkflowDefinitionService {\n //#region ---- Providers & Caches ----\n\n private readonly categoryProviders = inject(AXP_WORKFLOW_CATEGORY_PROVIDER, { optional: true }) || [];\n private readonly workflowProviders = inject(AXP_WORKFLOW_PROVIDER, { optional: true }) || [];\n\n //#endregion\n\n //#region ---- Cache Storage ----\n\n /** Cache for categories by id - O(1) lookup */\n private categoriesById = new Map<string, AXPWorkflowCategory>();\n\n /** Cache for categories by parentId - O(1) lookup */\n private categoriesByParentId = new Map<string | undefined, AXPWorkflowCategory[]>();\n\n /** Cache for workflow definitions by categoryId - O(1) lookup */\n private workflowsByCategory = new Map<string, AXPWorkflowDefinition[]>();\n\n /** Cache for individual workflow definitions by name - O(1) lookup */\n private workflowsByName = new Map<string, AXPWorkflowDefinition>();\n\n /** Track which provider index owns each category (by category ID) */\n private categoryOwnership = new Map<string, number>(); // Maps categoryId → provider index\n\n /** Pending API requests to prevent duplicate calls */\n private pendingCategoriesRequests = new Map<string | undefined, Promise<AXPWorkflowCategory[]>>();\n private pendingWorkflowsRequests = new Map<string, Promise<AXPWorkflowDefinition[]>>();\n private pendingWorkflowRequests = new Map<string, Promise<AXPWorkflowDefinition | undefined>>();\n\n //#endregion\n\n //#region ---- Public API: Categories ----\n\n /**\n * Get categories by parentId with aggressive caching\n * \n * Optimization: Returns cached result immediately if available,\n * preventing unnecessary API calls during navigation\n * \n * @param parentId - Parent category ID (undefined = root categories)\n * @returns Array of categories with count metadata (childrenCount, itemsCount)\n */\n async getCategories(parentId?: string): Promise<AXPWorkflowCategory[]> {\n // ✅ Fast path: Return cached result\n if (this.categoriesByParentId.has(parentId)) {\n return this.categoriesByParentId.get(parentId)!;\n }\n\n // ✅ Prevent duplicate requests: Return pending promise\n if (this.pendingCategoriesRequests.has(parentId)) {\n return this.pendingCategoriesRequests.get(parentId)!;\n }\n\n // ✅ Create single request and cache it\n const requestPromise = this.loadCategoriesFromProviders(parentId);\n this.pendingCategoriesRequests.set(parentId, requestPromise);\n\n return requestPromise;\n }\n\n /**\n * Get single category by ID with O(1) lookup\n * \n * Optimization: Uses Map for instant retrieval, falls back to\n * searching cache, then providers if not found\n */\n async getCategoryById(categoryId: string): Promise<AXPWorkflowCategory | undefined> {\n // ✅ Fast path: O(1) lookup in cache\n if (this.categoriesById.has(categoryId)) {\n return this.categoriesById.get(categoryId);\n }\n\n // ✅ Search in cached parent-child lists\n for (const categories of this.categoriesByParentId.values()) {\n const found = categories.find(cat => cat.id === categoryId);\n if (found) {\n this.categoriesById.set(categoryId, found);\n return found;\n }\n }\n\n // ✅ Load root categories if not loaded\n if (!this.categoriesByParentId.has(undefined)) {\n await this.getCategories();\n if (this.categoriesById.has(categoryId)) {\n return this.categoriesById.get(categoryId);\n }\n }\n\n // ✅ Breadth-first search through hierarchy\n return this.searchCategoryInHierarchy(categoryId);\n }\n\n /**\n * Get category path from root to specified category\n * \n * Optimization: Builds path using cached categories only\n */\n async getCategoriesPathById(categoryId: string): Promise<AXPWorkflowCategory[]> {\n const path: AXPWorkflowCategory[] = [];\n let currentCategoryId: string | undefined = categoryId;\n\n while (currentCategoryId) {\n const category = await this.getCategoryById(currentCategoryId);\n if (!category) {\n throw new Error(`Category '${currentCategoryId}' not found`);\n }\n path.unshift(category);\n currentCategoryId = category.parentId;\n }\n\n return path;\n }\n\n //#endregion\n\n //#region ---- Public API: Workflow Definitions ----\n\n /**\n * Get workflow definitions for a category with smart caching\n * \n * Optimization: Checks itemsCount before querying\n * - If itemsCount = 0, returns empty array (no API call)\n * - If itemsCount > 0, loads and caches workflow definitions\n * - Returns cached result on subsequent calls\n * \n * @param categoryId - Category ID to get workflow definitions from\n * @returns Array of workflow definitions\n */\n async getWorkflowsByCategoryId(categoryId: string): Promise<AXPWorkflowDefinition[]> {\n // ✅ Fast path: Return cached result\n if (this.workflowsByCategory.has(categoryId)) {\n return this.workflowsByCategory.get(categoryId)!;\n }\n\n // ✅ Smart optimization: Check itemsCount before querying\n const category = await this.getCategoryById(categoryId);\n if (category && category.itemsCount !== undefined && category.itemsCount === 0) {\n // Category has no workflows - cache empty array and skip API call\n const emptyArray: AXPWorkflowDefinition[] = [];\n this.workflowsByCategory.set(categoryId, emptyArray);\n return emptyArray;\n }\n\n // ✅ Prevent duplicate requests\n if (this.pendingWorkflowsRequests.has(categoryId)) {\n return this.pendingWorkflowsRequests.get(categoryId)!;\n }\n\n // ✅ Load from providers\n const requestPromise = this.loadWorkflowsFromProviders(categoryId);\n this.pendingWorkflowsRequests.set(categoryId, requestPromise);\n\n return requestPromise;\n }\n\n /**\n * Get single workflow definition by name with O(1) lookup\n * \n * Optimization: Uses Map for instant retrieval\n * \n * @param name - Workflow name (unique identifier)\n * @returns Workflow definition or undefined if not found\n */\n async getWorkflowByName(name: string): Promise<AXPWorkflowDefinition | undefined> {\n // ✅ Fast path: O(1) lookup in cache\n if (this.workflowsByName.has(name)) {\n return this.workflowsByName.get(name);\n }\n\n // ✅ Prevent duplicate requests\n if (this.pendingWorkflowRequests.has(name)) {\n return this.pendingWorkflowRequests.get(name)!;\n }\n\n // ✅ Load from providers\n const requestPromise = this.loadWorkflowFromProviders(name);\n this.pendingWorkflowRequests.set(name, requestPromise);\n\n return requestPromise;\n }\n\n /**\n * Get category ID containing a specific workflow definition\n * \n * Optimization: Searches cache first, loads on-demand if needed\n */\n async getCategoryIdByWorkflowName(workflowName: string): Promise<string | undefined> {\n // ✅ Search in cached workflow definitions\n for (const [categoryId, definitions] of this.workflowsByCategory.entries()) {\n if (definitions.some(def => def.name === workflowName)) {\n return categoryId;\n }\n }\n\n // ✅ Try loading the workflow definition to find its category\n // Note: AXPWorkflowDefinition doesn't have category field\n // Category is managed separately through category providers\n // This method searches through cached categories\n const definition = await this.getWorkflowByName(workflowName);\n if (definition) {\n // Search through all categories to find which one contains this workflow\n const categories = await this.getCategories();\n for (const category of categories) {\n const workflows = await this.getWorkflowsByCategoryId(category.id);\n if (workflows.some(w => w.name === workflowName)) {\n return category.id;\n }\n }\n }\n\n return undefined;\n }\n\n /**\n * Get category path for a workflow\n */\n async getCategoriesPathByWorkflowName(workflowName: string): Promise<AXPWorkflowCategory[]> {\n const categoryId = await this.getCategoryIdByWorkflowName(workflowName);\n if (!categoryId) {\n throw new Error(`Workflow '${workflowName}' not found in any category`);\n }\n return this.getCategoriesPathById(categoryId);\n }\n\n //#endregion\n\n //#region ---- Private: Data Loading ----\n\n /**\n * Load categories from providers and cache results\n * \n * Optimization: Tracks provider ownership to avoid unnecessary API calls\n * - For root (parentId = undefined): Query ALL providers\n * - For children: Only query the provider that owns the parent\n */\n private async loadCategoriesFromProviders(parentId?: string): Promise<AXPWorkflowCategory[]> {\n try {\n const resolvedProviders = await Promise.allSettled(this.categoryProviders);\n const categories: AXPWorkflowCategory[] = [];\n\n // Determine which provider(s) to query\n const providerIndicesToQuery = parentId\n ? this.getProviderIndexForCategory(parentId)\n : null; // Root: query all providers\n\n for (let i = 0; i < resolvedProviders.length; i++) {\n const p = resolvedProviders[i];\n\n // Skip if we have a specific provider index and this isn't it\n if (providerIndicesToQuery !== null && !providerIndicesToQuery.includes(i)) {\n continue;\n }\n\n if (p.status === 'fulfilled' && p.value && typeof p.value.getList === 'function') {\n try {\n const cats = await p.value.getList(parentId);\n if (Array.isArray(cats) && cats.length > 0) {\n categories.push(...cats);\n\n // ✅ Track ownership: This provider INDEX owns these categories\n cats.forEach(cat => this.categoryOwnership.set(cat.id, i));\n }\n } catch {\n // Continue on error - try other providers\n }\n }\n }\n\n // ✅ Cache results for fast subsequent access\n this.categoriesByParentId.set(parentId, categories);\n categories.forEach(cat => this.categoriesById.set(cat.id, cat));\n\n return categories;\n } finally {\n this.pendingCategoriesRequests.delete(parentId);\n }\n }\n\n /**\n * Get the provider index that owns a specific category\n * \n * @returns Array with provider index, or null if ownership unknown (query all)\n */\n private getProviderIndexForCategory(categoryId: string): number[] | null {\n const ownerIndex = this.categoryOwnership.get(categoryId);\n\n if (ownerIndex !== undefined) {\n return [ownerIndex];\n }\n\n // Ownership unknown - will query all providers (fallback)\n return null;\n }\n\n /**\n * Load workflow definitions from providers and cache results\n * \n * Optimization: Only queries the provider that owns the category\n * Uses provider INDEX to match category provider with workflow provider\n */\n private async loadWorkflowsFromProviders(categoryId: string): Promise<AXPWorkflowDefinition[]> {\n try {\n const resolvedProviders = await Promise.allSettled(this.workflowProviders);\n const definitions: AXPWorkflowDefinition[] = [];\n\n // ✅ Smart routing: Get provider INDEX that owns this category\n const ownerIndex = this.categoryOwnership.get(categoryId);\n const providerIndicesToQuery = ownerIndex !== undefined ? [ownerIndex] : null;\n\n for (let i = 0; i < resolvedProviders.length; i++) {\n const p = resolvedProviders[i];\n\n // Skip if we have a specific provider index and this isn't it\n if (providerIndicesToQuery !== null && !providerIndicesToQuery.includes(i)) {\n continue;\n }\n\n if (p.status === 'fulfilled' && p.value && typeof p.value.getList === 'function') {\n try {\n const defs = await p.value.getList(categoryId);\n if (Array.isArray(defs)) {\n definitions.push(...defs);\n }\n } catch {\n // Continue on error - try other providers\n }\n }\n }\n\n // ✅ Cache results for fast subsequent access\n this.workflowsByCategory.set(categoryId, definitions);\n definitions.forEach(def => {\n if (def.name) {\n this.workflowsByName.set(def.name, def);\n }\n });\n\n return definitions;\n } finally {\n this.pendingWorkflowsRequests.delete(categoryId);\n }\n }\n\n /**\n * Load single workflow definition from providers and cache result\n */\n private async loadWorkflowFromProviders(name: string): Promise<AXPWorkflowDefinition | undefined> {\n try {\n const resolvedProviders = await Promise.allSettled(this.workflowProviders);\n\n // Try providers first\n for (const p of resolvedProviders) {\n if (p.status === 'fulfilled' && p.value && typeof p.value.getByName === 'function') {\n try {\n const definition = await p.value.getByName(name);\n if (definition) {\n this.workflowsByName.set(name, definition);\n return definition;\n }\n } catch {\n // Continue on error\n }\n }\n }\n\n // Fallback: Search in cached workflow definitions\n for (const definitions of this.workflowsByCategory.values()) {\n const found = definitions.find(def => def.name === name);\n if (found) {\n this.workflowsByName.set(name, found);\n return found;\n }\n }\n\n return undefined;\n } finally {\n this.pendingWorkflowRequests.delete(name);\n }\n }\n\n /**\n * Breadth-first search through category hierarchy\n */\n private async searchCategoryInHierarchy(categoryId: string): Promise<AXPWorkflowCategory | undefined> {\n const searchQueue: (string | undefined)[] = [undefined];\n const searched = new Set<string | undefined>();\n\n while (searchQueue.length > 0) {\n const parentId = searchQueue.shift()!;\n if (searched.has(parentId)) continue;\n searched.add(parentId);\n\n const categories = await this.getCategories(parentId);\n const found = categories.find(cat => cat.id === categoryId);\n\n if (found) {\n return found;\n }\n\n // ✅ Optimization: Only search children if childrenCount > 0\n for (const category of categories) {\n if (category.childrenCount > 0 && !searched.has(category.id)) {\n searchQueue.push(category.id);\n }\n }\n }\n\n return undefined;\n }\n\n //#endregion\n\n //#region ---- Cache Management ----\n\n /**\n * Check if category has children (uses cached count)\n */\n categoryHasChildren(categoryId: string): boolean {\n const category = this.categoriesById.get(categoryId);\n return category ? category.childrenCount > 0 : false;\n }\n\n /**\n * Check if category has workflows (uses cached count)\n */\n categoryHasWorkflows(categoryId: string): boolean {\n const category = this.categoriesById.get(categoryId);\n return category ? (category.itemsCount ?? 0) > 0 : false;\n }\n\n /**\n * Clear all caches\n */\n clearAllCache(): void {\n this.categoriesById.clear();\n this.categoriesByParentId.clear();\n this.workflowsByCategory.clear();\n this.workflowsByName.clear();\n this.categoryOwnership.clear();\n this.pendingCategoriesRequests.clear();\n this.pendingWorkflowsRequests.clear();\n this.pendingWorkflowRequests.clear();\n }\n\n /**\n * Clear categories cache only\n */\n clearCategoriesCache(): void {\n this.categoriesById.clear();\n this.categoriesByParentId.clear();\n this.categoryOwnership.clear();\n this.pendingCategoriesRequests.clear();\n }\n\n /**\n * Clear workflows cache only\n */\n clearWorkflowsCache(): void {\n this.workflowsByCategory.clear();\n this.workflowsByName.clear();\n this.pendingWorkflowsRequests.clear();\n this.pendingWorkflowRequests.clear();\n }\n\n //#endregion\n}\n\n","// Workflow Definition Types (Storage/Database)\n// Export workflow definition types\nexport type {\n AXPWorkflowDefinition,\n AXPWorkflowGraph,\n AXPWorkflowActivityInstance,\n AXPConnection,\n AXPWorkflowOutputProperty,\n AXPWorkflowExtensions,\n AXPElsaWorkflowExtensions,\n AXPWorkflowBinding,\n} from './workflow-definition.types';\n\n// Workflow Instance Types (Storage/Database)\nexport * from './workflow-instance.types';\n\n\n// Re-export Workflow Instance types\nexport type {\n AXPWorkflowInstance,\n AXPWorkflowState,\n AXPWorkflowStatus,\n AXPWorkflowSubStatus,\n AXPActivityStatus,\n AXPExceptionState,\n AXPActivityIncident,\n AXPWorkflowFaultState,\n AXPBookmark,\n AXPCompletionCallbackState,\n AXPActivityVariable,\n AXPActivityExecutionContextState,\n} from './workflow-instance.types';\n\n// Activity System Types (Simplified)\nexport * from './activity/activity.types';\n\nexport * from './activity';\n\n// Simple Runtime (Coordinator only)\nexport * from './runtime';\n\n// Workflow Definition System (Category + Metadata)\nexport * from './workflow/workflow-definition.provider';\nexport * from './workflow/workflow-definition.service';","import { Inject, ModuleWithProviders, NgModule, Optional, Type, inject } from '@angular/core';\nimport { AXPWorkflowDecideAction } from './actions/decide.action';\nimport { AXPStartWorkflowAction } from './actions/start-workflow.action';\nimport { AXPWorkflowRegistryService } from './workflow-registery.service';\nimport { AXPWorkflow, AXPWorkflowAction, AXPWorkflowFunction } from './workflow.types';\nimport { AXP_WORKFLOW_ENGINE, AXPWorkflowLocalEngine } from './engine';\nimport { AXPWorkflowManager } from './engine/runtime/workflow-manager.service';\nexport interface AXPWorkflowModuleConfigs {\n functions?: {\n [name: string]: Type<AXPWorkflowFunction>;\n };\n actions?: {\n [name: string]: Type<AXPWorkflowAction>;\n };\n workflows?: {\n [name: string]: AXPWorkflow;\n };\n}\n\n@NgModule({\n imports: [],\n exports: [],\n declarations: [],\n providers: [\n AXPWorkflowLocalEngine,\n {\n provide: AXP_WORKFLOW_ENGINE,\n useExisting: AXPWorkflowLocalEngine,\n },\n AXPWorkflowManager,\n ],\n})\nexport class AXPWorkflowModule {\n\n static forRoot(config?: AXPWorkflowModuleConfigs): ModuleWithProviders<AXPWorkflowModule> {\n return {\n ngModule: AXPWorkflowModule,\n providers: [\n {\n provide: 'AXPWorkflowModuleFactory',\n useFactory: (registry: AXPWorkflowRegistryService) => () => {\n registry.registerAction('start-workflow', AXPStartWorkflowAction);\n registry.registerAction('decide', AXPWorkflowDecideAction);\n //\n if (config?.functions) {\n for (const [key, type] of Object.entries(config.functions)) {\n registry.registerFunction(key, type);\n }\n }\n //\n if (config?.actions) {\n for (const [key, type] of Object.entries(config.actions)) {\n registry.registerAction(key, type);\n }\n }\n //\n if (config?.workflows) {\n for (const [key, type] of Object.entries(config.workflows)) {\n registry.registerWorkflow(key, type);\n }\n }\n },\n deps: [AXPWorkflowRegistryService],\n multi: true,\n },\n ...Object.values(config?.actions ?? { AXPStartWorkflowAction }),\n ...Object.values(config?.functions ?? {}),\n ],\n };\n }\n\n static forChild(config?: AXPWorkflowModuleConfigs): ModuleWithProviders<AXPWorkflowModule> {\n return {\n ngModule: AXPWorkflowModule,\n providers: [\n // Built-in activities are already registered in forRoot via @NgModule providers\n // No need to register again in forChild\n {\n provide: 'AXPWorkflowModuleFactory',\n useFactory: (registry: AXPWorkflowRegistryService) => () => {\n registry.registerAction('start-workflow', AXPStartWorkflowAction);\n registry.registerAction('decide', AXPWorkflowDecideAction);\n //\n if (config?.functions) {\n for (const [key, type] of Object.entries(config.functions)) {\n registry.registerFunction(key, type);\n }\n }\n //\n if (config?.actions) {\n for (const [key, type] of Object.entries(config.actions)) {\n registry.registerAction(key, type);\n }\n }\n //\n if (config?.workflows) {\n for (const [key, type] of Object.entries(config.workflows)) {\n registry.registerWorkflow(key, type);\n }\n }\n },\n deps: [AXPWorkflowRegistryService],\n multi: true,\n },\n ...Object.values(config?.actions ?? {}),\n ...Object.values(config?.functions ?? {}),\n ],\n };\n }\n\n /**\n * @ignore\n */\n constructor(@Optional() @Inject('AXPWorkflowModuleFactory') instances: any[]) {\n instances?.forEach((f) => {\n f();\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.AXPWorkflowRegistryService"],"mappings":";;;;;;;;AAAM,MAAO,gBAAiB,SAAQ,KAAK,CAAA;IACvC,WAAA,CAAY,OAAe,EAAS,KAAA,GAAsB,IAAI,EAAA;QAC1D,KAAK,CAAC,OAAO,CAAC;QADkB,IAAA,CAAA,KAAK,GAAL,KAAK;AAErC,QAAA,IAAI,CAAC,IAAI,GAAG,kBAAkB;IAClC;AACH;;MCEY,uBAAuB,CAAA;AAHpC,IAAA,WAAA,GAAA;AAIU,QAAA,IAAA,CAAA,YAAY,GAAG,IAAI,OAAO,EAAoB;AASvD,IAAA;AAPC,IAAA,QAAQ,CAAC,KAAuB,EAAA;AAC9B,QAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;IAC/B;AAEA,IAAA,IAAI,OAAO,GAAA;AACT,QAAA,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE;IACzC;8GATW,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAvB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uBA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