@uipath/uipath-typescript 1.2.2 → 1.3.1

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 (41) hide show
  1. package/dist/assets/index.cjs +5 -8
  2. package/dist/assets/index.d.ts +3 -1
  3. package/dist/assets/index.mjs +5 -8
  4. package/dist/attachments/index.cjs +5 -8
  5. package/dist/attachments/index.d.ts +3 -1
  6. package/dist/attachments/index.mjs +5 -8
  7. package/dist/buckets/index.cjs +5 -8
  8. package/dist/buckets/index.d.ts +3 -1
  9. package/dist/buckets/index.mjs +5 -8
  10. package/dist/cases/index.cjs +5 -8
  11. package/dist/cases/index.d.ts +3 -1
  12. package/dist/cases/index.mjs +5 -8
  13. package/dist/conversational-agent/index.cjs +38 -16
  14. package/dist/conversational-agent/index.d.ts +26 -4
  15. package/dist/conversational-agent/index.mjs +38 -16
  16. package/dist/core/index.cjs +2 -2
  17. package/dist/core/index.d.ts +2 -2
  18. package/dist/core/index.mjs +2 -2
  19. package/dist/entities/index.cjs +697 -317
  20. package/dist/entities/index.d.ts +572 -58
  21. package/dist/entities/index.mjs +698 -318
  22. package/dist/index.cjs +727 -161
  23. package/dist/index.d.ts +697 -69
  24. package/dist/index.mjs +727 -162
  25. package/dist/index.umd.js +727 -161
  26. package/dist/jobs/index.cjs +278 -20
  27. package/dist/jobs/index.d.ts +214 -19
  28. package/dist/jobs/index.mjs +278 -21
  29. package/dist/maestro-processes/index.cjs +5 -8
  30. package/dist/maestro-processes/index.d.ts +3 -1
  31. package/dist/maestro-processes/index.mjs +5 -8
  32. package/dist/processes/index.cjs +5 -8
  33. package/dist/processes/index.d.ts +3 -1
  34. package/dist/processes/index.mjs +5 -8
  35. package/dist/queues/index.cjs +5 -8
  36. package/dist/queues/index.d.ts +3 -1
  37. package/dist/queues/index.mjs +5 -8
  38. package/dist/tasks/index.cjs +5 -8
  39. package/dist/tasks/index.d.ts +3 -1
  40. package/dist/tasks/index.mjs +5 -8
  41. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -4518,6 +4518,7 @@ const QUEUE_ENDPOINTS = {
4518
4518
  */
4519
4519
  const JOB_ENDPOINTS = {
4520
4520
  GET_ALL: `${ORCHESTRATOR_BASE}/odata/Jobs`,
4521
+ GET_BY_KEY: (identifier) => `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.GetByKey(identifier=${identifier})`,
4521
4522
  };
4522
4523
  /**
4523
4524
  * Orchestrator Asset Service Endpoints
@@ -4570,6 +4571,12 @@ const MAESTRO_ENDPOINTS = {
4570
4571
  /**
4571
4572
  * Data Fabric Service Endpoints
4572
4573
  */
4574
+ /**
4575
+ * Default folder key used for tenant-level Data Fabric entities.
4576
+ * Tenant-level entities are not scoped to a folder; this is the
4577
+ * conventional placeholder value the API expects.
4578
+ */
4579
+ const DATA_FABRIC_TENANT_FOLDER_ID = '00000000-0000-0000-0000-000000000000';
4573
4580
  /**
4574
4581
  * Data Fabric Entity Service Endpoints
4575
4582
  */
@@ -4584,6 +4591,11 @@ const DATA_FABRIC_ENDPOINTS = {
4584
4591
  UPDATE_RECORD_BY_ID: (entityId, recordId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/update/${recordId}`,
4585
4592
  UPDATE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/update-batch`,
4586
4593
  DELETE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/delete-batch`,
4594
+ UPSERT: `${DATAFABRIC_BASE}/api/Entity`,
4595
+ DELETE: (entityId) => `${DATAFABRIC_BASE}/api/Entity/${entityId}`,
4596
+ UPDATE_METADATA: (entityId) => `${DATAFABRIC_BASE}/api/Entity/${entityId}/metadata`,
4597
+ QUERY_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/query`,
4598
+ BULK_UPLOAD_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/bulk-upload`,
4587
4599
  DOWNLOAD_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
4588
4600
  UPLOAD_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
4589
4601
  DELETE_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
@@ -5417,7 +5429,7 @@ function normalizeBaseUrl(url) {
5417
5429
  // Connection string placeholder that will be replaced during build
5418
5430
  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";
5419
5431
  // SDK Version placeholder
5420
- const SDK_VERSION = "1.2.2";
5432
+ const SDK_VERSION = "1.3.1";
5421
5433
  const VERSION = "Version";
5422
5434
  const SERVICE = "Service";
5423
5435
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -5806,7 +5818,7 @@ var _UiPath_instances, _UiPath_config, _UiPath_authService, _UiPath_initialized,
5806
5818
  *
5807
5819
  * Supports two usage patterns:
5808
5820
  * 1. Full config in constructor — for server-side or explicit configuration
5809
- * 2. No config / partial config — loads from meta tags injected by @uipath/coded-apps plugin
5821
+ * 2. No config / partial config — loads from meta tags injected by @uipath/coded-apps-dev plugin
5810
5822
  *
5811
5823
  * @example
5812
5824
  * ```typescript
@@ -6272,15 +6284,11 @@ const RESPONSE_TYPES = {
6272
6284
 
6273
6285
  class ApiClient {
6274
6286
  constructor(config, executionContext, tokenManager, clientConfig = {}) {
6275
- this.defaultHeaders = {};
6276
6287
  this.config = config;
6277
6288
  this.executionContext = executionContext;
6278
6289
  this.clientConfig = clientConfig;
6279
6290
  this.tokenManager = tokenManager;
6280
6291
  }
6281
- setDefaultHeaders(headers) {
6282
- this.defaultHeaders = { ...this.defaultHeaders, ...headers };
6283
- }
6284
6292
  /**
6285
6293
  * Gets a valid authentication token, refreshing if necessary.
6286
6294
  * Used internally for API requests and exposed for services that need manual auth headers.
@@ -6296,7 +6304,6 @@ class ApiClient {
6296
6304
  return {
6297
6305
  'Authorization': `Bearer ${token}`,
6298
6306
  'Content-Type': CONTENT_TYPES.JSON,
6299
- ...this.defaultHeaders,
6300
6307
  ...this.clientConfig.headers
6301
6308
  };
6302
6309
  }
@@ -7352,6 +7359,8 @@ class BaseService {
7352
7359
  *
7353
7360
  * @param instance - UiPath SDK instance providing authentication and configuration.
7354
7361
  * Services receive this via dependency injection in the modular pattern.
7362
+ * @param headers - Optional default headers to include in every request (e.g. `x-uipath-external-user-id` for
7363
+ * CAS external-app auth)
7355
7364
  *
7356
7365
  * @example
7357
7366
  * ```typescript
@@ -7371,11 +7380,11 @@ class BaseService {
7371
7380
  * const entities = new Entities(sdk);
7372
7381
  * ```
7373
7382
  */
7374
- constructor(instance) {
7383
+ constructor(instance, headers) {
7375
7384
  // Private field - not visible via Object.keys() or any reflection
7376
7385
  _BaseService_apiClient.set(this, void 0);
7377
7386
  const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
7378
- __classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager), "f");
7387
+ __classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
7379
7388
  }
7380
7389
  /**
7381
7390
  * Gets a valid authentication token, refreshing if necessary.
@@ -7634,27 +7643,41 @@ function createEntityMethods(entityData, service) {
7634
7643
  throw new Error('Entity ID is undefined');
7635
7644
  return service.deleteAttachment(entityData.id, recordId, fieldName);
7636
7645
  },
7646
+ async queryRecords(options) {
7647
+ if (!entityData.id)
7648
+ throw new Error('Entity ID is undefined');
7649
+ return service.queryRecordsById(entityData.id, options);
7650
+ },
7651
+ async importRecords(file) {
7652
+ if (!entityData.id)
7653
+ throw new Error('Entity ID is undefined');
7654
+ return service.importRecordsById(entityData.id, file);
7655
+ },
7637
7656
  async insert(data, options) {
7638
7657
  return this.insertRecord(data, options);
7639
7658
  },
7640
7659
  async batchInsert(data, options) {
7641
7660
  return this.insertRecords(data, options);
7642
7661
  },
7643
- async update(data, options) {
7644
- return this.updateRecords(data, options);
7645
- },
7646
- async delete(recordIds, options) {
7647
- return this.deleteRecords(recordIds, options);
7648
- },
7649
7662
  async getRecords(options) {
7650
7663
  return this.getAllRecords(options);
7651
- }
7664
+ },
7665
+ async delete() {
7666
+ if (!entityData.id)
7667
+ throw new Error('Entity ID is undefined');
7668
+ return service.deleteById(entityData.id);
7669
+ },
7670
+ async update(options) {
7671
+ if (!entityData.id)
7672
+ throw new Error('Entity ID is undefined');
7673
+ return service.updateById(entityData.id, options);
7674
+ },
7652
7675
  };
7653
7676
  }
7654
7677
  /**
7655
- * Creates an actionable entity metadata by combining entity with operational methods
7678
+ * Creates an actionable entity by combining entity metadata with data and management methods
7656
7679
  *
7657
- * @param entityData - Entity metadata
7680
+ * @param entityMetadata - Entity metadata
7658
7681
  * @param service - The entity service instance
7659
7682
  * @returns Entity metadata with added methods
7660
7683
  */
@@ -7664,42 +7687,7 @@ function createEntityWithMethods(entityData, service) {
7664
7687
  }
7665
7688
 
7666
7689
  /**
7667
- * Creates query parameters object from key-value pairs, filtering out undefined values
7668
- * @param paramsObj - Object containing parameter key-value pairs
7669
- * @returns Parameters object with undefined values filtered out
7670
- *
7671
- * @example
7672
- * ```typescript
7673
- * // Entity service parameters
7674
- * const params = createParams({
7675
- * start: 0,
7676
- * limit: 10,
7677
- * expansionLevel: 1
7678
- * });
7679
- *
7680
- * // With optional/undefined values (automatically filtered)
7681
- * const params = createParams({
7682
- * start: options.start, // Could be undefined
7683
- * limit: options.limit, // Could be undefined
7684
- * expansionLevel: options.expansionLevel // Could be undefined
7685
- * });
7686
- *
7687
- * // Empty params
7688
- * const params = createParams();
7689
- * ```
7690
- */
7691
- function createParams(paramsObj = {}) {
7692
- const params = {};
7693
- for (const [key, value] of Object.entries(paramsObj)) {
7694
- if (value !== undefined && value !== null) {
7695
- params[key] = value;
7696
- }
7697
- }
7698
- return params;
7699
- }
7700
-
7701
- /**
7702
- * Entity field type names
7690
+ * Entity field data type names (SQL-level types returned by the API)
7703
7691
  */
7704
7692
  var EntityFieldDataType;
7705
7693
  (function (EntityFieldDataType) {
@@ -7715,7 +7703,41 @@ var EntityFieldDataType;
7715
7703
  EntityFieldDataType["BOOLEAN"] = "BOOLEAN";
7716
7704
  EntityFieldDataType["BIG_INTEGER"] = "BIG_INTEGER";
7717
7705
  EntityFieldDataType["MULTILINE_TEXT"] = "MULTILINE_TEXT";
7706
+ EntityFieldDataType["FILE"] = "FILE";
7707
+ EntityFieldDataType["CHOICE_SET_SINGLE"] = "CHOICE_SET_SINGLE";
7708
+ EntityFieldDataType["CHOICE_SET_MULTIPLE"] = "CHOICE_SET_MULTIPLE";
7709
+ EntityFieldDataType["AUTO_NUMBER"] = "AUTO_NUMBER";
7710
+ EntityFieldDataType["RELATIONSHIP"] = "RELATIONSHIP";
7718
7711
  })(EntityFieldDataType || (EntityFieldDataType = {}));
7712
+ /**
7713
+ * Logical operator for combining query filter groups
7714
+ */
7715
+ var LogicalOperator;
7716
+ (function (LogicalOperator) {
7717
+ /** Combine conditions with AND — all conditions must match */
7718
+ LogicalOperator[LogicalOperator["And"] = 0] = "And";
7719
+ /** Combine conditions with OR — any condition must match */
7720
+ LogicalOperator[LogicalOperator["Or"] = 1] = "Or";
7721
+ })(LogicalOperator || (LogicalOperator = {}));
7722
+ /**
7723
+ * Comparison operators for entity query filters.
7724
+ * Not all operators are valid for all field types.
7725
+ */
7726
+ var QueryFilterOperator;
7727
+ (function (QueryFilterOperator) {
7728
+ QueryFilterOperator["Equals"] = "=";
7729
+ QueryFilterOperator["NotEquals"] = "!=";
7730
+ QueryFilterOperator["GreaterThan"] = ">";
7731
+ QueryFilterOperator["LessThan"] = "<";
7732
+ QueryFilterOperator["GreaterThanOrEqual"] = ">=";
7733
+ QueryFilterOperator["LessThanOrEqual"] = "<=";
7734
+ QueryFilterOperator["Contains"] = "contains";
7735
+ QueryFilterOperator["NotContains"] = "not contains";
7736
+ QueryFilterOperator["StartsWith"] = "startswith";
7737
+ QueryFilterOperator["EndsWith"] = "endswith";
7738
+ QueryFilterOperator["In"] = "in";
7739
+ QueryFilterOperator["NotIn"] = "not in";
7740
+ })(QueryFilterOperator || (QueryFilterOperator = {}));
7719
7741
  /**
7720
7742
  * Entity type enum
7721
7743
  */
@@ -7761,6 +7783,41 @@ var JoinType;
7761
7783
  JoinType["LeftJoin"] = "LeftJoin";
7762
7784
  })(JoinType || (JoinType = {}));
7763
7785
 
7786
+ /**
7787
+ * Creates query parameters object from key-value pairs, filtering out undefined values
7788
+ * @param paramsObj - Object containing parameter key-value pairs
7789
+ * @returns Parameters object with undefined values filtered out
7790
+ *
7791
+ * @example
7792
+ * ```typescript
7793
+ * // Entity service parameters
7794
+ * const params = createParams({
7795
+ * start: 0,
7796
+ * limit: 10,
7797
+ * expansionLevel: 1
7798
+ * });
7799
+ *
7800
+ * // With optional/undefined values (automatically filtered)
7801
+ * const params = createParams({
7802
+ * start: options.start, // Could be undefined
7803
+ * limit: options.limit, // Could be undefined
7804
+ * expansionLevel: options.expansionLevel // Could be undefined
7805
+ * });
7806
+ *
7807
+ * // Empty params
7808
+ * const params = createParams();
7809
+ * ```
7810
+ */
7811
+ function createParams(paramsObj = {}) {
7812
+ const params = {};
7813
+ for (const [key, value] of Object.entries(paramsObj)) {
7814
+ if (value !== undefined && value !== null) {
7815
+ params[key] = value;
7816
+ }
7817
+ }
7818
+ return params;
7819
+ }
7820
+
7764
7821
  /**
7765
7822
  * Entity field data types (SQL types from API)
7766
7823
  */
@@ -7779,6 +7836,7 @@ var SqlFieldType;
7779
7836
  SqlFieldType["DECIMAL"] = "DECIMAL";
7780
7837
  SqlFieldType["MULTILINE"] = "MULTILINE";
7781
7838
  })(SqlFieldType || (SqlFieldType = {}));
