@acorex-platform/module-task-management-client 0.0.21

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 (19) hide show
  1. package/fesm2022/acorex-platform-module-task-management-client-acorex-platform-module-task-management-client-CIwafWli.mjs +4445 -0
  2. package/fesm2022/acorex-platform-module-task-management-client-acorex-platform-module-task-management-client-CIwafWli.mjs.map +1 -0
  3. package/fesm2022/acorex-platform-module-task-management-client-contracts.mjs +183 -0
  4. package/fesm2022/acorex-platform-module-task-management-client-contracts.mjs.map +1 -0
  5. package/fesm2022/acorex-platform-module-task-management-client-list-task-board-assignees.query-Ci8_D4Vs.mjs +129 -0
  6. package/fesm2022/acorex-platform-module-task-management-client-list-task-board-assignees.query-Ci8_D4Vs.mjs.map +1 -0
  7. package/fesm2022/acorex-platform-module-task-management-client-list-task-board-reporters.query-C3NAYa9b.mjs +76 -0
  8. package/fesm2022/acorex-platform-module-task-management-client-list-task-board-reporters.query-C3NAYa9b.mjs.map +1 -0
  9. package/fesm2022/acorex-platform-module-task-management-client-list-task-types.query-CKLUPrBU.mjs +53 -0
  10. package/fesm2022/acorex-platform-module-task-management-client-list-task-types.query-CKLUPrBU.mjs.map +1 -0
  11. package/fesm2022/acorex-platform-module-task-management-client-start-task-flow.command-ChCuTFV-.mjs +114 -0
  12. package/fesm2022/acorex-platform-module-task-management-client-start-task-flow.command-ChCuTFV-.mjs.map +1 -0
  13. package/fesm2022/acorex-platform-module-task-management-client-task-board.page-8I8H2pFq.mjs +2743 -0
  14. package/fesm2022/acorex-platform-module-task-management-client-task-board.page-8I8H2pFq.mjs.map +1 -0
  15. package/fesm2022/acorex-platform-module-task-management-client.mjs +2 -0
  16. package/fesm2022/acorex-platform-module-task-management-client.mjs.map +1 -0
  17. package/package.json +28 -0
  18. package/types/acorex-platform-module-task-management-client-contracts.d.ts +318 -0
  19. package/types/acorex-platform-module-task-management-client.d.ts +850 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-task-management-client-start-task-flow.command-ChCuTFV-.mjs","sources":["../../../../libs/modules/task-management/client/src/lib/features/task/commands/start-task-flow.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { type AXPEntityReference, AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXToastService } from '@acorex/components/toast';\n\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport { AXPWorkflowManager } from '@acorex-platform/framework-client/workflow';\nimport { defaultTo, get, isEmpty, merge } from 'lodash';\nimport { inject, Injectable } from '@angular/core';\nimport { AXPTaskManagementCommandKeys } from '@acorex-platform/module-task-management-client/contracts';\nimport { RootConfig } from '@acorex-platform/module-task-management-client/contracts';\nimport type { AXMTaskManagementTaskTypeEntityModel } from '@acorex-platform/module-task-management-client/contracts';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface StartTaskFlowInput {\n workflowId?: string;\n taskTypeId?: string;\n subjectRef?: AXPEntityReference;\n projectTypeId?: string;\n input?: Record<string, unknown>;\n options?: StartTaskFlowOptions;\n}\n\nexport interface StartTaskFlowOptions {\n workflowId: string;\n input: {\n taskTypeId: string;\n subjectRef: AXPEntityReference;\n projectTypeId?: string;\n taskTypeTitle?: string;\n } & Record<string, unknown>;\n}\n\n//#endregion\n\n/**\n * Starts a workflow for a {@link TaskManagement.Task} when the task type defines {@link workflowConfig}.\n */\n@Injectable({ providedIn: 'root' })\nexport class StartTaskFlowCommand implements AXPCommand<StartTaskFlowInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly toastService = inject(AXToastService);\n private readonly entityService = inject(AXPEntityService);\n private readonly workflowManager = inject(AXPWorkflowManager);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: StartTaskFlowInput): AXPCommandExecuteResultPromise<void> {\n const options = (input?.options ?? input) as StartTaskFlowOptions;\n const flowInput = defaultTo(options?.input, {} as StartTaskFlowOptions['input']);\n const workflowId = (options?.workflowId ?? input?.workflowId)?.trim();\n const taskTypeId = flowInput?.taskTypeId?.trim();\n const subjectRef = flowInput?.subjectRef ?? input?.subjectRef;\n const projectTypeId = flowInput?.projectTypeId?.trim() ?? input?.projectTypeId?.trim();\n\n if (!workflowId || !taskTypeId || !subjectRef?.id || !subjectRef?.type) {\n return { success: false, message: { text: 'Missing workflow, task type, or subject reference.' } };\n }\n\n try {\n const taskType = await this.loadTaskType(taskTypeId);\n if (!taskType) {\n return { success: false, message: { text: 'Task type not found.' } };\n }\n\n if (projectTypeId) {\n const allowed = await this.isTaskTypeAllowedForProjectType(projectTypeId, taskTypeId);\n if (!allowed) {\n return { success: false, message: { text: 'Task type is not allowed for this project type.' } };\n }\n }\n\n const defaultInput = defaultTo(get(taskType, 'workflowConfig.defaultInput'), {});\n const startResult = await this.workflowManager.start(workflowId, merge(\n defaultInput,\n {\n taskTypeId,\n taskTypeTitle: flowInput.taskTypeTitle ?? taskType.title,\n subjectRef,\n ...(projectTypeId ? { projectTypeId } : {}),\n refId: subjectRef.id,\n refType: subjectRef.type,\n correlationId: this.buildCorrelationId(subjectRef.id, taskTypeId, workflowId),\n },\n flowInput,\n ));\n\n if (!startResult.success) {\n this.toastService.show({\n color: 'danger',\n title: 'Workflow Execution Failed',\n content: startResult.error ?? 'Unknown error',\n closeButton: true,\n timeOut: 5000,\n });\n return { success: false, message: { text: startResult.error ?? 'Unknown error' } };\n }\n\n return { success: true, kind: 'object', data: undefined };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Unknown error';\n console.error('[StartTaskFlowCommand]', error);\n this.toastService.show({\n color: 'danger',\n title: 'Workflow Execution Error',\n content: message,\n closeButton: true,\n timeOut: 5000,\n });\n return { success: false, message: { text: message } };\n }\n }\n\n //#endregion\n\n //#region ---- Helpers ----\n\n private async loadTaskType(taskTypeId: string): Promise<AXMTaskManagementTaskTypeEntityModel | null> {\n const row = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.taskType.name)\n .data()\n .byKey(taskTypeId);\n return (row ?? null) as AXMTaskManagementTaskTypeEntityModel | null;\n }\n\n private async isTaskTypeAllowedForProjectType(projectTypeId: string, taskTypeId: string): Promise<boolean> {\n const projectType = (await this.entityService\n .withEntity('ProjectManagement', 'ProjectType')\n .data()\n .byKey(projectTypeId)) as {\n allowedTaskTypeIds?: string[];\n allowedTaskTypes?: Array<{ id: string }>;\n } | null;\n\n if (!projectType) {\n return false;\n }\n\n const allowedIds = projectType.allowedTaskTypes?.map((row) => row.id).filter(Boolean) ?? [];\n if (!isEmpty(allowedIds)) {\n return allowedIds.includes(taskTypeId);\n }\n\n return defaultTo(projectType.allowedTaskTypeIds, []).includes(taskTypeId);\n }\n\n private buildCorrelationId(subjectId: string, taskTypeId: string, workflowId: string): string {\n return `${subjectId}:${taskTypeId}:${workflowId}`;\n }\n\n //#endregion\n}\n\nexport const START_TASK_FLOW_COMMAND_KEY = AXPTaskManagementCommandKeys.Task.StartFlow;\n"],"names":[],"mappings":";;;;;;;;AAsCA;AAEA;;AAEG;MAEU,oBAAoB,CAAA;AADjC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC;AACrC,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,eAAe,GAAG,MAAM,CAAC,kBAAkB,CAAC;AA8G9D,IAAA;;;IAxGC,MAAM,OAAO,CAAC,KAAyB,EAAA;QACrC,MAAM,OAAO,IAAI,KAAK,EAAE,OAAO,IAAI,KAAK,CAAyB;QACjE,MAAM,SAAS,GAAG,SAAS,CAAC,OAAO,EAAE,KAAK,EAAE,EAAmC,CAAC;AAChF,QAAA,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,UAAU,IAAI,KAAK,EAAE,UAAU,GAAG,IAAI,EAAE;QACrE,MAAM,UAAU,GAAG,SAAS,EA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