@uipath/uipath-typescript 1.2.0 → 1.2.2

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 (40) hide show
  1. package/dist/assets/index.cjs +1 -1
  2. package/dist/assets/index.d.ts +2 -1
  3. package/dist/assets/index.mjs +1 -1
  4. package/dist/attachments/index.cjs +1944 -0
  5. package/dist/attachments/index.d.ts +399 -0
  6. package/dist/attachments/index.mjs +1941 -0
  7. package/dist/buckets/index.cjs +1 -1
  8. package/dist/buckets/index.d.ts +4 -2
  9. package/dist/buckets/index.mjs +1 -1
  10. package/dist/cases/index.cjs +95 -48
  11. package/dist/cases/index.d.ts +31 -2
  12. package/dist/cases/index.mjs +95 -48
  13. package/dist/conversational-agent/index.cjs +38 -7
  14. package/dist/conversational-agent/index.d.ts +72 -6
  15. package/dist/conversational-agent/index.mjs +38 -7
  16. package/dist/core/index.cjs +118 -17
  17. package/dist/core/index.d.ts +26 -2
  18. package/dist/core/index.mjs +118 -17
  19. package/dist/entities/index.cjs +48 -1
  20. package/dist/entities/index.d.ts +106 -19
  21. package/dist/entities/index.mjs +48 -1
  22. package/dist/index.cjs +585 -267
  23. package/dist/index.d.ts +595 -67
  24. package/dist/index.mjs +586 -268
  25. package/dist/index.umd.js +582 -264
  26. package/dist/jobs/index.cjs +2036 -0
  27. package/dist/jobs/index.d.ts +724 -0
  28. package/dist/jobs/index.mjs +2033 -0
  29. package/dist/maestro-processes/index.cjs +1 -1
  30. package/dist/maestro-processes/index.mjs +1 -1
  31. package/dist/processes/index.cjs +67 -1
  32. package/dist/processes/index.d.ts +80 -15
  33. package/dist/processes/index.mjs +68 -2
  34. package/dist/queues/index.cjs +1 -1
  35. package/dist/queues/index.d.ts +2 -1
  36. package/dist/queues/index.mjs +1 -1
  37. package/dist/tasks/index.cjs +1319 -1272
  38. package/dist/tasks/index.d.ts +331 -287
  39. package/dist/tasks/index.mjs +1319 -1272
  40. package/package.json +25 -3