7839
+
7782
7840
  /**
7783
7841
  * Maps fields for Entities
7784
7842
  */
@@ -7788,6 +7846,40 @@ const EntityMap = {
7788
7846
  sqlType: 'fieldDataType',
7789
7847
  fieldDefinition: 'fieldMetaData'
7790
7848
  };
7849
+ /**
7850
+ * Maps EntityFieldDataType values to the API field payload components for create/update operations
7851
+ */
7852
+ const EntitySchemaFieldTypeMap = {
7853
+ [EntityFieldDataType.UUID]: { sqlTypeName: SqlFieldType.UNIQUEIDENTIFIER, fieldDisplayType: FieldDisplayType.Basic },
7854
+ [EntityFieldDataType.STRING]: { sqlTypeName: SqlFieldType.NVARCHAR, fieldDisplayType: FieldDisplayType.Basic },
7855
+ [EntityFieldDataType.INTEGER]: { sqlTypeName: SqlFieldType.INT, fieldDisplayType: FieldDisplayType.Basic },
7856
+ [EntityFieldDataType.DATETIME]: { sqlTypeName: SqlFieldType.DATETIME2, fieldDisplayType: FieldDisplayType.Basic },
7857
+ [EntityFieldDataType.DATETIME_WITH_TZ]: { sqlTypeName: SqlFieldType.DATETIMEOFFSET, fieldDisplayType: FieldDisplayType.Basic },
7858
+ [EntityFieldDataType.DECIMAL]: { sqlTypeName: SqlFieldType.DECIMAL, fieldDisplayType: FieldDisplayType.Basic },
7859
+ [EntityFieldDataType.FLOAT]: { sqlTypeName: SqlFieldType.FLOAT, fieldDisplayType: FieldDisplayType.Basic },
7860
+ [EntityFieldDataType.DOUBLE]: { sqlTypeName: SqlFieldType.REAL, fieldDisplayType: FieldDisplayType.Basic },
7861
+ [EntityFieldDataType.DATE]: { sqlTypeName: SqlFieldType.DATE, fieldDisplayType: FieldDisplayType.Basic },
7862
+ [EntityFieldDataType.BOOLEAN]: { sqlTypeName: SqlFieldType.BIT, fieldDisplayType: FieldDisplayType.Basic },
7863
+ [EntityFieldDataType.BIG_INTEGER]: { sqlTypeName: SqlFieldType.BIGINT, fieldDisplayType: FieldDisplayType.Basic },
7864
+ [EntityFieldDataType.MULTILINE_TEXT]: { sqlTypeName: SqlFieldType.MULTILINE, fieldDisplayType: FieldDisplayType.Basic },
7865
+ [EntityFieldDataType.FILE]: { sqlTypeName: SqlFieldType.UNIQUEIDENTIFIER, fieldDisplayType: FieldDisplayType.File },
7866
+ [EntityFieldDataType.CHOICE_SET_SINGLE]: { sqlTypeName: SqlFieldType.INT, fieldDisplayType: FieldDisplayType.ChoiceSetSingle },
7867
+ [EntityFieldDataType.CHOICE_SET_MULTIPLE]: { sqlTypeName: SqlFieldType.NVARCHAR, fieldDisplayType: FieldDisplayType.ChoiceSetMultiple },
7868
+ [EntityFieldDataType.AUTO_NUMBER]: { sqlTypeName: SqlFieldType.DECIMAL, fieldDisplayType: FieldDisplayType.AutoNumber },
7869
+ [EntityFieldDataType.RELATIONSHIP]: { sqlTypeName: SqlFieldType.UNIQUEIDENTIFIER, fieldDisplayType: FieldDisplayType.Relationship },
7870
+ };
7871
+ /**
7872
+ * Maps FieldDisplayType values to EntityFieldDataType for types that share SQL types
7873
+ * with other field types (File, ChoiceSetSingle, ChoiceSetMultiple, AutoNumber).
7874
+ * Used during read-side transformation to produce the correct EntityFieldDataType.
7875
+ */
7876
+ const FieldDisplayTypeToDataType = {
7877
+ [FieldDisplayType.File]: EntityFieldDataType.FILE,
7878
+ [FieldDisplayType.ChoiceSetSingle]: EntityFieldDataType.CHOICE_SET_SINGLE,
7879
+ [FieldDisplayType.ChoiceSetMultiple]: EntityFieldDataType.CHOICE_SET_MULTIPLE,
7880
+ [FieldDisplayType.AutoNumber]: EntityFieldDataType.AUTO_NUMBER,
7881
+ [FieldDisplayType.Relationship]: EntityFieldDataType.RELATIONSHIP,
7882
+ };
7791
7883
  /**
7792
7884
  * Maps SQL field types to friendly display names
7793
7885
  */
