@alfresco/adf-process-services-cloud 8.6.0-25384976868 → 8.6.0-25422856304

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.
@@ -327,6 +327,15 @@ class BaseCloudService {
327
327
  queryParams
328
328
  }));
329
329
  }
330
+ getWithBody(url, data, queryParams) {
331
+ return from(this.callApi(url, {
332
+ ...this.defaultParams,
333
+ path: url,
334
+ httpMethod: 'GET',
335
+ bodyParam: data,
336
+ queryParams
337
+ }));
338
+ }
330
339
  callApi(url, params) {
331
340
  return this.adfHttpClient.request(url, params);
332
341
  }
@@ -588,7 +597,7 @@ class TaskCloudService extends BaseCloudService {
588
597
  * @returns Boolean value if the task can be completed
589
598
  */
590
599
  canCompleteTask(taskDetails) {
591
- return taskDetails && taskDetails.status === TASK_ASSIGNED_STATE && this.isAssignedToMe(taskDetails.assignee);
600
+ return taskDetails?.status === TASK_ASSIGNED_STATE && this.isAssignedToMe(taskDetails.assignee);
592
601
  }
593
602
  /**
594
603
  * Validate if a task is editable.
@@ -597,7 +606,7 @@ class TaskCloudService extends BaseCloudService {
597
606
  * @returns Boolean value if the task is editable
598
607
  */
599
608
  isTaskEditable(taskDetails) {
600
- return taskDetails && taskDetails.status === TASK_ASSIGNED_STATE && this.isAssignedToMe(taskDetails.assignee);
609
+ return this.canCompleteTask(taskDetails);
601
610
  }
602
611
  isAssigneePropertyClickable(taskDetails, candidateUsers, candidateGroups) {
603
612
  let isClickable = false;
@@ -607,6 +616,15 @@ class TaskCloudService extends BaseCloudService {
607
616
  }
608
617
  return isClickable;
609
618
  }
619
+ /**
620
+ * Validates if a task was completed by the current user.
621
+ *
622
+ * @param taskDetails task details object
623
+ * @returns Boolean value if the task was completed by the current user
624
+ */
625
+ wasTaskCompletedByCurrentUser(taskDetails) {
626
+ return taskDetails?.status === TASK_COMPLETED_STATE && this.isAssignedToMe(taskDetails.assignee);
627
+ }
610
628
  /**
611
629
  * Validate if a task can be claimed.
612
630
  *
@@ -673,11 +691,12 @@ class TaskCloudService extends BaseCloudService {
673
691
  *
674
692
  * @param appName Name of the app
675
693
  * @param taskId ID of the task whose details you want
694
+ * @param service The service to call. Either Query Service or Runtime Bundle Service.
676
695
  * @returns Task details
677
696
  */
678
- getTaskById(appName, taskId) {
697
+ getTaskById(appName, taskId, service = 'query') {
679
698
  if ((appName || appName === '') && taskId) {
680
- const queryUrl = `${this.getBasePath(appName)}/query/v1/tasks/${taskId}`;
699
+ const queryUrl = `${this.getBasePath(appName)}/${service}/v1/tasks/${taskId}`;
681
700
  return this.get(queryUrl).pipe(map((res) => res.entry));
682
701
  }
683
702
  else {
@@ -3177,7 +3196,7 @@ class TaskListCloudService extends BaseCloudService {
3177
3196
  * Retrieves a list of tasks using an object with optional query properties.
3178
3197
  *
3179
3198
  * @param requestNode Query object
3180
- * @param queryUrl Query url
3199
+ * @param queryUrl Query url. If empty, query service will be called.
3181
3200
  * @returns List of tasks
3182
3201
  */
3183
3202
  fetchTaskList(requestNode, queryUrl) {
@@ -3198,6 +3217,24 @@ class TaskListCloudService extends BaseCloudService {
3198
3217
  return response;
3199
3218
  }));
3200
3219
  }
3220
+ fetchTaskList_UsingRuntimeBundleService(requestNode) {
3221
+ if (!requestNode?.appName) {
3222
+ return throwError(() => new Error('Appname not configured'));
3223
+ }
3224
+ const url = `${this.getBasePath(requestNode.appName)}/rb/v1/tasks`;
3225
+ const queryParams = {
3226
+ maxItems: requestNode.pagination?.maxItems || 25,
3227
+ skipCount: requestNode.pagination?.skipCount || 0
3228
+ };
3229
+ const queryData = this.buildQueryData(requestNode);
3230
+ return this.getWithBody(url, queryData, queryParams).pipe(map((response) => {
3231
+ const entries = response.list?.entries;
3232
+ if (entries) {
3233
+ response.list.entries = entries.map((entryData) => entryData.entry);
3234
+ }
3235
+ return response;
3236
+ }));
3237
+ }
3201
3238
  getTaskListCounter(requestNode) {
3202
3239
  if (!requestNode.appName) {
3203
3240
  return throwError(() => new Error('Appname not configured'));