@@ -1722,7 +1722,7 @@ const BucketMap = {
1722
1722
  // Connection string placeholder that will be replaced during build
1723
1723
  const CONNECTION_STRING = "InstrumentationKey=a6efa11d-1feb-4508-9738-e13e12dcae5e;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/;ApplicationId=7c58eb1c-9581-4ba6-839e-11725848a037";
1724
1724
  // SDK Version placeholder
1725
- const SDK_VERSION = "1.2.0";
1725
+ const SDK_VERSION = "1.2.2";
1726
1726
  const VERSION = "Version";
1727
1727
  const SERVICE = "Service";
1728
1728
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -347,7 +347,8 @@ interface BucketGetResponse {
347
347
  type BucketGetAllOptions = RequestOptions & PaginationOptions & {
348
348
  folderId?: number;
349
349
  };
350
- type BucketGetByIdOptions = BaseOptions;
350
+ interface BucketGetByIdOptions extends BaseOptions {
351
+ }
351
352
  /**
352
353
  * Maps header names to their values
353
354
  *
@@ -401,7 +402,8 @@ interface BucketGetUriOptions extends BaseOptions {
401
402
  /**
402
403
  * Request options for getting a read URI for a file in a bucket
403
404
  */
404
- type BucketGetReadUriOptions = BucketGetUriOptions;
405
+ interface BucketGetReadUriOptions extends BucketGetUriOptions {
406
+ }
405
407
  /**
406
408
  * Request options for getting files in a bucket
407
409
  */
@@ -1720,7 +1720,7 @@ const BucketMap = {
1720
1720
  // Connection string placeholder that will be replaced during build
1721
1721
  const CONNECTION_STRING = "InstrumentationKey=a6efa11d-1feb-4508-9738-e13e12dcae5e;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/;ApplicationId=7c58eb1c-9581-4ba6-839e-11725848a037";
1722
1722
  // SDK Version placeholder
1723
- const SDK_VERSION = "1.2.0";
1723
+ const SDK_VERSION = "1.2.2";
1724
1724
  const VERSION = "Version";
1725
1725
  const SERVICE = "Service";
1726
1726
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -1789,6 +1789,8 @@ const TASK_ENDPOINTS = {
1789
1789
  COMPLETE_APP_TASK: `${ORCHESTRATOR_BASE}/tasks/AppTasks/CompleteAppTask`,
1790
1790
  COMPLETE_GENERIC_TASK: `${ORCHESTRATOR_BASE}/tasks/GenericTasks/CompleteTask`,
1791
1791
  GET_TASK_FORM_BY_ID: `${ORCHESTRATOR_BASE}/forms/TaskForms/GetTaskFormById`,
1792
+ GET_GENERIC_TASK_BY_ID: `${ORCHESTRATOR_BASE}/tasks/GenericTasks/GetTaskDataById`,
1793
+ GET_APP_TASK_BY_ID: `${ORCHESTRATOR_BASE}/tasks/AppTasks/GetAppTaskById`,
1792
1794
  };
1793
1795
 
1794
1796
  /**
@@ -1830,7 +1832,7 @@ const MAESTRO_ENDPOINTS = {
1830
1832
  // Connection string placeholder that will be replaced during build
1831
1833
  const CONNECTION_STRING = "InstrumentationKey=a6efa11d-1feb-4508-9738-e13e12dcae5e;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/;ApplicationId=7c58eb1c-9581-4ba6-839e-11725848a037";
1832
1834
  // SDK Version placeholder
1833
- const SDK_VERSION = "1.2.0";
1835
+ const SDK_VERSION = "1.2.2";
1834
1836
  const VERSION = "Version";
1835
1837
  const SERVICE = "Service";
1836
1838
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -2396,11 +2398,24 @@ const CASE_INSTANCE_TASK_FILTER = (caseInstanceId) => `Tags/any(tags:tags/Displa
2396
2398
  */
2397
2399
  const CASE_INSTANCE_TASK_EXPAND = 'AssignedToUser,Activities';
2398
2400
 
2401
+ /**
2402
+ * Types of tasks available in Action Center.
2403
+ * Each type determines the task's behavior, UI rendering, and completion requirements.
2404
+ */
2399
2405
  var TaskType;
2400
2406
  (function (TaskType) {
2407
+ /** A form-based task that renders a UiPath form layout for user input */
2401
2408
  TaskType["Form"] = "FormTask";
2409
+ /** An externally managed task handled outside of Action Center */
2402
2410
  TaskType["External"] = "ExternalTask";
2411
+ /** A task powered by a UiPath App */
2403
2412
  TaskType["App"] = "AppTask";
2413
+ /** A document validation task for reviewing and correcting extracted document data */
2414
+ TaskType["DocumentValidation"] = "DocumentValidationTask";
2415
+ /** A document classification task for categorizing documents */
2416
+ TaskType["DocumentClassification"] = "DocumentClassificationTask";
2417
+ /** A data labeling task for annotating training data */
2418
+ TaskType["DataLabeling"] = "DataLabelingTask";
2404
2419
  })(TaskType || (TaskType = {}));
2405
2420
  var TaskPriority;
2406
2421
  (function (TaskPriority) {
@@ -2454,6 +2469,42 @@ var TaskActivityType;
2454
2469
  TaskActivityType["FirstOpened"] = "FirstOpened";
2455
2470
  })(TaskActivityType || (TaskActivityType = {}));
2456
2471
 
2472
+ /**
2473
+ * Maps numeric TaskStatus values (from API) to TaskStatus enum values.
2474
+ * Extend this file with additional field mappings as needed.
2475
+ */
2476
+ const TaskStatusMap = {
2477
+ 0: TaskStatus.Unassigned,
2478
+ 1: TaskStatus.Pending,
2479
+ 2: TaskStatus.Completed,
2480
+ };
2481
+ // Field mapping for time-related fields to ensure consistent naming
2482
+ const TaskMap = {
2483
+ completionTime: 'completedTime',
2484
+ deletionTime: 'deletedTime',
2485
+ lastModificationTime: 'lastModifiedTime',
2486
+ creationTime: 'createdTime',
2487
+ organizationUnitId: 'folderId'
2488
+ };
2489
+ /**
2490
+ * Default expand parameters
2491
+ */
2492
+ const DEFAULT_TASK_EXPAND = 'AssignedToUser,CreatorUser,LastModifierUser';
2493
+
2494
+ const TASK_TYPE_ENDPOINTS = {
2495
+ [TaskType.Form]: TASK_ENDPOINTS.GET_TASK_FORM_BY_ID,
2496
+ [TaskType.App]: TASK_ENDPOINTS.GET_APP_TASK_BY_ID,
2497
+ [TaskType.DocumentValidation]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID,
2498
+ [TaskType.DocumentClassification]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID,
2499
+ [TaskType.External]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID,
2500
+ [TaskType.DataLabeling]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID,
2501
+ };
2502
+ var ActionCenterEventNames;
2503
+ (function (ActionCenterEventNames) {
2504
+ ActionCenterEventNames["TOKENREFRESHED"] = "AC.tokenRefreshed";
2505
+ ActionCenterEventNames["REFRESHTOKEN"] = "AC.refreshToken";
2506
+ })(ActionCenterEventNames || (ActionCenterEventNames = {}));
2507
+
2457
2508
  /**
2458
2509
  * Creates methods for a task
2459
2510
  *
@@ -2511,28 +2562,6 @@ function createTaskWithMethods(taskData, service) {
2511
2562
  return Object.assign({}, taskData, methods);
2512
2563
  }
2513
2564
 
2514
- /**
2515
- * Maps numeric TaskStatus values (from API) to TaskStatus enum values.
2516
- * Extend this file with additional field mappings as needed.
2517
- */
2518
- const TaskStatusMap = {
2519
- 0: TaskStatus.Unassigned,
2520
- 1: TaskStatus.Pending,
2521
- 2: TaskStatus.Completed,
2522
- };
2523
- // Field mapping for time-related fields to ensure consistent naming
2524
- const TaskMap = {
2525
- completionTime: 'completedTime',
2526
- deletionTime: 'deletedTime',
2527
- lastModificationTime: 'lastModifiedTime',
2528
- creationTime: 'createdTime',
2529
- organizationUnitId: 'folderId'
2530
- };
2531
- /**
2532
- * Default expand parameters
2533
- */
2534
- const DEFAULT_TASK_EXPAND = 'AssignedToUser,CreatorUser,LastModifierUser';
2535
-
2536
2565
  /**
2537
2566
  * Service for interacting with UiPath Tasks API
2538
2567
  */
@@ -2727,29 +2756,38 @@ class TaskService extends BaseService {
2727
2756
  }
2728
2757
  /**
2729
2758
  * Gets a task by ID
2730
- * IMPORTANT: For form tasks, folderId must be provided.
2731
- *
2732
2759
  * @param id - The ID of the task to retrieve
2733
- * @param options - Optional query parameters
2734
- * @param folderId - Optional folder ID (REQUIRED for form tasks)
2735
- * @returns Promise resolving to the task (form tasks will return form-specific data)
2736
- *
2760
+ * @param options - Optional query parameters including taskType for faster retrieval {@link TaskGetByIdOptions}
2761
+ * @param folderId - Optional folder ID (REQUIRED when options.taskType is provided)
2762
+ * @returns Promise resolving to the task
2763
+ * {@link TaskGetResponse}
2737
2764
  * @example
2738
2765
  * ```typescript
2739
- * import { Tasks } from '@uipath/uipath-typescript/tasks';
2766
+ * // Get a task by ID
2767
+ * const task = await tasks.getById(<taskId>);
2740
2768
  *
2741
- * const tasks = new Tasks(sdk);
2769
+ * // Get a form task by ID
2770
+ * const formTask = await tasks.getById(<taskId>, {}, <folderId>);
2742
2771
  *
2743
- * // Get task by ID
2744
- * const task = await tasks.getById(123);
2772
+ * // Access form task properties
2773
+ * console.log(formTask.formLayout);
2745
2774
  *
2746
- * // If the task is a form task, it will automatically return form-specific data
2775
+ * // Get a document validation task by ID (faster with taskType provided in the options)
2776
+ * const dvTask = await tasks.getById(<taskId>, { taskType: TaskType.DocumentValidation }, <folderId>);
2747
2777
  * ```
2748
2778
  */
2749
2779
  async getById(id, options = {}, folderId) {
2780
+ const { taskType, ...restOptions } = options;
2781
+ // If taskType is provided, skip the generic GET_BY_ID call and go directly to the type-specific endpoint
2782
+ if (taskType && taskType in TASK_TYPE_ENDPOINTS) {
2783
+ if (!folderId) {
2784
+ throw new ValidationError({ message: 'folderId is required when taskType is provided' });
2785
+ }
2786
+ return this.getByTaskType(id, folderId, taskType, restOptions);
2787
+ }
2750
2788
  const headers = createHeaders({ [FOLDER_ID]: folderId });
2751
2789
  // Add default expand parameters
2752
- const modifiedOptions = this.addDefaultExpand(options);
2790
+ const modifiedOptions = this.addDefaultExpand(restOptions);
2753
2791
  // prefix all keys in options
2754
2792
  const keysToPrefix = Object.keys(modifiedOptions);
2755
2793
  const apiOptions = addPrefixToKeys(modifiedOptions, ODATA_PREFIX, keysToPrefix);
@@ -2759,10 +2797,10 @@ class TaskService extends BaseService {
2759
2797
  });
2760
2798
  // Transform response from PascalCase to camelCase and normalize time fields
2761
2799
  const transformedTask = transformData(pascalToCamelCaseKeys(response.data), TaskMap);
2762
- // Check if this is a form task and get form-specific data if it is
2763
- if (transformedTask.type === TaskType.Form) {
2764
- const formOptions = { expandOnFormLayout: true };
2765
- return this.getFormTaskById(id, folderId || transformedTask.folderId, formOptions);
2800
+ // Get task type from response and fetch type-specific data
2801
+ const resolvedFolderId = folderId || transformedTask.folderId;
2802
+ if (transformedTask.type in TASK_TYPE_ENDPOINTS) {
2803
+ return this.getByTaskType(id, resolvedFolderId, transformedTask.type, restOptions);
2766
2804
  }
2767
2805
  return createTaskWithMethods(applyDataTransforms(transformedTask, { field: 'status', valueMap: TaskStatusMap }), this);
2768
2806
  }
@@ -2951,24 +2989,33 @@ class TaskService extends BaseService {
2951
2989
  };
2952
2990
  }
2953
2991
  /**
2954
- * Gets a form task by ID (private method)
2992
+ * Routes to the type-specific endpoint based on task type.
2993
+ */
2994
+ getByTaskType(id, folderId, taskType, options = {}) {
2995
+ const endpoint = TASK_TYPE_ENDPOINTS[taskType];
2996
+ const extraParams = taskType === TaskType.Form ? { expandOnFormLayout: true, ...options } : options;
2997
+ return this.getTaskByTypeEndpoint(id, folderId, endpoint, extraParams);
2998
+ }
2999
+ /**
3000
+ * Fetches a task from a type-specific endpoint.
2955
3001
  *
2956
- * @param id - The ID of the form task to retrieve
3002
+ * @param id - The task ID
2957
3003
  * @param folderId - Required folder ID
2958
- * @param options - Optional query parameters
2959
- * @returns Promise resolving to the form task
3004
+ * @param endpoint - The type-specific endpoint to call
3005
+ * @param extraParams - Additional query parameters (e.g. form options)
3006
+ * @returns Promise resolving to the task
2960
3007
  */
2961
- async getFormTaskById(id, folderId, options = {}) {
3008
+ async getTaskByTypeEndpoint(id, folderId, endpoint, extraParams = {}) {
2962
3009
  const headers = createHeaders({ [FOLDER_ID]: folderId });
2963
- const response = await this.get(TASK_ENDPOINTS.GET_TASK_FORM_BY_ID, {
3010
+ const response = await this.get(endpoint, {
2964
3011
  params: {
2965
3012
  taskId: id,
2966
- ...options
3013
+ ...extraParams
2967
3014
  },
2968
3015
  headers
2969
3016
  });
2970
- const transformedFormTask = transformData(response.data, TaskMap);
2971
- return createTaskWithMethods(applyDataTransforms(transformedFormTask, { field: 'status', valueMap: TaskStatusMap }), this);
3017
+ const transformedTask = transformData(response.data, TaskMap);
3018
+ return createTaskWithMethods(applyDataTransforms(transformedTask, { field: 'status', valueMap: TaskStatusMap }), this);
2972
3019
  }
2973
3020
  /**
2974
3021
  * Adds default expand parameters to options
@@ -422,10 +422,23 @@ interface UserLoginInfo {
422
422
  displayName: string;
423
423
  id: number;
424
424
  }
425
+ /**
426
+ * Types of tasks available in Action Center.
427
+ * Each type determines the task's behavior, UI rendering, and completion requirements.
428
+ */
425
429
  declare enum TaskType {
430
+ /** A form-based task that renders a UiPath form layout for user input */
426
431
  Form = "FormTask",
432
+ /** An externally managed task handled outside of Action Center */
427
433
  External = "ExternalTask",
428
- App = "AppTask"
434
+ /** A task powered by a UiPath App */
435
+ App = "AppTask",
436
+ /** A document validation task for reviewing and correcting extracted document data */
437
+ DocumentValidation = "DocumentValidationTask",
438
+ /** A document classification task for categorizing documents */
439
+ DocumentClassification = "DocumentClassificationTask",
440
+ /** A data labeling task for annotating training data */
441
+ DataLabeling = "DataLabelingTask"
429
442
  }
430
443
  declare enum TaskPriority {
431
444
  Low = "Low",
@@ -588,7 +601,23 @@ type TaskCompleteOptions = {
588
601
  data?: any;
589
602
  action?: string;
590
603
  } | {
591
- type: Exclude<TaskType, TaskType.External>;
604
+ type: TaskType.DocumentValidation;
605
+ data?: any;
606
+ action?: string;
607
+ } | {
608
+ type: TaskType.DocumentClassification;
609
+ data?: any;
610
+ action?: string;
611
+ } | {
612
+ type: TaskType.DataLabeling;
613
+ data?: any;
614
+ action?: string;
615
+ } | {
616
+ type: TaskType.Form;
617
+ data: any;
618
+ action: string;
619
+ } | {
620
+ type: TaskType.App;
592
621
  data: any;
593
622
  action: string;
594
623
  };
@@ -1787,6 +1787,8 @@ const TASK_ENDPOINTS = {
1787
1787
  COMPLETE_APP_TASK: `${ORCHESTRATOR_BASE}/tasks/AppTasks/CompleteAppTask`,
1788
1788
  COMPLETE_GENERIC_TASK: `${ORCHESTRATOR_BASE}/tasks/GenericTasks/CompleteTask`,
1789
1789
  GET_TASK_FORM_BY_ID: `${ORCHESTRATOR_BASE}/forms/TaskForms/GetTaskFormById`,
1790
+ GET_GENERIC_TASK_BY_ID: `${ORCHESTRATOR_BASE}/tasks/GenericTasks/GetTaskDataById`,
1791
+ GET_APP_TASK_BY_ID: `${ORCHESTRATOR_BASE}/tasks/AppTasks/GetAppTaskById`,
1790
1792
  };
1791
1793
 
1792
1794
  /**
@@ -1828,7 +1830,7 @@ const MAESTRO_ENDPOINTS = {
1828
1830
  // Connection string placeholder that will be replaced during build
1829
1831
  const CONNECTION_STRING = "InstrumentationKey=a6efa11d-1feb-4508-9738-e13e12dcae5e;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/;ApplicationId=7c58eb1c-9581-4ba6-839e-11725848a037";
1830
1832
  // SDK Version placeholder
1831
- const SDK_VERSION = "1.2.0";
1833
+ const SDK_VERSION = "1.2.2";
1832
1834
  const VERSION = "Version";
1833
1835
  const SERVICE = "Service";
1834
1836
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -2394,11 +2396,24 @@ const CASE_INSTANCE_TASK_FILTER = (caseInstanceId) => `Tags/any(tags:tags/Displa
2394
2396
  */
2395
2397
  const CASE_INSTANCE_TASK_EXPAND = 'AssignedToUser,Activities';
2396
2398
 
2399
+ /**
2400
+ * Types of tasks available in Action Center.
2401
+ * Each type determines the task's behavior, UI rendering, and completion requirements.
2402
+ */
2397
2403
  var TaskType;
2398
2404
  (function (TaskType) {
2405
+ /** A form-based task that renders a UiPath form layout for user input */
2399
2406
  TaskType["Form"] = "FormTask";
2407
+ /** An externally managed task handled outside of Action Center */
2400
2408
  TaskType["External"] = "ExternalTask";
2409
+ /** A task powered by a UiPath App */
2401
2410
  TaskType["App"] = "AppTask";
2411
+ /** A document validation task for reviewing and correcting extracted document data */
2412
+ TaskType["DocumentValidation"] = "DocumentValidationTask";
2413
+ /** A document classification task for categorizing documents */
2414
+ TaskType["DocumentClassification"] = "DocumentClassificationTask";
2415
+ /** A data labeling task for annotating training data */
2416
+ TaskType["DataLabeling"] = "DataLabelingTask";
2402
2417
  })(TaskType || (TaskType = {}));
2403
2418
  var TaskPriority;
2404
2419
  (function (TaskPriority) {
@@ -2452,6 +2467,42 @@ var TaskActivityType;
2452
2467
  TaskActivityType["FirstOpened"] = "FirstOpened";
2453
2468
  })(TaskActivityType || (TaskActivityType = {}));
2454
2469
 
2470
+ /**
2471
+ * Maps numeric TaskStatus values (from API) to TaskStatus enum values.
2472
+ * Extend this file with additional field mappings as needed.
2473
+ */
2474
+ const TaskStatusMap = {
2475
+ 0: TaskStatus.Unassigned,
2476
+ 1: TaskStatus.Pending,
2477
+ 2: TaskStatus.Completed,
2478
+ };
2479
+ // Field mapping for time-related fields to ensure consistent naming
2480
+ const TaskMap = {
2481
+ completionTime: 'completedTime',
2482
+ deletionTime: 'deletedTime',
2483
+ lastModificationTime: 'lastModifiedTime',
2484
+ creationTime: 'createdTime',
2485
+ organizationUnitId: 'folderId'
2486
+ };
2487
+ /**
2488
+ * Default expand parameters
2489
+ */
2490
+ const DEFAULT_TASK_EXPAND = 'AssignedToUser,CreatorUser,LastModifierUser';
2491
+
2492
+ const TASK_TYPE_ENDPOINTS = {
2493
+ [TaskType.Form]: TASK_ENDPOINTS.GET_TASK_FORM_BY_ID,
2494
+ [TaskType.App]: TASK_ENDPOINTS.GET_APP_TASK_BY_ID,
2495
+ [TaskType.DocumentValidation]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID,
2496
+ [TaskType.DocumentClassification]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID,
2497
+ [TaskType.External]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID,
2498
+ [TaskType.DataLabeling]: TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID,
2499
+ };
2500
+ var ActionCenterEventNames;
2501
+ (function (ActionCenterEventNames) {
2502
+ ActionCenterEventNames["TOKENREFRESHED"] = "AC.tokenRefreshed";
2503
+ ActionCenterEventNames["REFRESHTOKEN"] = "AC.refreshToken";
2504
+ })(ActionCenterEventNames || (ActionCenterEventNames = {}));
2505
+
2455
2506
  /**
2456
2507
  * Creates methods for a task
2457
2508
  *
@@ -2509,28 +2560,6 @@ function createTaskWithMethods(taskData, service) {
2509
2560
  return Object.assign({}, taskData, methods);
2510
2561
  }
2511
2562
 
2512
- /**
2513
- * Maps numeric TaskStatus values (from API) to TaskStatus enum values.
2514
- * Extend this file with additional field mappings as needed.
2515
- */
2516
- const TaskStatusMap = {
2517
- 0: TaskStatus.Unassigned,
2518
- 1: TaskStatus.Pending,
2519
- 2: TaskStatus.Completed,
2520
- };
2521
- // Field mapping for time-related fields to ensure consistent naming
2522
- const TaskMap = {
2523
- completionTime: 'completedTime',
2524
- deletionTime: 'deletedTime',
2525
- lastModificationTime: 'lastModifiedTime',
2526
- creationTime: 'createdTime',
2527
- organizationUnitId: 'folderId'
2528
- };
2529
- /**
2530
- * Default expand parameters
2531
- */
2532
- const DEFAULT_TASK_EXPAND = 'AssignedToUser,CreatorUser,LastModifierUser';
2533
-
2534
2563
  /**
2535
2564
  * Service for interacting with UiPath Tasks API
2536
2565
  */
@@ -2725,29 +2754,38 @@ class TaskService extends BaseService {
2725
2754
  }
2726
2755
  /**
2727
2756
  * Gets a task by ID
2728
- * IMPORTANT: For form tasks, folderId must be provided.
2729
- *
2730
2757
  * @param id - The ID of the task to retrieve
2731
- * @param options - Optional query parameters
2732
- * @param folderId - Optional folder ID (REQUIRED for form tasks)
2733
- * @returns Promise resolving to the task (form tasks will return form-specific data)
2734
- *
2758
+ * @param options - Optional query parameters including taskType for faster retrieval {@link TaskGetByIdOptions}
2759
+ * @param folderId - Optional folder ID (REQUIRED when options.taskType is provided)
2760
+ * @returns Promise resolving to the task
2761
+ * {@link TaskGetResponse}
2735
2762
  * @example
2736
2763
  * ```typescript
2737
- * import { Tasks } from '@uipath/uipath-typescript/tasks';
2764
+ * // Get a task by ID
2765
+ * const task = await tasks.getById(<taskId>);
2738
2766
  *
2739
- * const tasks = new Tasks(sdk);
2767
+ * // Get a form task by ID
2768
+ * const formTask = await tasks.getById(<taskId>, {}, <folderId>);
2740
2769
  *
2741
- * // Get task by ID
2742
- * const task = await tasks.getById(123);
2770
+ * // Access form task properties
2771
+ * console.log(formTask.formLayout);
2743
2772
  *
2744
- * // If the task is a form task, it will automatically return form-specific data
2773
+ * // Get a document validation task by ID (faster with taskType provided in the options)
2774
+ * const dvTask = await tasks.getById(<taskId>, { taskType: TaskType.DocumentValidation }, <folderId>);
2745
2775
  * ```
2746
2776
  */
2747
2777
  async getById(id, options = {}, folderId) {
2778
+ const { taskType, ...restOptions } = options;
2779
+ // If taskType is provided, skip the generic GET_BY_ID call and go directly to the type-specific endpoint
2780
+ if (taskType && taskType in TASK_TYPE_ENDPOINTS) {
2781
+ if (!folderId) {
2782
+ throw new ValidationError({ message: 'folderId is required when taskType is provided' });
2783
+ }
2784
+ return this.getByTaskType(id, folderId, taskType, restOptions);
2785
+ }
2748
2786
  const headers = createHeaders({ [FOLDER_ID]: folderId });
2749
2787
  // Add default expand parameters
2750
- const modifiedOptions = this.addDefaultExpand(options);
2788
+ const modifiedOptions = this.addDefaultExpand(restOptions);
2751
2789
  // prefix all keys in options
2752
2790
  const keysToPrefix = Object.keys(modifiedOptions);
2753
2791
  const apiOptions = addPrefixToKeys(modifiedOptions, ODATA_PREFIX, keysToPrefix);
@@ -2757,10 +2795,10 @@ class TaskService extends BaseService {
2757
2795
  });
2758
2796
  // Transform response from PascalCase to camelCase and normalize time fields
2759
2797
  const transformedTask = transformData(pascalToCamelCaseKeys(response.data), TaskMap);
2760
- // Check if this is a form task and get form-specific data if it is
2761
- if (transformedTask.type === TaskType.Form) {
2762
- const formOptions = { expandOnFormLayout: true };
2763
- return this.getFormTaskById(id, folderId || transformedTask.folderId, formOptions);
2798
+ // Get task type from response and fetch type-specific data
2799
+ const resolvedFolderId = folderId || transformedTask.folderId;
2800
+ if (transformedTask.type in TASK_TYPE_ENDPOINTS) {
2801
+ return this.getByTaskType(id, resolvedFolderId, transformedTask.type, restOptions);
2764
2802
  }
2765
2803
  return createTaskWithMethods(applyDataTransforms(transformedTask, { field: 'status', valueMap: TaskStatusMap }), this);
2766
2804
  }
@@ -2949,24 +2987,33 @@ class TaskService extends BaseService {
2949
2987
  };
2950
2988
  }
2951
2989
  /**
2952
- * Gets a form task by ID (private method)
2990
+ * Routes to the type-specific endpoint based on task type.
2991
+ */
2992
+ getByTaskType(id, folderId, taskType, options = {}) {
2993
+ const endpoint = TASK_TYPE_ENDPOINTS[taskType];
2994
+ const extraParams = taskType === TaskType.Form ? { expandOnFormLayout: true, ...options } : options;
2995
+ return this.getTaskByTypeEndpoint(id, folderId, endpoint, extraParams);
2996
+ }
2997
+ /**
2998
+ * Fetches a task from a type-specific endpoint.
2953
2999
  *
2954
- * @param id - The ID of the form task to retrieve
3000
+ * @param id - The task ID
2955
3001
  * @param folderId - Required folder ID
2956
- * @param options - Optional query parameters
2957
- * @returns Promise resolving to the form task
3002
+ * @param endpoint - The type-specific endpoint to call
3003
+ * @param extraParams - Additional query parameters (e.g. form options)
3004
+ * @returns Promise resolving to the task
2958
3005
  */
2959
- async getFormTaskById(id, folderId, options = {}) {
3006
+ async getTaskByTypeEndpoint(id, folderId, endpoint, extraParams = {}) {
2960
3007
  const headers = createHeaders({ [FOLDER_ID]: folderId });
2961
- const response = await this.get(TASK_ENDPOINTS.GET_TASK_FORM_BY_ID, {
3008
+ const response = await this.get(endpoint, {
2962
3009
  params: {
2963
3010
  taskId: id,
2964
- ...options
3011
+ ...extraParams
2965
3012
  },
2966
3013
  headers
2967
3014
  });
2968
- const transformedFormTask = transformData(response.data, TaskMap);
2969
- return createTaskWithMethods(applyDataTransforms(transformedFormTask, { field: 'status', valueMap: TaskStatusMap }), this);
3015
+ const transformedTask = transformData(response.data, TaskMap);
3016
+ return createTaskWithMethods(applyDataTransforms(transformedTask, { field: 'status', valueMap: TaskStatusMap }), this);
2970
3017
  }
2971
3018
  /**
2972
3019
  * Adds default expand parameters to options
@@ -51,7 +51,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
51
51
  // Connection string placeholder that will be replaced during build
52
52
  const CONNECTION_STRING = "InstrumentationKey=a6efa11d-1feb-4508-9738-e13e12dcae5e;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/;ApplicationId=7c58eb1c-9581-4ba6-839e-11725848a037";
53
53
  // SDK Version placeholder
54
- const SDK_VERSION = "1.2.0";
54
+ const SDK_VERSION = "1.2.2";
55
55
  const VERSION = "Version";
56
56
  const SERVICE = "Service";
57
57
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -6126,10 +6126,11 @@ class ConversationService extends BaseService {
6126
6126
  */
6127
6127
  async uploadAttachment(id, file) {
6128
6128
  // Step 1: Create attachment entry and get upload URL
6129
- const { fileUploadAccess, uri, name } = await this.createAttachment(id, file.name);
6129
+ const { fileUploadAccess, uri, name } = await this.getAttachmentUploadUri(id, file.name);
6130
6130
  // Step 2: Upload file to blob storage
6131
6131
  const uploadHeaders = {
6132
6132
  'Content-Type': file.type,
6133
+ 'x-ms-blob-type': 'BlockBlob',
6133
6134
  ...arrayDictionaryToRecord(fileUploadAccess.headers)
6134
6135
  };
6135
6136
  // Add auth header if required by the storage endpoint
@@ -6154,6 +6155,40 @@ class ConversationService extends BaseService {
6154
6155
  mimeType: file.type
6155
6156
  };
6156
6157
  }
6158
+ /**
6159
+ * Registers a file attachment for a conversation and returns a URI along with
6160
+ * pre-signed upload access details. Use the returned `fileUploadAccess` to upload
6161
+ * the file content to blob storage, then reference `uri` in subsequent messages.
6162
+ *
6163
+ * @param conversationId - The ID of the conversation to attach the file to
6164
+ * @param fileName - The name of the file to attach
6165
+ * @returns Promise resolving to {@link ConversationAttachmentCreateResponse} containing
6166
+ * the attachment `uri` and `fileUploadAccess` details needed to upload the file content
6167
+ *
6168
+ * @example <caption>Step 1 — Get the attachment URI and upload access</caption>
6169
+ * ```typescript
6170
+ * const { uri, fileUploadAccess } = await conversationalAgent.conversations.getAttachmentUploadUri(conversationId, 'report.pdf');
6171
+ * console.log(`Attachment URI: ${uri}`);
6172
+ * ```
6173
+ *
6174
+ * @example <caption>Step 2 — Upload the file content to the returned URL</caption>
6175
+ * ```typescript
6176
+ * const { uri, fileUploadAccess } = await conversationalAgent.conversations.getAttachmentUploadUri(conversationId, file.name);
6177
+ *
6178
+ * await fetch(fileUploadAccess.url, {
6179
+ * method: fileUploadAccess.verb,
6180
+ * body: file,
6181
+ * headers: { 'Content-Type': file.type },
6182
+ * });
6183
+ *
6184
+ * // Reference the URI in a message after upload
6185
+ * console.log(`File ready at: ${uri}`);
6186
+ * ```
6187
+ */
6188
+ async getAttachmentUploadUri(conversationId, fileName) {
6189
+ const response = await this.post(ATTACHMENT_ENDPOINTS.CREATE(conversationId), { name: fileName });
6190
+ return response.data;
6191
+ }
6157
6192
  // ==================== Real-time Event Handling ====================
6158
6193
  /**
6159
6194
  * Starts a real-time chat session for a conversation
@@ -6276,10 +6311,6 @@ class ConversationService extends BaseService {
6276
6311
  }
6277
6312
  return this._eventHelper;
6278
6313
  }
6279
- async createAttachment(conversationId, fileName) {
6280
- const response = await this.post(ATTACHMENT_ENDPOINTS.CREATE(conversationId), { name: fileName });
6281
- return response.data;
6282
- }
6283
6314
  }
6284
6315
  __decorate([
6285
6316
  track('ConversationalAgent.Conversations.Create')
@@ -6301,7 +6332,7 @@ __decorate([
6301
6332
  ], ConversationService.prototype, "uploadAttachment", null);
6302
6333
  __decorate([
6303
6334
  track('ConversationalAgent.Conversations.CreateAttachment')
6304
- ], ConversationService.prototype, "createAttachment", null);
6335
+ ], ConversationService.prototype, "getAttachmentUploadUri", null);
6305
6336
 
6306
6337
  /**
6307
6338
  * MessageService - Message operations for Conversations