@@ -7803,7 +7895,7 @@ const EntityFieldTypeMap = {
7803
7895
  [SqlFieldType.DATE]: EntityFieldDataType.DATE,
7804
7896
  [SqlFieldType.BIT]: EntityFieldDataType.BOOLEAN,
7805
7897
  [SqlFieldType.DECIMAL]: EntityFieldDataType.DECIMAL,
7806
- [SqlFieldType.MULTILINE]: EntityFieldDataType.MULTILINE_TEXT
7898
+ [SqlFieldType.MULTILINE]: EntityFieldDataType.MULTILINE_TEXT,
7807
7899
  };
7808
7900
 
7809
7901
  /**
@@ -7921,11 +8013,7 @@ class EntityService extends BaseService {
7921
8013
  expansionLevel: options.expansionLevel
7922
8014
  });
7923
8015
  const response = await this.get(DATA_FABRIC_ENDPOINTS.ENTITY.GET_RECORD_BY_ID(entityId, recordId), { params });
7924
- // Convert PascalCase response to camelCase
7925
- const camelResponse = pascalToCamelCaseKeys(response.data);
7926
- // Apply EntityMap transformations
7927
- const transformedResponse = transformData(camelResponse, EntityMap);
7928
- return transformedResponse;
8016
+ return response.data;
7929
8017
  }
7930
8018
  /**
7931
8019
  * Inserts a single record into an entity by entity ID
@@ -7958,9 +8046,7 @@ class EntityService extends BaseService {
7958
8046
  params,
7959
8047
  ...options
7960
8048
  });
7961
- // Convert PascalCase response to camelCase
7962
- const camelResponse = pascalToCamelCaseKeys(response.data);
7963
- return camelResponse;
8049
+ return response.data;
7964
8050
  }
7965
8051
  /**
7966
8052
  * Inserts data into an entity by entity ID using batch insert
@@ -8001,9 +8087,7 @@ class EntityService extends BaseService {
8001
8087
  params,
8002
8088
  ...options
8003
8089
  });
8004
- // Convert PascalCase response to camelCase
8005
- const camelResponse = pascalToCamelCaseKeys(response.data);
8006
- return camelResponse;
8090
+ return response.data;
8007
8091
  }
8008
8092
  /**
8009
8093
  * Updates a single record in an entity by entity ID
@@ -8037,9 +8121,7 @@ class EntityService extends BaseService {
8037
8121
  params,
8038
8122
  ...options
8039
8123
  });
8040
- // Convert PascalCase response to camelCase
8041
- const camelResponse = pascalToCamelCaseKeys(response.data);
8042
- return camelResponse;
8124
+ return response.data;
8043
8125
  }
8044
8126
  /**
8045
8127
  * Updates data in an entity by entity ID
@@ -8081,9 +8163,7 @@ class EntityService extends BaseService {
8081
8163
  params,
8082
8164
  ...options
8083
8165
  });
8084
- // Convert PascalCase response to camelCase
8085
- const camelResponse = pascalToCamelCaseKeys(response.data);
8086
- return camelResponse;
8166
+ return response.data;
8087
8167
  }
8088
8168
  /**
8089
8169
  * Deletes data from an entity by entity ID
@@ -8113,9 +8193,7 @@ class EntityService extends BaseService {
8113
8193
  params,
8114
8194
  ...options
8115
8195
  });
8116
- // Convert PascalCase response to camelCase
8117
- const camelResponse = pascalToCamelCaseKeys(response.data);
8118
- return camelResponse;
8196
+ return response.data;
8119
8197
  }
8120
8198
  /**
8121
8199
  * Gets all entities in the system
@@ -8147,6 +8225,99 @@ class EntityService extends BaseService {
8147
8225
  });
8148
8226
  return entities;
8149
8227
  }
8228
+ /**
8229
+ * Queries entity records with filters, sorting, and pagination
8230
+ *
8231
+ * @param id - UUID of the entity
8232
+ * @param options - Query options including filterGroup, selectedFields, sortOptions, and pagination
8233
+ * @returns Promise resolving to {@link NonPaginatedResponse} without pagination options,
8234
+ * or {@link PaginatedResponse} when `pageSize`, `cursor`, or `jumpToPage` are provided
8235
+ *
8236
+ * @example
8237
+ * ```typescript
8238
+ * import { Entities, LogicalOperator, QueryFilterOperator } from '@uipath/uipath-typescript/entities';
8239
+ *
8240
+ * const entities = new Entities(sdk);
8241
+ *
8242
+ * // Non-paginated query with a filter
8243
+ * const result = await entities.queryRecordsById("<entityId>", {
8244
+ * filterGroup: {
8245
+ * logicalOperator: LogicalOperator.And,
8246
+ * queryFilters: [
8247
+ * { fieldName: "status", operator: QueryFilterOperator.Equals, value: "active" }
8248
+ * ]
8249
+ * },
8250
+ * sortOptions: [{ fieldName: "created_at", isDescending: true }],
8251
+ * });
8252
+ * console.log(`Found ${result.totalCount} records`);
8253
+ *
8254
+ * // With pagination
8255
+ * const page1 = await entities.queryRecordsById("<entityId>", {
8256
+ * filterGroup: { queryFilters: [{ fieldName: "status", operator: QueryFilterOperator.Equals, value: "active" }] },
8257
+ * pageSize: 25,
8258
+ * });
8259
+ * if (page1.hasNextPage) {
8260
+ * const page2 = await entities.queryRecordsById("<entityId>", { cursor: page1.nextCursor });
8261
+ * }
8262
+ * ```
8263
+ */
8264
+ async queryRecordsById(id, options) {
8265
+ return PaginationHelpers.getAll({
8266
+ serviceAccess: this.createPaginationServiceAccess(),
8267
+ getEndpoint: () => DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_ID(id),
8268
+ method: HTTP_METHODS.POST,
8269
+ pagination: {
8270
+ paginationType: PaginationType.OFFSET,
8271
+ itemsField: ENTITY_PAGINATION.ITEMS_FIELD,
8272
+ totalCountField: ENTITY_PAGINATION.TOTAL_COUNT_FIELD,
8273
+ paginationParams: {
8274
+ pageSizeParam: ENTITY_OFFSET_PARAMS.PAGE_SIZE_PARAM,
8275
+ offsetParam: ENTITY_OFFSET_PARAMS.OFFSET_PARAM,
8276
+ countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
8277
+ }
8278
+ },
8279
+ excludeFromPrefix: ['expansionLevel', 'filterGroup', 'selectedFields', 'sortOptions']
8280
+ }, options);
8281
+ }
8282
+ /**
8283
+ * Imports records from a CSV file into an entity
8284
+ *
8285
+ * @param id - UUID of the entity
8286
+ * @param file - CSV file to import (Blob, File, or Uint8Array)
8287
+ * @returns Promise resolving to import result with record counts
8288
+ *
8289
+ * @example
8290
+ * ```typescript
8291
+ * import { Entities } from '@uipath/uipath-typescript/entities';
8292
+ *
8293
+ * const entities = new Entities(sdk);
8294
+ *
8295
+ * // Browser: upload from file input
8296
+ * const fileInput = document.getElementById('csv-input') as HTMLInputElement;
8297
+ * const result = await entities.importRecordsById("<entityId>", fileInput.files[0]);
8298
+ *
8299
+ * // Node.js: read from disk
8300
+ * const fileBuffer = fs.readFileSync('records.csv');
8301
+ * const result = await entities.importRecordsById("<entityId>", new Blob([fileBuffer], { type: 'text/csv' }));
8302
+ *
8303
+ * console.log(`Inserted ${result.insertedRecords} of ${result.totalRecords} records`);
8304
+ * if (result.errorFileLink) {
8305
+ * console.log(`Error file link: ${result.errorFileLink}`);
8306
+ * }
8307
+ * ```
8308
+ * @internal
8309
+ */
8310
+ async importRecordsById(id, file) {
8311
+ const formData = new FormData();
8312
+ if (file instanceof Uint8Array) {
8313
+ formData.append('file', new Blob([file.buffer]));
8314
+ }
8315
+ else {
8316
+ formData.append('file', file);
8317
+ }
8318
+ const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.BULK_UPLOAD_BY_ID(id), formData);
8319
+ return response.data;
8320
+ }
8150
8321
  /**
8151
8322
  * Downloads an attachment from an entity record field
8152
8323
  *
@@ -8167,7 +8338,7 @@ class EntityService extends BaseService {
8167
8338
  *
8168
8339
  * // Get the recordId from getAllRecords()
8169
8340
  * const records = await entities.getAllRecords(entityId);
8170
- * const recordId = records[0].id;
8341
+ * const recordId = records[0].Id;
8171
8342
  *
8172
8343
  * // Download attachment for a specific record and field
8173
8344
  * const blob = await entities.downloadAttachment(entityId, recordId, 'Documents');
@@ -8201,7 +8372,7 @@ class EntityService extends BaseService {
8201
8372
  *
8202
8373
  * // Get the recordId from getAllRecords()
8203
8374
  * const records = await entities.getAllRecords(entityId);
8204
- * const recordId = records[0].id;
8375
+ * const recordId = records[0].Id;
8205
8376
  *
8206
8377
  * // Upload a file attachment
8207
8378
  * const response = await entities.uploadAttachment(entityId, recordId, 'Documents', file);
@@ -8217,9 +8388,7 @@ class EntityService extends BaseService {
8217
8388
  }
8218
8389
  const params = createParams({ expansionLevel: options?.expansionLevel });
8219
8390
  const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPLOAD_ATTACHMENT(entityId, recordId, fieldName), formData, { params });
8220
- // Convert PascalCase response to camelCase
8221
- const camelResponse = pascalToCamelCaseKeys(response.data);
8222
- return camelResponse;
8391
+ return response.data;
8223
8392
  }
8224
8393
  /**
8225
8394
  * Removes an attachment from a File-type field of an entity record
@@ -8241,7 +8410,7 @@ class EntityService extends BaseService {
8241
8410
  *
8242
8411
  * // Get the recordId from getAllRecords()
8243
8412
  * const records = await entities.getAllRecords(entityId);
8244
- * const recordId = records[0].id;
8413
+ * const recordId = records[0].Id;
8245
8414
  *
8246
8415
  * // Delete attachment for a specific record and field
8247
8416
  * await entities.deleteAttachment(entityId, recordId, 'Documents');
@@ -8273,18 +8442,169 @@ class EntityService extends BaseService {
8273
8442
  return this.insertRecordsById(id, data, options);
8274
8443
  }
8275
8444
  /**
8276
- * @hidden
8277
- * @deprecated Use {@link updateRecordsById} instead.
8445
+ * Creates a new Data Fabric entity with the given schema
8446
+ *
8447
+ * @param name - Entity name — must start with a letter and contain
8448
+ * only letters, numbers, and underscores (e.g., `"productCatalog"`).
8449
+ * @param fields - Array of field definitions
8450
+ * @param options - Optional entity-level settings ({@link EntityCreateOptions})
8451
+ * @returns Promise resolving to the ID of the created entity
8452
+ *
8453
+ * @example
8454
+ * ```typescript
8455
+ * const entityId = await entities.create("product_catalog", [
8456
+ * { fieldName: "product_name", type: EntityFieldDataType.STRING, isRequired: true, isUnique: true },
8457
+ * { fieldName: "price", type: EntityFieldDataType.INTEGER, defaultValue: "0" },
8458
+ * ], { displayName: "Product Catalog", description: "Our product catalog", isRbacEnabled: true });
8459
+ * ```
8460
+ * @internal
8278
8461
  */
8279
- async updateById(id, data, options = {}) {
8280
- return this.updateRecordsById(id, data, options);
8462
+ async create(name, fields, options) {
8463
+ this.validateName(name, 'entity');
8464
+ for (const field of fields) {
8465
+ this.validateName(field.fieldName, 'field');
8466
+ }
8467
+ const opts = options ?? {};
8468
+ const payload = {
8469
+ ...(opts.description !== undefined && { description: opts.description }),
8470
+ displayName: opts.displayName ?? name,
8471
+ entityDefinition: {
8472
+ name,
8473
+ fields: fields.map(f => this.buildSchemaFieldPayload(f)),
8474
+ folderId: opts.folderKey ?? DATA_FABRIC_TENANT_FOLDER_ID,
8475
+ isRbacEnabled: opts.isRbacEnabled ?? false,
8476
+ isInsightsEnabled: opts.isAnalyticsEnabled ?? false,
8477
+ externalFields: opts.externalFields ?? [],
8478
+ },
8479
+ };
8480
+ const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPSERT, payload);
8481
+ return response.data;
8281
8482
  }
8282
8483
  /**
8283
- * @hidden
8284
- * @deprecated Use {@link deleteRecordsById} instead.
8484
+ * Deletes a Data Fabric entity and all its records
8485
+ *
8486
+ * @param id - UUID of the entity to delete
8487
+ * @returns Promise resolving when the entity is deleted
8488
+ *
8489
+ * @example
8490
+ * ```typescript
8491
+ * await entities.deleteById("<entityId>");
8492
+ * ```
8493
+ * @internal
8494
+ */
8495
+ async deleteById(id) {
8496
+ await this.delete(DATA_FABRIC_ENDPOINTS.ENTITY.DELETE(id));
8497
+ }
8498
+ /**
8499
+ * Updates an existing Data Fabric entity — schema and/or metadata.
8500
+ *
8501
+ * Provide any combination of schema fields (`addFields`, `removeFields`, `updateFields`) and
8502
+ * metadata fields (`displayName`, `description`, `isRbacEnabled`). Each group is applied
8503
+ * only when the corresponding fields are present.
8504
+ *
8505
+ * **Warning:** Schema changes (`addFields`, `removeFields`, `updateFields`) use a
8506
+ * read-modify-write pattern — concurrent calls on the same entity may silently
8507
+ * overwrite each other's changes.
8508
+ *
8509
+ * @param id - UUID of the entity to update
8510
+ * @param options - Changes to apply ({@link EntityUpdateByIdOptions})
8511
+ * @returns Promise resolving when the update is complete
8512
+ *
8513
+ * @example
8514
+ * ```typescript
8515
+ * // Schema-only
8516
+ * await entities.updateById("<entityId>", {
8517
+ * addFields: [{ fieldName: "notes", type: EntityFieldDataType.MULTILINE_TEXT }],
8518
+ * removeFields: [{ fieldName: "old_field" }],
8519
+ * });
8520
+ *
8521
+ * // Metadata-only
8522
+ * await entities.updateById("<entityId>", {
8523
+ * displayName: "My Updated Entity",
8524
+ * description: "Updated description",
8525
+ * });
8526
+ *
8527
+ * // Combined
8528
+ * await entities.updateById("<entityId>", {
8529
+ * updateFields: [{ id: "<fieldId>", displayName: "Unit Price", isRequired: true }],
8530
+ * displayName: "Price Catalog",
8531
+ * });
8532
+ * ```
8533
+ * @internal
8534
+ */
8535
+ async updateById(id, options) {
8536
+ const opts = options ?? {};
8537
+ const hasSchemaChanges = !!(opts.addFields?.length || opts.removeFields?.length || opts.updateFields?.length);
8538
+ const hasMetadataChanges = opts.displayName !== undefined || opts.description !== undefined || opts.isRbacEnabled !== undefined;
8539
+ if (hasSchemaChanges) {
8540
+ await this.applySchemaUpdate(id, opts);
8541
+ }
8542
+ if (hasMetadataChanges) {
8543
+ await this.patch(DATA_FABRIC_ENDPOINTS.ENTITY.UPDATE_METADATA(id), {
8544
+ ...(opts.displayName !== undefined && { displayName: opts.displayName }),
8545
+ ...(opts.description !== undefined && { description: opts.description }),
8546
+ ...(opts.isRbacEnabled !== undefined && { isRbacEnabled: opts.isRbacEnabled }),
8547
+ });
8548
+ }
8549
+ }
8550
+ /**
8551
+ * Fetches the current entity schema, applies the field delta, then posts the full updated schema.
8552
+ *
8553
+ * @param entityId - UUID of the entity to update
8554
+ * @param options - Field changes to apply
8555
+ * @private
8285
8556
  */
8286
- async deleteById(id, recordIds, options = {}) {
8287
- return this.deleteRecordsById(id, recordIds, options);
8557
+ async applySchemaUpdate(entityId, options) {
8558
+ const entityResponse = await this.get(DATA_FABRIC_ENDPOINTS.ENTITY.GET_BY_ID(entityId));
8559
+ const raw = entityResponse.data;
8560
+ // Carry forward existing non-system fields from GET response (skip system/primary-key fields)
8561
+ let fields = (raw.fields ?? [])
8562
+ .filter(f => !f.isSystemField && !f.isPrimaryKey);
8563
+ // Filter out removed fields
8564
+ if (options.removeFields?.length) {
8565
+ const removeSet = new Set(options.removeFields.map(r => r.fieldName));
8566
+ fields = fields.filter(f => !removeSet.has(f.name));
8567
+ }
8568
+ // Apply per-field metadata updates (matched by field ID)
8569
+ if (options.updateFields?.length) {
8570
+ const updateMap = new Map(options.updateFields.map(u => [u.id, u]));
8571
+ fields = fields.map(f => {
8572
+ const update = updateMap.get(f.id ?? '');
8573
+ if (!update)
8574
+ return f;
8575
+ return {
8576
+ ...f,
8577
+ ...(update.displayName !== undefined && { displayName: update.displayName }),
8578
+ ...(update.description !== undefined && { description: update.description }),
8579
+ ...(update.isRequired !== undefined && { isRequired: update.isRequired }),
8580
+ ...(update.isUnique !== undefined && { isUnique: update.isUnique }),
8581
+ ...(update.isRbacEnabled !== undefined && { isRbacEnabled: update.isRbacEnabled }),
8582
+ ...(update.isEncrypted !== undefined && { isEncrypted: update.isEncrypted }),
8583
+ ...(update.defaultValue !== undefined && { defaultValue: update.defaultValue }),
8584
+ };
8585
+ });
8586
+ }
8587
+ // Build and append new fields
8588
+ const newFields = [];
8589
+ if (options.addFields?.length) {
8590
+ for (const field of options.addFields) {
8591
+ this.validateName(field.fieldName, 'field');
8592
+ }
8593
+ newFields.push(...options.addFields.map(f => this.buildSchemaFieldPayload(f)));
8594
+ }
8595
+ await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPSERT, {
8596
+ displayName: raw.displayName,
8597
+ description: raw.description,
8598
+ entityDefinition: {
8599
+ id: entityId,
8600
+ name: raw.name,
8601
+ fields: [...fields, ...newFields],
8602
+ folderId: raw.folderId ?? DATA_FABRIC_TENANT_FOLDER_ID,
8603
+ isRbacEnabled: raw.isRbacEnabled ?? false,
8604
+ isInsightsEnabled: raw.isInsightsEnabled ?? false,
8605
+ externalFields: raw.externalFields ?? [],
8606
+ },
8607
+ });
8288
8608
  }
8289
8609
  /**
8290
8610
  * Orchestrates all field mapping transformations
@@ -8308,11 +8628,20 @@ class EntityService extends BaseService {
8308
8628
  metadata.fields = metadata.fields.map(field => {
8309
8629
  // Rename sqlType to fieldDataType
8310
8630
  let transformedField = transformData(field, EntityMap);
8311
- // Map SQL field type to friendly name
8631
+ // Map field type: prefer fieldDisplayType for types that share SQL types (File, ChoiceSet, AutoNumber)
8312
8632
  if (transformedField.fieldDataType?.name) {
8313
- const sqlTypeName = transformedField.fieldDataType.name;
8314
- if (EntityFieldTypeMap[sqlTypeName]) {
8315
- transformedField.fieldDataType.name = EntityFieldTypeMap[sqlTypeName];
8633
+ const displayTypeMapped = transformedField.fieldDisplayType
8634
+ ? FieldDisplayTypeToDataType[transformedField.fieldDisplayType]
8635
+ : undefined;
8636
+ if (displayTypeMapped) {
8637
+ transformedField.fieldDataType.name = displayTypeMapped;
8638
+ }
8639
+ else {
8640
+ const rawSqlTypeName = field.sqlType?.name;
8641
+ const mapped = rawSqlTypeName ? EntityFieldTypeMap[rawSqlTypeName] : undefined;
8642
+ if (mapped) {
8643
+ transformedField.fieldDataType.name = mapped;
8644
+ }
8316
8645
  }
8317
8646
  }
8318
8647
  this.transformNestedReferences(transformedField);
@@ -8356,7 +8685,44 @@ class EntityService extends BaseService {
8356
8685
  return externalSource;
8357
8686
  });
8358
8687
  }
8688
+ /** Converts a user-facing EntityCreateFieldOptions to the raw API field payload */
8689
+ buildSchemaFieldPayload(field) {
8690
+ this.validateName(field.fieldName, 'field');
8691
+ const mapping = EntitySchemaFieldTypeMap[field.type ?? EntityFieldDataType.STRING];
8692
+ return {
8693
+ name: field.fieldName,
8694
+ displayName: field.displayName ?? field.fieldName,
8695
+ sqlType: { name: mapping.sqlTypeName },
8696
+ fieldDisplayType: mapping.fieldDisplayType,
8697
+ description: field.description ?? '',
8698
+ isRequired: field.isRequired ?? false,
8699
+ isUnique: field.isUnique ?? false,
8700
+ isRbacEnabled: field.isRbacEnabled ?? false,
8701
+ isEncrypted: field.isEncrypted ?? false,
8702
+ ...(field.defaultValue !== undefined && { defaultValue: field.defaultValue }),
8703
+ ...(field.choiceSetId !== undefined && { choiceSetId: field.choiceSetId }),
8704
+ ...(field.referenceEntityName !== undefined && { referenceEntityName: field.referenceEntityName }),
8705
+ ...(field.referenceFieldName !== undefined && { referenceFieldName: field.referenceFieldName }),
8706
+ };
8707
+ }
8708
+ validateName(name, context) {
8709
+ if (name.length < 3 || name.length > 100 || !/^[a-zA-Z]\w*$/.test(name)) {
8710
+ const suggestion = name.replace(/\W/g, '').replace(/^[0-9_]+/, '');
8711
+ const defaultName = `My${context.charAt(0).toUpperCase() + context.slice(1)}`;
8712
+ throw new ValidationError({
8713
+ message: `Invalid ${context} name '${name}'. Must start with a letter, contain only letters, numbers, and underscores, 3–100 characters (e.g., "${suggestion || defaultName}").`
8714
+ });
8715
+ }
8716
+ if (context === 'field' && EntityService.RESERVED_FIELD_NAMES.has(name)) {
8717
+ throw new ValidationError({
8718
+ message: `Field name '${name}' is reserved. Reserved names: ${[...EntityService.RESERVED_FIELD_NAMES].join(', ')}.`
8719
+ });
8720
+ }
8721
+ }
8359
8722
  }
8723
+ EntityService.RESERVED_FIELD_NAMES = new Set([
8724
+ 'Id', 'CreatedBy', 'CreateTime', 'UpdatedBy', 'UpdateTime'
8725
+ ]);
8360
8726
  __decorate([
8361
8727
  track('Entities.GetById')
8362
8728
  ], EntityService.prototype, "getById", null);
@@ -8384,6 +8750,12 @@ __decorate([
8384
8750
  __decorate([
8385
8751
  track('Entities.GetAll')
8386
8752
  ], EntityService.prototype, "getAll", null);
8753
+ __decorate([
8754
+ track('Entities.QueryRecordsById')
8755
+ ], EntityService.prototype, "queryRecordsById", null);
8756
+ __decorate([
8757
+ track('Entities.ImportRecordsById')
8758
+ ], EntityService.prototype, "importRecordsById", null);
8387
8759
  __decorate([
8388
8760
  track('Entities.DownloadAttachment')
8389
8761
  ], EntityService.prototype, "downloadAttachment", null);
@@ -8393,6 +8765,15 @@ __decorate([
8393
8765
  __decorate([
8394
8766
  track('Entities.DeleteAttachment')
8395
8767
  ], EntityService.prototype, "deleteAttachment", null);
8768
+ __decorate([
8769
+ track('Entities.Create')
8770
+ ], EntityService.prototype, "create", null);
8771
+ __decorate([
8772
+ track('Entities.DeleteById')
8773
+ ], EntityService.prototype, "deleteById", null);
8774
+ __decorate([
8775
+ track('Entities.UpdateById')
8776
+ ], EntityService.prototype, "updateById", null);
8396
8777
 
8397
8778
  class ChoiceSetService extends BaseService {
8398
8779
  /**
@@ -10960,6 +11341,36 @@ var BucketOptions;
10960
11341
  BucketOptions["AccessDataThroughOrchestrator"] = "AccessDataThroughOrchestrator";
10961
11342
  })(BucketOptions || (BucketOptions = {}));
10962
11343
 
11344
+ /**
11345
+ * Creates methods for a job response object.
11346
+ *
11347
+ * @param jobData - The raw job data from API
11348
+ * @param service - The job service instance
11349
+ * @returns Object containing job methods
11350
+ */
11351
+ function createJobMethods(jobData, service) {
11352
+ return {
11353
+ async getOutput() {
11354
+ if (!jobData.key)
11355
+ throw new Error('Job key is undefined');
11356
+ if (!jobData.folderId)
11357
+ throw new Error('Job folderId is undefined');
11358
+ return service.getOutput(jobData.key, jobData.folderId);
11359
+ },
11360
+ };
11361
+ }
11362
+ /**
11363
+ * Creates a job response with bound methods.
11364
+ *
11365
+ * @param jobData - The raw job data from API
11366
+ * @param service - The job service instance
11367
+ * @returns A job object with added methods
11368
+ */
11369
+ function createJobWithMethods(jobData, service) {
11370
+ const methods = createJobMethods(jobData, service);
11371
+ return Object.assign({}, jobData, methods);
11372
+ }
11373
+
10963
11374
  /**
10964
11375
  * Maps fields for Job entities to ensure consistent naming
10965
11376
  * Semantic renames only — case conversion handled by pascalToCamelCaseKeys()
@@ -10975,27 +11386,81 @@ const JobMap = {
10975
11386
  release: 'process',
10976
11387
  };
10977
11388
 
11389
+ /**
11390
+ * Maps fields for Attachment entities to ensure consistent naming
11391
+ */
11392
+ const AttachmentsMap = {
11393
+ creationTime: 'createdTime',
11394
+ lastModificationTime: 'lastModifiedTime'
11395
+ };
11396
+
11397
+ class AttachmentService extends BaseService {
11398
+ /**
11399
+ * Gets an attachment by ID
11400
+ * @param id - The UUID of the attachment to retrieve
11401
+ * @param options - Optional query parameters (expand, select)
11402
+ * @returns Promise resolving to the attachment
11403
+ *
11404
+ * @example
11405
+ * ```typescript
11406
+ * import { Attachments } from '@uipath/uipath-typescript/attachments';
11407
+ *
11408
+ * const attachments = new Attachments(sdk);
11409
+ * const attachment = await attachments.getById('12345678-1234-1234-1234-123456789abc');
11410
+ * ```
11411
+ */
11412
+ async getById(id, options = {}) {
11413
+ if (!id) {
11414
+ throw new ValidationError({ message: 'id is required for getById' });
11415
+ }
11416
+ // Prefix all keys in options with $ for OData
11417
+ const keysToPrefix = Object.keys(options);
11418
+ const apiOptions = addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix);
11419
+ const response = await this.get(ORCHESTRATOR_ATTACHMENT_ENDPOINTS.GET_BY_ID(id), {
11420
+ params: apiOptions,
11421
+ });
11422
+ // Transform response from PascalCase to camelCase, then apply field maps
11423
+ const camelCased = pascalToCamelCaseKeys(response.data);
11424
+ camelCased.blobFileAccess = transformData(camelCased.blobFileAccess, BucketMap);
11425
+ return transformData(camelCased, AttachmentsMap);
11426
+ }
11427
+ }
11428
+ __decorate([
11429
+ track('Attachments.GetById')
11430
+ ], AttachmentService.prototype, "getById", null);
11431
+
10978
11432
  /**
10979
11433
  * Service for interacting with UiPath Orchestrator Jobs API
10980
11434
  */
10981
11435
  class JobService extends FolderScopedService {
10982
11436
  /**
10983
- * Gets all jobs across folders with optional filtering
11437
+ * Creates an instance of the Jobs service.
10984
11438
  *
10985
- * @param options - Query options including optional folderId and pagination options
10986
- * @returns Promise resolving to array of jobs or paginated response
11439
+ * @param instance - UiPath SDK instance providing authentication and configuration
11440
+ */
11441
+ constructor(instance) {
11442
+ super(instance);
11443
+ this.attachmentService = new AttachmentService(instance);
11444
+ }
11445
+ /**
11446
+ * Gets all jobs across folders with optional filtering and pagination.
10987
11447
  *
10988
- * @example
10989
- * ```typescript
10990
- * import { Jobs } from '@uipath/uipath-typescript/jobs';
11448
+ * Returns jobs with full details including state, timing, and input/output arguments.
11449
+ * Pass `folderId` to scope the query to a specific folder.
10991
11450
  *
10992
- * const jobs = new Jobs(sdk);
11451
+ * !!! info "Input and output fields are not included in `getAll` responses"
11452
+ * The `inputArguments`, `inputFile`, `outputArguments`, and `outputFile` fields will always be `null` in the `getAll` response. To retrieve a job's output, use the {@link getOutput} method with the job's `key` and `folderId`.
10993
11453
  *
11454
+ * @param options - Query options including optional folderId, filtering, and pagination options
11455
+ * @returns Promise resolving to either an array of jobs {@link NonPaginatedResponse}<{@link JobGetResponse}> or a {@link PaginatedResponse}<{@link JobGetResponse}> when pagination options are used.
11456
+ * {@link JobGetResponse}
11457
+ * @example
11458
+ * ```typescript
10994
11459
  * // Get all jobs
10995
11460
  * const allJobs = await jobs.getAll();
10996
11461
  *
10997
11462
  * // Get all jobs in a specific folder
10998
- * const folderJobs = await jobs.getAll({ folderId: 123 });
11463
+ * const folderJobs = await jobs.getAll({ folderId: <folderId> });
10999
11464
  *
11000
11465
  * // With filtering
11001
11466
  * const runningJobs = await jobs.getAll({
@@ -11009,10 +11474,19 @@ class JobService extends FolderScopedService {
11009
11474
  * if (page1.hasNextPage) {
11010
11475
  * const page2 = await jobs.getAll({ cursor: page1.nextCursor });
11011
11476
  * }
11477
+ *
11478
+ * // Jump to specific page
11479
+ * const page5 = await jobs.getAll({
11480
+ * jumpToPage: 5,
11481
+ * pageSize: 10
11482
+ * });
11012
11483
  * ```
11013
11484
  */
11014
11485
  async getAll(options) {
11015
- const transformJobResponse = (job) => transformData(pascalToCamelCaseKeys(job), JobMap);
11486
+ const transformJobResponse = (job) => {
11487
+ const rawJob = transformData(pascalToCamelCaseKeys(job), JobMap);
11488
+ return createJobWithMethods(rawJob, this);
11489
+ };
11016
11490
  return PaginationHelpers.getAll({
11017
11491
  serviceAccess: this.createPaginationServiceAccess(),
11018
11492
  getEndpoint: () => JOB_ENDPOINTS.GET_ALL,
@@ -11030,10 +11504,144 @@ class JobService extends FolderScopedService {
11030
11504
  },
11031
11505
  }, options);
11032
11506
  }
11507
+ /**
11508
+ * Gets a job by its unique key (GUID).
11509
+ *
11510
+ * Returns the full job details including state, timing, input/output arguments, and error information.
11511
+ * Use `expand` to include related entities like `robot`, or `machine`.
11512
+ *
11513
+ * @param id - The unique key (GUID) of the job to retrieve
11514
+ * @param folderId - The folder ID where the job resides
11515
+ * @param options - Optional query options for expanding or selecting fields
11516
+ * @returns Promise resolving to a {@link JobGetResponse} with full job details and bound methods
11517
+ *
11518
+ * @example
11519
+ * ```typescript
11520
+ * // Get a job by key
11521
+ * const job = await jobs.getById(<id>, <folderId>);
11522
+ * console.log(job.state, job.processName);
11523
+ * ```
11524
+ *
11525
+ * @example
11526
+ * ```typescript
11527
+ * // With expanded related entities
11528
+ * const job = await jobs.getById(<id>, <folderId>, {
11529
+ * expand: 'robot,machine'
11530
+ * });
11531
+ * console.log(job.robot?.name, job.machine?.name);
11532
+ * ```
11533
+ */
11534
+ async getById(id, folderId, options) {
11535
+ if (!id) {
11536
+ throw new ValidationError({ message: 'id is required for getById' });
11537
+ }
11538
+ if (!folderId) {
11539
+ throw new ValidationError({ message: 'folderId is required for getById' });
11540
+ }
11541
+ const headers = createHeaders({ [FOLDER_ID]: folderId });
11542
+ const keysToPrefix = Object.keys(options ?? {});
11543
+ const apiOptions = options ? addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix) : {};
11544
+ const response = await this.get(JOB_ENDPOINTS.GET_BY_KEY(id), {
11545
+ params: apiOptions,
11546
+ headers,
11547
+ });
11548
+ const rawJob = transformData(pascalToCamelCaseKeys(response.data), JobMap);
11549
+ return createJobWithMethods(rawJob, this);
11550
+ }
11551
+ /**
11552
+ * Gets the output of a completed job.
11553
+ *
11554
+ * Retrieves the job's output arguments, handling both inline output (stored directly on the job
11555
+ * as a JSON string in `outputArguments`) and file-based output (stored as a blob attachment for
11556
+ * large outputs). Returns the parsed JSON output or `null` if the job has no output.
11557
+ *
11558
+ * @param jobKey - The unique key (GUID) of the job to retrieve output from
11559
+ * @param folderId - The folder ID where the job resides
11560
+ * @returns Promise resolving to the parsed output as `Record<string, unknown>`, or `null` if no output exists
11561
+ *
11562
+ * @example
11563
+ * ```typescript
11564
+ * // Get output from a completed job
11565
+ * const output = await jobs.getOutput(<jobKey>, <folderId>);
11566
+ *
11567
+ * if (output) {
11568
+ * console.log('Job output:', output);
11569
+ * }
11570
+ * ```
11571
+ *
11572
+ * @example
11573
+ * ```typescript
11574
+ * // Get output using bound method (jobKey and folderId are taken from the job object)
11575
+ * const allJobs = await jobs.getAll();
11576
+ * const completedJob = allJobs.items.find(j => j.state === JobState.Successful);
11577
+ *
11578
+ * if (completedJob) {
11579
+ * const output = await completedJob.getOutput();
11580
+ * }
11581
+ * ```
11582
+ */
11583
+ async getOutput(jobKey, folderId) {
11584
+ if (!jobKey) {
11585
+ throw new ValidationError({ message: 'jobKey is required for getOutput' });
11586
+ }
11587
+ const job = await this.getById(jobKey, folderId, { select: 'outputArguments,outputFile' });
11588
+ if (job.outputArguments) {
11589
+ try {
11590
+ return JSON.parse(job.outputArguments);
11591
+ }
11592
+ catch {
11593
+ throw new ServerError({ message: 'Failed to parse job output arguments as JSON' });
11594
+ }
11595
+ }
11596
+ if (job.outputFile) {
11597
+ return this.downloadOutputFile(job.outputFile);
11598
+ }
11599
+ return null;
11600
+ }
11601
+ /**
11602
+ * Downloads the output file content via the Attachments API.
11603
+ * 1. Fetches blob access info from the attachment using AttachmentService
11604
+ * 2. Downloads content from the presigned blob URI
11605
+ * 3. Parses and returns the JSON content
11606
+ */
11607
+ async downloadOutputFile(outputFileKey) {
11608
+ const attachment = await this.attachmentService.getById(outputFileKey);
11609
+ const blobAccess = attachment.blobFileAccess;
11610
+ if (!blobAccess?.uri) {
11611
+ return null;
11612
+ }
11613
+ const blobHeaders = { ...blobAccess.headers };
11614
+ // Add auth header if the blob URI requires authenticated access
11615
+ if (blobAccess.requiresAuth) {
11616
+ const token = await this.getValidAuthToken();
11617
+ blobHeaders['Authorization'] = `Bearer ${token}`;
11618
+ }
11619
+ const blobResponse = await fetch(blobAccess.uri, {
11620
+ method: 'GET',
11621
+ headers: blobHeaders,
11622
+ });
11623
+ if (!blobResponse.ok) {
11624
+ const errorInfo = await errorResponseParser.parse(blobResponse);
11625
+ throw ErrorFactory.createFromHttpStatus(blobResponse.status, errorInfo);
11626
+ }
11627
+ const content = await blobResponse.text();
11628
+ try {
11629
+ return JSON.parse(content);
11630
+ }
11631
+ catch {
11632
+ throw new ServerError({ message: 'Failed to parse job output file as JSON' });
11633
+ }
11634
+ }
11033
11635
  }
11034
11636
  __decorate([
11035
11637
  track('Jobs.GetAll')
11036
11638
  ], JobService.prototype, "getAll", null);
11639
+ __decorate([
11640
+ track('Jobs.GetById')
11641
+ ], JobService.prototype, "getById", null);
11642
+ __decorate([
11643
+ track('Jobs.GetOutput')
11644
+ ], JobService.prototype, "getOutput", null);
11037
11645
 
11038
11646
  /**
11039
11647
  * Enum for job sub-state
@@ -11060,6 +11668,22 @@ var ServerlessJobType;
11060
11668
  ServerlessJobType["PythonAgent"] = "PythonAgent";
11061
11669
  })(ServerlessJobType || (ServerlessJobType = {}));
11062
11670
 
11671
+ /**
11672
+ * Common enum for job state used across services
11673
+ */
11674
+ var JobState;
11675
+ (function (JobState) {
11676
+ JobState["Pending"] = "Pending";
11677
+ JobState["Running"] = "Running";
11678
+ JobState["Stopping"] = "Stopping";
11679
+ JobState["Terminating"] = "Terminating";
11680
+ JobState["Faulted"] = "Faulted";
11681
+ JobState["Successful"] = "Successful";
11682
+ JobState["Stopped"] = "Stopped";
11683
+ JobState["Suspended"] = "Suspended";
11684
+ JobState["Resumed"] = "Resumed";
11685
+ })(JobState || (JobState = {}));
11686
+
11063
11687
  /**
11064
11688
  * Maps fields for Process entities to ensure consistent naming
11065
11689
  */
@@ -11516,49 +12140,6 @@ __decorate([
11516
12140
  track('Queues.GetById')
11517
12141
  ], QueueService.prototype, "getById", null);
11518
12142
 
11519
- /**
11520
- * Maps fields for Attachment entities to ensure consistent naming
11521
- */
11522
- const AttachmentsMap = {
11523
- creationTime: 'createdTime',
11524
- lastModificationTime: 'lastModifiedTime'
11525
- };
11526
-
11527
- class AttachmentService extends BaseService {
11528
- /**
11529
- * Gets an attachment by ID
11530
- * @param id - The UUID of the attachment to retrieve
11531
- * @param options - Optional query parameters (expand, select)
11532
- * @returns Promise resolving to the attachment
11533
- *
11534
- * @example
11535
- * ```typescript
11536
- * import { Attachments } from '@uipath/uipath-typescript/attachments';
11537
- *
11538
- * const attachments = new Attachments(sdk);
11539
- * const attachment = await attachments.getById('12345678-1234-1234-1234-123456789abc');
11540
- * ```
11541
- */
11542
- async getById(id, options = {}) {
11543
- if (!id) {
11544
- throw new ValidationError({ message: 'id is required for getById' });
11545
- }
11546
- // Prefix all keys in options with $ for OData
11547
- const keysToPrefix = Object.keys(options);
11548
- const apiOptions = addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix);
11549
- const response = await this.get(ORCHESTRATOR_ATTACHMENT_ENDPOINTS.GET_BY_ID(id), {
11550
- params: apiOptions,
11551
- });
11552
- // Transform response from PascalCase to camelCase, then apply field maps
11553
- const camelCased = pascalToCamelCaseKeys(response.data);
11554
- camelCased.blobFileAccess = transformData(camelCased.blobFileAccess, BucketMap);
11555
- return transformData(camelCased, AttachmentsMap);
11556
- }
11557
- }
11558
- __decorate([
11559
- track('Attachments.GetById')
11560
- ], AttachmentService.prototype, "getById", null);
11561
-
11562
12143
  /**
11563
12144
  * UiPath SDK - Legacy class providing all services through property getters.
11564
12145
  *
@@ -11674,22 +12255,6 @@ class UiPath extends UiPath$1 {
11674
12255
  }
11675
12256
  }
11676
12257
 
11677
- /**
11678
- * Common enum for job state used across services
11679
- */
11680
- var JobState;
11681
- (function (JobState) {
11682
- JobState["Pending"] = "Pending";
11683
- JobState["Running"] = "Running";
11684
- JobState["Stopping"] = "Stopping";
11685
- JobState["Terminating"] = "Terminating";
11686
- JobState["Faulted"] = "Faulted";
11687
- JobState["Successful"] = "Successful";
11688
- JobState["Stopped"] = "Stopped";
11689
- JobState["Suspended"] = "Suspended";
11690
- JobState["Resumed"] = "Resumed";
11691
- })(JobState || (JobState = {}));
11692
-
11693
12258
  /**
11694
12259
  * Common Constants for Conversational Agent
11695
12260
  */
@@ -12023,4 +12588,4 @@ function getAppBase() {
12023
12588
  return getMetaTagContent(UiPathMetaTags.APP_BASE) || '/';
12024
12589
  }
12025
12590
 
12026
- export { APP_NAME, AgentMap, AssetValueScope, AssetValueType, AuthenticationError, AuthorizationError, BucketOptions, CLOUD_CLIENT_ID, CLOUD_ORGANIZATION_NAME, CLOUD_REDIRECT_URI, CLOUD_ROLE_NAME, CLOUD_TENANT_NAME, CLOUD_URL, CONNECTION_STRING, CitationErrorType, ConversationMap, DEFAULT_ITEMS_FIELD, DEFAULT_PAGE_SIZE, DEFAULT_TOTAL_COUNT_FIELD, DataDirectionType, DebugMode, EntityFieldDataType, EntityType, ErrorType, EscalationActionType, EscalationRecipientScope, EscalationTriggerType, ExchangeMap, FeedbackRating, FieldDisplayType, HttpStatus, InputStreamSpeechSensitivity, InterruptType, JobPriority, JobSourceType, JobState, JobSubState, JobType, JoinType, MAX_PAGE_SIZE, MessageMap, MessageRole, NetworkError, NotFoundError, PackageSourceType, PackageType, ProcessIncidentSeverity, ProcessIncidentStatus, ProcessIncidentType, RateLimitError, ReferenceType, RemoteControlAccess, RobotSize, RuntimeType, SDK_LOGGER_NAME, SDK_RUN_EVENT, SDK_SERVICE_NAME, SDK_VERSION, SERVICE, SLADurationUnit, ServerError, ServerlessJobType, SortOrder, StageTaskType, StartStrategy, StopStrategy, TargetFramework, TaskActivityType, TaskPriority, TaskSlaCriteria, TaskSlaStatus, TaskSourceName, TaskStatus, TaskType, UNKNOWN$1 as UNKNOWN, UiPath, UiPathError, UiPathMetaTags, UserSettingsMap, VERSION, ValidationError, createAgentWithMethods, createCaseInstanceWithMethods, createConversationWithMethods, createEntityWithMethods, createProcessInstanceWithMethods, createProcessWithMethods, createTaskWithMethods, getAppBase, getAsset, getErrorDetails, getLimitedPageSize, isAuthenticationError, isAuthorizationError, isNetworkError, isNotFoundError, isRateLimitError, isServerError, isUiPathError, isValidationError, loadFromMetaTags, telemetryClient, track, trackEvent };
12591
+ export { APP_NAME, AgentMap, AssetValueScope, AssetValueType, AuthenticationError, AuthorizationError, BucketOptions, CLOUD_CLIENT_ID, CLOUD_ORGANIZATION_NAME, CLOUD_REDIRECT_URI, CLOUD_ROLE_NAME, CLOUD_TENANT_NAME, CLOUD_URL, CONNECTION_STRING, CitationErrorType, ConversationMap, DEFAULT_ITEMS_FIELD, DEFAULT_PAGE_SIZE, DEFAULT_TOTAL_COUNT_FIELD, DataDirectionType, DebugMode, EntityFieldDataType, EntityType, ErrorType, EscalationActionType, EscalationRecipientScope, EscalationTriggerType, ExchangeMap, FeedbackRating, FieldDisplayType, HttpStatus, InputStreamSpeechSensitivity, InterruptType, JobPriority, JobSourceType, JobState, JobSubState, JobType, JoinType, LogicalOperator, MAX_PAGE_SIZE, MessageMap, MessageRole, NetworkError, NotFoundError, PackageSourceType, PackageType, ProcessIncidentSeverity, ProcessIncidentStatus, ProcessIncidentType, QueryFilterOperator, RateLimitError, ReferenceType, RemoteControlAccess, RobotSize, RuntimeType, SDK_LOGGER_NAME, SDK_RUN_EVENT, SDK_SERVICE_NAME, SDK_VERSION, SERVICE, SLADurationUnit, ServerError, ServerlessJobType, SortOrder, StageTaskType, StartStrategy, StopStrategy, TargetFramework, TaskActivityType, TaskPriority, TaskSlaCriteria, TaskSlaStatus, TaskSourceName, TaskStatus, TaskType, UNKNOWN$1 as UNKNOWN, UiPath, UiPathError, UiPathMetaTags, UserSettingsMap, VERSION, ValidationError, createAgentWithMethods, createCaseInstanceWithMethods, createConversationWithMethods, createEntityWithMethods, createJobWithMethods, createProcessInstanceWithMethods, createProcessWithMethods, createTaskWithMethods, getAppBase, getAsset, getErrorDetails, getLimitedPageSize, isAuthenticationError, isAuthorizationError, isNetworkError, isNotFoundError, isRateLimitError, isServerError, isUiPathError, isValidationError, loadFromMetaTags, telemetryClient, track, trackEvent };