@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.umd.js CHANGED
@@ -4522,6 +4522,7 @@
4522
4522
  */
4523
4523
  const JOB_ENDPOINTS = {
4524
4524
  GET_ALL: `${ORCHESTRATOR_BASE}/odata/Jobs`,
4525
+ GET_BY_KEY: (identifier) => `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.GetByKey(identifier=${identifier})`,
4525
4526
  };
4526
4527
  /**
4527
4528
  * Orchestrator Asset Service Endpoints
@@ -4574,6 +4575,12 @@
4574
4575
  /**
4575
4576
  * Data Fabric Service Endpoints
4576
4577
  */
4578
+ /**
4579
+ * Default folder key used for tenant-level Data Fabric entities.
4580
+ * Tenant-level entities are not scoped to a folder; this is the
4581
+ * conventional placeholder value the API expects.
4582
+ */
4583
+ const DATA_FABRIC_TENANT_FOLDER_ID = '00000000-0000-0000-0000-000000000000';
4577
4584
  /**
4578
4585
  * Data Fabric Entity Service Endpoints
4579
4586
  */
@@ -4588,6 +4595,11 @@
4588
4595
  UPDATE_RECORD_BY_ID: (entityId, recordId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/update/${recordId}`,
4589
4596
  UPDATE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/update-batch`,
4590
4597
  DELETE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/delete-batch`,
4598
+ UPSERT: `${DATAFABRIC_BASE}/api/Entity`,
4599
+ DELETE: (entityId) => `${DATAFABRIC_BASE}/api/Entity/${entityId}`,
4600
+ UPDATE_METADATA: (entityId) => `${DATAFABRIC_BASE}/api/Entity/${entityId}/metadata`,
4601
+ QUERY_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/query`,
4602
+ BULK_UPLOAD_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/bulk-upload`,
4591
4603
  DOWNLOAD_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
4592
4604
  UPLOAD_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
4593
4605
  DELETE_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
@@ -9176,7 +9188,7 @@
9176
9188
  // Connection string placeholder that will be replaced during build
9177
9189
  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";
9178
9190
  // SDK Version placeholder
9179
- const SDK_VERSION = "1.2.2";
9191
+ const SDK_VERSION = "1.3.1";
9180
9192
  const VERSION = "Version";
9181
9193
  const SERVICE = "Service";
9182
9194
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -9565,7 +9577,7 @@
9565
9577
  *
9566
9578
  * Supports two usage patterns:
9567
9579
  * 1. Full config in constructor — for server-side or explicit configuration
9568
- * 2. No config / partial config — loads from meta tags injected by @uipath/coded-apps plugin
9580
+ * 2. No config / partial config — loads from meta tags injected by @uipath/coded-apps-dev plugin
9569
9581
  *
9570
9582
  * @example
9571
9583
  * ```typescript
@@ -10031,15 +10043,11 @@
10031
10043
 
10032
10044
  class ApiClient {
10033
10045
  constructor(config, executionContext, tokenManager, clientConfig = {}) {
10034
- this.defaultHeaders = {};
10035
10046
  this.config = config;
10036
10047
  this.executionContext = executionContext;
10037
10048
  this.clientConfig = clientConfig;
10038
10049
  this.tokenManager = tokenManager;
10039
10050
  }
10040
- setDefaultHeaders(headers) {
10041
- this.defaultHeaders = { ...this.defaultHeaders, ...headers };
10042
- }
10043
10051
  /**
10044
10052
  * Gets a valid authentication token, refreshing if necessary.
10045
10053
  * Used internally for API requests and exposed for services that need manual auth headers.
@@ -10055,7 +10063,6 @@
10055
10063
  return {
10056
10064
  'Authorization': `Bearer ${token}`,
10057
10065
  'Content-Type': CONTENT_TYPES.JSON,
10058
- ...this.defaultHeaders,
10059
10066
  ...this.clientConfig.headers
10060
10067
  };
10061
10068
  }
@@ -11111,6 +11118,8 @@
11111
11118
  *
11112
11119
  * @param instance - UiPath SDK instance providing authentication and configuration.
11113
11120
  * Services receive this via dependency injection in the modular pattern.
11121
+ * @param headers - Optional default headers to include in every request (e.g. `x-uipath-external-user-id` for
11122
+ * CAS external-app auth)
11114
11123
  *
11115
11124
  * @example
11116
11125
  * ```typescript
@@ -11130,11 +11139,11 @@
11130
11139
  * const entities = new Entities(sdk);
11131
11140
  * ```
11132
11141
  */
11133
- constructor(instance) {
11142
+ constructor(instance, headers) {
11134
11143
  // Private field - not visible via Object.keys() or any reflection
11135
11144
  _BaseService_apiClient.set(this, void 0);
11136
11145
  const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
11137
- __classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager), "f");
11146
+ __classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
11138
11147
  }
11139
11148
  /**
11140
11149
  * Gets a valid authentication token, refreshing if necessary.
@@ -11393,27 +11402,41 @@
11393
11402
  throw new Error('Entity ID is undefined');
11394
11403
  return service.deleteAttachment(entityData.id, recordId, fieldName);
11395
11404
  },
11405
+ async queryRecords(options) {
11406
+ if (!entityData.id)
11407
+ throw new Error('Entity ID is undefined');
11408
+ return service.queryRecordsById(entityData.id, options);
11409
+ },
11410
+ async importRecords(file) {
11411
+ if (!entityData.id)
11412
+ throw new Error('Entity ID is undefined');
11413
+ return service.importRecordsById(entityData.id, file);
11414
+ },
11396
11415
  async insert(data, options) {
11397
11416
  return this.insertRecord(data, options);
11398
11417
  },
11399
11418
  async batchInsert(data, options) {
11400
11419
  return this.insertRecords(data, options);
11401
11420
  },
11402
- async update(data, options) {
11403
- return this.updateRecords(data, options);
11404
- },
11405
- async delete(recordIds, options) {
11406
- return this.deleteRecords(recordIds, options);
11407
- },
11408
11421
  async getRecords(options) {
11409
11422
  return this.getAllRecords(options);
11410
- }
11423
+ },
11424
+ async delete() {
11425
+ if (!entityData.id)
11426
+ throw new Error('Entity ID is undefined');
11427
+ return service.deleteById(entityData.id);
11428
+ },
11429
+ async update(options) {
11430
+ if (!entityData.id)
11431
+ throw new Error('Entity ID is undefined');
11432
+ return service.updateById(entityData.id, options);
11433
+ },
11411
11434
  };
11412
11435
  }
11413
11436
  /**
11414
- * Creates an actionable entity metadata by combining entity with operational methods
11437
+ * Creates an actionable entity by combining entity metadata with data and management methods
11415
11438
  *
11416
- * @param entityData - Entity metadata
11439
+ * @param entityMetadata - Entity metadata
11417
11440
  * @param service - The entity service instance
11418
11441
  * @returns Entity metadata with added methods
11419
11442
  */
@@ -11423,42 +11446,7 @@
11423
11446
  }
11424
11447
 
11425
11448
  /**
11426
- * Creates query parameters object from key-value pairs, filtering out undefined values
11427
- * @param paramsObj - Object containing parameter key-value pairs
11428
- * @returns Parameters object with undefined values filtered out
11429
- *
11430
- * @example
11431
- * ```typescript
11432
- * // Entity service parameters
11433
- * const params = createParams({
11434
- * start: 0,
11435
- * limit: 10,
11436
- * expansionLevel: 1
11437
- * });
11438
- *
11439
- * // With optional/undefined values (automatically filtered)
11440
- * const params = createParams({
11441
- * start: options.start, // Could be undefined
11442
- * limit: options.limit, // Could be undefined
11443
- * expansionLevel: options.expansionLevel // Could be undefined
11444
- * });
11445
- *
11446
- * // Empty params
11447
- * const params = createParams();
11448
- * ```
11449
- */
11450
- function createParams(paramsObj = {}) {
11451
- const params = {};
11452
- for (const [key, value] of Object.entries(paramsObj)) {
11453
- if (value !== undefined && value !== null) {
11454
- params[key] = value;
11455
- }
11456
- }
11457
- return params;
11458
- }
11459
-
11460
- /**
11461
- * Entity field type names
11449
+ * Entity field data type names (SQL-level types returned by the API)
11462
11450
  */
11463
11451
  exports.EntityFieldDataType = void 0;
11464
11452
  (function (EntityFieldDataType) {
@@ -11474,7 +11462,41 @@
11474
11462
  EntityFieldDataType["BOOLEAN"] = "BOOLEAN";
11475
11463
  EntityFieldDataType["BIG_INTEGER"] = "BIG_INTEGER";
11476
11464
  EntityFieldDataType["MULTILINE_TEXT"] = "MULTILINE_TEXT";
11465
+ EntityFieldDataType["FILE"] = "FILE";
11466
+ EntityFieldDataType["CHOICE_SET_SINGLE"] = "CHOICE_SET_SINGLE";
11467
+ EntityFieldDataType["CHOICE_SET_MULTIPLE"] = "CHOICE_SET_MULTIPLE";
11468
+ EntityFieldDataType["AUTO_NUMBER"] = "AUTO_NUMBER";
11469
+ EntityFieldDataType["RELATIONSHIP"] = "RELATIONSHIP";
11477
11470
  })(exports.EntityFieldDataType || (exports.EntityFieldDataType = {}));
11471
+ /**
11472
+ * Logical operator for combining query filter groups
11473
+ */
11474
+ exports.LogicalOperator = void 0;
11475
+ (function (LogicalOperator) {
11476
+ /** Combine conditions with AND — all conditions must match */
11477
+ LogicalOperator[LogicalOperator["And"] = 0] = "And";
11478
+ /** Combine conditions with OR — any condition must match */
11479
+ LogicalOperator[LogicalOperator["Or"] = 1] = "Or";
11480
+ })(exports.LogicalOperator || (exports.LogicalOperator = {}));
11481
+ /**
11482
+ * Comparison operators for entity query filters.
11483
+ * Not all operators are valid for all field types.
11484
+ */
11485
+ exports.QueryFilterOperator = void 0;
11486
+ (function (QueryFilterOperator) {
11487
+ QueryFilterOperator["Equals"] = "=";
11488
+ QueryFilterOperator["NotEquals"] = "!=";
11489
+ QueryFilterOperator["GreaterThan"] = ">";
11490
+ QueryFilterOperator["LessThan"] = "<";
11491
+ QueryFilterOperator["GreaterThanOrEqual"] = ">=";
11492
+ QueryFilterOperator["LessThanOrEqual"] = "<=";
11493
+ QueryFilterOperator["Contains"] = "contains";
11494
+ QueryFilterOperator["NotContains"] = "not contains";
11495
+ QueryFilterOperator["StartsWith"] = "startswith";
11496
+ QueryFilterOperator["EndsWith"] = "endswith";
11497
+ QueryFilterOperator["In"] = "in";
11498
+ QueryFilterOperator["NotIn"] = "not in";
11499
+ })(exports.QueryFilterOperator || (exports.QueryFilterOperator = {}));
11478
11500
  /**
11479
11501
  * Entity type enum
11480
11502
  */
@@ -11520,6 +11542,41 @@
11520
11542
  JoinType["LeftJoin"] = "LeftJoin";
11521
11543
  })(exports.JoinType || (exports.JoinType = {}));
11522
11544
 
11545
+ /**
11546
+ * Creates query parameters object from key-value pairs, filtering out undefined values
11547
+ * @param paramsObj - Object containing parameter key-value pairs
11548
+ * @returns Parameters object with undefined values filtered out
11549
+ *
11550
+ * @example
11551
+ * ```typescript
11552
+ * // Entity service parameters
11553
+ * const params = createParams({
11554
+ * start: 0,
11555
+ * limit: 10,
11556
+ * expansionLevel: 1
11557
+ * });
11558
+ *
11559
+ * // With optional/undefined values (automatically filtered)
11560
+ * const params = createParams({
11561
+ * start: options.start, // Could be undefined
11562
+ * limit: options.limit, // Could be undefined
11563
+ * expansionLevel: options.expansionLevel // Could be undefined
11564
+ * });
11565
+ *
11566
+ * // Empty params
11567
+ * const params = createParams();
11568
+ * ```
11569
+ */
11570
+ function createParams(paramsObj = {}) {
11571
+ const params = {};
11572
+ for (const [key, value] of Object.entries(paramsObj)) {
11573
+ if (value !== undefined && value !== null) {
11574
+ params[key] = value;
11575
+ }
11576
+ }
11577
+ return params;
11578
+ }
11579
+
11523
11580
  /**
11524
11581
  * Entity field data types (SQL types from API)
11525
11582
  */
@@ -11538,6 +11595,7 @@
11538
11595
  SqlFieldType["DECIMAL"] = "DECIMAL";
11539
11596
  SqlFieldType["MULTILINE"] = "MULTILINE";
11540
11597
  })(SqlFieldType || (SqlFieldType = {}));
11598
+
11541
11599
  /**
11542
11600
  * Maps fields for Entities
11543
11601
  */
@@ -11547,6 +11605,40 @@
11547
11605
  sqlType: 'fieldDataType',
11548
11606
  fieldDefinition: 'fieldMetaData'
11549
11607
  };
11608
+ /**
11609
+ * Maps EntityFieldDataType values to the API field payload components for create/update operations
11610
+ */
11611
+ const EntitySchemaFieldTypeMap = {
11612
+ [exports.EntityFieldDataType.UUID]: { sqlTypeName: SqlFieldType.UNIQUEIDENTIFIER, fieldDisplayType: exports.FieldDisplayType.Basic },
11613
+ [exports.EntityFieldDataType.STRING]: { sqlTypeName: SqlFieldType.NVARCHAR, fieldDisplayType: exports.FieldDisplayType.Basic },
11614
+ [exports.EntityFieldDataType.INTEGER]: { sqlTypeName: SqlFieldType.INT, fieldDisplayType: exports.FieldDisplayType.Basic },
11615
+ [exports.EntityFieldDataType.DATETIME]: { sqlTypeName: SqlFieldType.DATETIME2, fieldDisplayType: exports.FieldDisplayType.Basic },
11616
+ [exports.EntityFieldDataType.DATETIME_WITH_TZ]: { sqlTypeName: SqlFieldType.DATETIMEOFFSET, fieldDisplayType: exports.FieldDisplayType.Basic },
11617
+ [exports.EntityFieldDataType.DECIMAL]: { sqlTypeName: SqlFieldType.DECIMAL, fieldDisplayType: exports.FieldDisplayType.Basic },
11618
+ [exports.EntityFieldDataType.FLOAT]: { sqlTypeName: SqlFieldType.FLOAT, fieldDisplayType: exports.FieldDisplayType.Basic },
11619
+ [exports.EntityFieldDataType.DOUBLE]: { sqlTypeName: SqlFieldType.REAL, fieldDisplayType: exports.FieldDisplayType.Basic },
11620
+ [exports.EntityFieldDataType.DATE]: { sqlTypeName: SqlFieldType.DATE, fieldDisplayType: exports.FieldDisplayType.Basic },
11621
+ [exports.EntityFieldDataType.BOOLEAN]: { sqlTypeName: SqlFieldType.BIT, fieldDisplayType: exports.FieldDisplayType.Basic },
11622
+ [exports.EntityFieldDataType.BIG_INTEGER]: { sqlTypeName: SqlFieldType.BIGINT, fieldDisplayType: exports.FieldDisplayType.Basic },
11623
+ [exports.EntityFieldDataType.MULTILINE_TEXT]: { sqlTypeName: SqlFieldType.MULTILINE, fieldDisplayType: exports.FieldDisplayType.Basic },
11624
+ [exports.EntityFieldDataType.FILE]: { sqlTypeName: SqlFieldType.UNIQUEIDENTIFIER, fieldDisplayType: exports.FieldDisplayType.File },
11625
+ [exports.EntityFieldDataType.CHOICE_SET_SINGLE]: { sqlTypeName: SqlFieldType.INT, fieldDisplayType: exports.FieldDisplayType.ChoiceSetSingle },
11626
+ [exports.EntityFieldDataType.CHOICE_SET_MULTIPLE]: { sqlTypeName: SqlFieldType.NVARCHAR, fieldDisplayType: exports.FieldDisplayType.ChoiceSetMultiple },
11627
+ [exports.EntityFieldDataType.AUTO_NUMBER]: { sqlTypeName: SqlFieldType.DECIMAL, fieldDisplayType: exports.FieldDisplayType.AutoNumber },
11628
+ [exports.EntityFieldDataType.RELATIONSHIP]: { sqlTypeName: SqlFieldType.UNIQUEIDENTIFIER, fieldDisplayType: exports.FieldDisplayType.Relationship },
11629
+ };
11630
+ /**
11631
+ * Maps FieldDisplayType values to EntityFieldDataType for types that share SQL types
11632
+ * with other field types (File, ChoiceSetSingle, ChoiceSetMultiple, AutoNumber).
11633
+ * Used during read-side transformation to produce the correct EntityFieldDataType.
11634
+ */
11635
+ const FieldDisplayTypeToDataType = {
11636
+ [exports.FieldDisplayType.File]: exports.EntityFieldDataType.FILE,
11637
+ [exports.FieldDisplayType.ChoiceSetSingle]: exports.EntityFieldDataType.CHOICE_SET_SINGLE,
11638
+ [exports.FieldDisplayType.ChoiceSetMultiple]: exports.EntityFieldDataType.CHOICE_SET_MULTIPLE,
11639
+ [exports.FieldDisplayType.AutoNumber]: exports.EntityFieldDataType.AUTO_NUMBER,
11640
+ [exports.FieldDisplayType.Relationship]: exports.EntityFieldDataType.RELATIONSHIP,
11641
+ };
11550
11642
  /**
11551
11643
  * Maps SQL field types to friendly display names
11552
11644
  */
@@ -11562,7 +11654,7 @@
11562
11654
  [SqlFieldType.DATE]: exports.EntityFieldDataType.DATE,
11563
11655
  [SqlFieldType.BIT]: exports.EntityFieldDataType.BOOLEAN,
11564
11656
  [SqlFieldType.DECIMAL]: exports.EntityFieldDataType.DECIMAL,
11565
- [SqlFieldType.MULTILINE]: exports.EntityFieldDataType.MULTILINE_TEXT
11657
+ [SqlFieldType.MULTILINE]: exports.EntityFieldDataType.MULTILINE_TEXT,
11566
11658
  };
11567
11659
 
11568
11660
  /**
@@ -11680,11 +11772,7 @@
11680
11772
  expansionLevel: options.expansionLevel
11681
11773
  });
11682
11774
  const response = await this.get(DATA_FABRIC_ENDPOINTS.ENTITY.GET_RECORD_BY_ID(entityId, recordId), { params });
11683
- // Convert PascalCase response to camelCase
11684
- const camelResponse = pascalToCamelCaseKeys(response.data);
11685
- // Apply EntityMap transformations
11686
- const transformedResponse = transformData(camelResponse, EntityMap);
11687
- return transformedResponse;
11775
+ return response.data;
11688
11776
  }
11689
11777
  /**
11690
11778
  * Inserts a single record into an entity by entity ID
@@ -11717,9 +11805,7 @@
11717
11805
  params,
11718
11806
  ...options
11719
11807
  });
11720
- // Convert PascalCase response to camelCase
11721
- const camelResponse = pascalToCamelCaseKeys(response.data);
11722
- return camelResponse;
11808
+ return response.data;
11723
11809
  }
11724
11810
  /**
11725
11811
  * Inserts data into an entity by entity ID using batch insert
@@ -11760,9 +11846,7 @@
11760
11846
  params,
11761
11847
  ...options
11762
11848
  });
11763
- // Convert PascalCase response to camelCase
11764
- const camelResponse = pascalToCamelCaseKeys(response.data);
11765
- return camelResponse;
11849
+ return response.data;
11766
11850
  }
11767
11851
  /**
11768
11852
  * Updates a single record in an entity by entity ID
@@ -11796,9 +11880,7 @@
11796
11880
  params,
11797
11881
  ...options
11798
11882
  });
11799
- // Convert PascalCase response to camelCase
11800
- const camelResponse = pascalToCamelCaseKeys(response.data);
11801
- return camelResponse;
11883
+ return response.data;
11802
11884
  }
11803
11885
  /**
11804
11886
  * Updates data in an entity by entity ID
@@ -11840,9 +11922,7 @@
11840
11922
  params,
11841
11923
  ...options
11842
11924
  });
11843
- // Convert PascalCase response to camelCase
11844
- const camelResponse = pascalToCamelCaseKeys(response.data);
11845
- return camelResponse;
11925
+ return response.data;
11846
11926
  }
11847
11927
  /**
11848
11928
  * Deletes data from an entity by entity ID
@@ -11872,9 +11952,7 @@
11872
11952
  params,
11873
11953
  ...options
11874
11954
  });
11875
- // Convert PascalCase response to camelCase
11876
- const camelResponse = pascalToCamelCaseKeys(response.data);
11877
- return camelResponse;
11955
+ return response.data;
11878
11956
  }
11879
11957
  /**
11880
11958
  * Gets all entities in the system
@@ -11906,6 +11984,99 @@
11906
11984
  });
11907
11985
  return entities;
11908
11986
  }
11987
+ /**
11988
+ * Queries entity records with filters, sorting, and pagination
11989
+ *
11990
+ * @param id - UUID of the entity
11991
+ * @param options - Query options including filterGroup, selectedFields, sortOptions, and pagination
11992
+ * @returns Promise resolving to {@link NonPaginatedResponse} without pagination options,
11993
+ * or {@link PaginatedResponse} when `pageSize`, `cursor`, or `jumpToPage` are provided
11994
+ *
11995
+ * @example
11996
+ * ```typescript
11997
+ * import { Entities, LogicalOperator, QueryFilterOperator } from '@uipath/uipath-typescript/entities';
11998
+ *
11999
+ * const entities = new Entities(sdk);
12000
+ *
12001
+ * // Non-paginated query with a filter
12002
+ * const result = await entities.queryRecordsById("<entityId>", {
12003
+ * filterGroup: {
12004
+ * logicalOperator: LogicalOperator.And,
12005
+ * queryFilters: [
12006
+ * { fieldName: "status", operator: QueryFilterOperator.Equals, value: "active" }
12007
+ * ]
12008
+ * },
12009
+ * sortOptions: [{ fieldName: "created_at", isDescending: true }],
12010
+ * });
12011
+ * console.log(`Found ${result.totalCount} records`);
12012
+ *
12013
+ * // With pagination
12014
+ * const page1 = await entities.queryRecordsById("<entityId>", {
12015
+ * filterGroup: { queryFilters: [{ fieldName: "status", operator: QueryFilterOperator.Equals, value: "active" }] },
12016
+ * pageSize: 25,
12017
+ * });
12018
+ * if (page1.hasNextPage) {
12019
+ * const page2 = await entities.queryRecordsById("<entityId>", { cursor: page1.nextCursor });
12020
+ * }
12021
+ * ```
12022
+ */
12023
+ async queryRecordsById(id, options) {
12024
+ return PaginationHelpers.getAll({
12025
+ serviceAccess: this.createPaginationServiceAccess(),
12026
+ getEndpoint: () => DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_ID(id),
12027
+ method: HTTP_METHODS.POST,
12028
+ pagination: {
12029
+ paginationType: PaginationType.OFFSET,
12030
+ itemsField: ENTITY_PAGINATION.ITEMS_FIELD,
12031
+ totalCountField: ENTITY_PAGINATION.TOTAL_COUNT_FIELD,
12032
+ paginationParams: {
12033
+ pageSizeParam: ENTITY_OFFSET_PARAMS.PAGE_SIZE_PARAM,
12034
+ offsetParam: ENTITY_OFFSET_PARAMS.OFFSET_PARAM,
12035
+ countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
12036
+ }
12037
+ },
12038
+ excludeFromPrefix: ['expansionLevel', 'filterGroup', 'selectedFields', 'sortOptions']
12039
+ }, options);
12040
+ }
12041
+ /**
12042
+ * Imports records from a CSV file into an entity
12043
+ *
12044
+ * @param id - UUID of the entity
12045
+ * @param file - CSV file to import (Blob, File, or Uint8Array)
12046
+ * @returns Promise resolving to import result with record counts
12047
+ *
12048
+ * @example
12049
+ * ```typescript
12050
+ * import { Entities } from '@uipath/uipath-typescript/entities';
12051
+ *
12052
+ * const entities = new Entities(sdk);
12053
+ *
12054
+ * // Browser: upload from file input
12055
+ * const fileInput = document.getElementById('csv-input') as HTMLInputElement;
12056
+ * const result = await entities.importRecordsById("<entityId>", fileInput.files[0]);
12057
+ *
12058
+ * // Node.js: read from disk
12059
+ * const fileBuffer = fs.readFileSync('records.csv');
12060
+ * const result = await entities.importRecordsById("<entityId>", new Blob([fileBuffer], { type: 'text/csv' }));
12061
+ *
12062
+ * console.log(`Inserted ${result.insertedRecords} of ${result.totalRecords} records`);
12063
+ * if (result.errorFileLink) {
12064
+ * console.log(`Error file link: ${result.errorFileLink}`);
12065
+ * }
12066
+ * ```
12067
+ * @internal
12068
+ */
12069
+ async importRecordsById(id, file) {
12070
+ const formData = new FormData();
12071
+ if (file instanceof Uint8Array) {
12072
+ formData.append('file', new Blob([file.buffer]));
12073
+ }
12074
+ else {
12075
+ formData.append('file', file);
12076
+ }
12077
+ const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.BULK_UPLOAD_BY_ID(id), formData);
12078
+ return response.data;
12079
+ }
11909
12080
  /**
11910
12081
  * Downloads an attachment from an entity record field
11911
12082
  *
@@ -11926,7 +12097,7 @@
11926
12097
  *
11927
12098
  * // Get the recordId from getAllRecords()
11928
12099
  * const records = await entities.getAllRecords(entityId);
11929
- * const recordId = records[0].id;
12100
+ * const recordId = records[0].Id;
11930
12101
  *
11931
12102
  * // Download attachment for a specific record and field
11932
12103
  * const blob = await entities.downloadAttachment(entityId, recordId, 'Documents');
@@ -11960,7 +12131,7 @@
11960
12131
  *
11961
12132
  * // Get the recordId from getAllRecords()
11962
12133
  * const records = await entities.getAllRecords(entityId);
11963
- * const recordId = records[0].id;
12134
+ * const recordId = records[0].Id;
11964
12135
  *
11965
12136
  * // Upload a file attachment
11966
12137
  * const response = await entities.uploadAttachment(entityId, recordId, 'Documents', file);
@@ -11976,9 +12147,7 @@
11976
12147
  }
11977
12148
  const params = createParams({ expansionLevel: options?.expansionLevel });
11978
12149
  const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPLOAD_ATTACHMENT(entityId, recordId, fieldName), formData, { params });
11979
- // Convert PascalCase response to camelCase
11980
- const camelResponse = pascalToCamelCaseKeys(response.data);
11981
- return camelResponse;
12150
+ return response.data;
11982
12151
  }
11983
12152
  /**
11984
12153
  * Removes an attachment from a File-type field of an entity record
@@ -12000,7 +12169,7 @@
12000
12169
  *
12001
12170
  * // Get the recordId from getAllRecords()
12002
12171
  * const records = await entities.getAllRecords(entityId);
12003
- * const recordId = records[0].id;
12172
+ * const recordId = records[0].Id;
12004
12173
  *
12005
12174
  * // Delete attachment for a specific record and field
12006
12175
  * await entities.deleteAttachment(entityId, recordId, 'Documents');
@@ -12032,18 +12201,169 @@
12032
12201
  return this.insertRecordsById(id, data, options);
12033
12202
  }
12034
12203
  /**
12035
- * @hidden
12036
- * @deprecated Use {@link updateRecordsById} instead.
12204
+ * Creates a new Data Fabric entity with the given schema
12205
+ *
12206
+ * @param name - Entity name — must start with a letter and contain
12207
+ * only letters, numbers, and underscores (e.g., `"productCatalog"`).
12208
+ * @param fields - Array of field definitions
12209
+ * @param options - Optional entity-level settings ({@link EntityCreateOptions})
12210
+ * @returns Promise resolving to the ID of the created entity
12211
+ *
12212
+ * @example
12213
+ * ```typescript
12214
+ * const entityId = await entities.create("product_catalog", [
12215
+ * { fieldName: "product_name", type: EntityFieldDataType.STRING, isRequired: true, isUnique: true },
12216
+ * { fieldName: "price", type: EntityFieldDataType.INTEGER, defaultValue: "0" },
12217
+ * ], { displayName: "Product Catalog", description: "Our product catalog", isRbacEnabled: true });
12218
+ * ```
12219
+ * @internal
12037
12220
  */
12038
- async updateById(id, data, options = {}) {
12039
- return this.updateRecordsById(id, data, options);
12221
+ async create(name, fields, options) {
12222
+ this.validateName(name, 'entity');
12223
+ for (const field of fields) {
12224
+ this.validateName(field.fieldName, 'field');
12225
+ }
12226
+ const opts = options ?? {};
12227
+ const payload = {
12228
+ ...(opts.description !== undefined && { description: opts.description }),
12229
+ displayName: opts.displayName ?? name,
12230
+ entityDefinition: {
12231
+ name,
12232
+ fields: fields.map(f => this.buildSchemaFieldPayload(f)),
12233
+ folderId: opts.folderKey ?? DATA_FABRIC_TENANT_FOLDER_ID,
12234
+ isRbacEnabled: opts.isRbacEnabled ?? false,
12235
+ isInsightsEnabled: opts.isAnalyticsEnabled ?? false,
12236
+ externalFields: opts.externalFields ?? [],
12237
+ },
12238
+ };
12239
+ const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPSERT, payload);
12240
+ return response.data;
12040
12241
  }
12041
12242
  /**
12042
- * @hidden
12043
- * @deprecated Use {@link deleteRecordsById} instead.
12243
+ * Deletes a Data Fabric entity and all its records
12244
+ *
12245
+ * @param id - UUID of the entity to delete
12246
+ * @returns Promise resolving when the entity is deleted
12247
+ *
12248
+ * @example
12249
+ * ```typescript
12250
+ * await entities.deleteById("<entityId>");
12251
+ * ```
12252
+ * @internal
12044
12253
  */
12045
- async deleteById(id, recordIds, options = {}) {
12046
- return this.deleteRecordsById(id, recordIds, options);
12254
+ async deleteById(id) {
12255
+ await this.delete(DATA_FABRIC_ENDPOINTS.ENTITY.DELETE(id));
12256
+ }
12257
+ /**
12258
+ * Updates an existing Data Fabric entity — schema and/or metadata.
12259
+ *
12260
+ * Provide any combination of schema fields (`addFields`, `removeFields`, `updateFields`) and
12261
+ * metadata fields (`displayName`, `description`, `isRbacEnabled`). Each group is applied
12262
+ * only when the corresponding fields are present.
12263
+ *
12264
+ * **Warning:** Schema changes (`addFields`, `removeFields`, `updateFields`) use a
12265
+ * read-modify-write pattern — concurrent calls on the same entity may silently
12266
+ * overwrite each other's changes.
12267
+ *
12268
+ * @param id - UUID of the entity to update
12269
+ * @param options - Changes to apply ({@link EntityUpdateByIdOptions})
12270
+ * @returns Promise resolving when the update is complete
12271
+ *
12272
+ * @example
12273
+ * ```typescript
12274
+ * // Schema-only
12275
+ * await entities.updateById("<entityId>", {
12276
+ * addFields: [{ fieldName: "notes", type: EntityFieldDataType.MULTILINE_TEXT }],
12277
+ * removeFields: [{ fieldName: "old_field" }],
12278
+ * });
12279
+ *
12280
+ * // Metadata-only
12281
+ * await entities.updateById("<entityId>", {
12282
+ * displayName: "My Updated Entity",
12283
+ * description: "Updated description",
12284
+ * });
12285
+ *
12286
+ * // Combined
12287
+ * await entities.updateById("<entityId>", {
12288
+ * updateFields: [{ id: "<fieldId>", displayName: "Unit Price", isRequired: true }],
12289
+ * displayName: "Price Catalog",
12290
+ * });
12291
+ * ```
12292
+ * @internal
12293
+ */
12294
+ async updateById(id, options) {
12295
+ const opts = options ?? {};
12296
+ const hasSchemaChanges = !!(opts.addFields?.length || opts.removeFields?.length || opts.updateFields?.length);
12297
+ const hasMetadataChanges = opts.displayName !== undefined || opts.description !== undefined || opts.isRbacEnabled !== undefined;
12298
+ if (hasSchemaChanges) {
12299
+ await this.applySchemaUpdate(id, opts);
12300
+ }
12301
+ if (hasMetadataChanges) {
12302
+ await this.patch(DATA_FABRIC_ENDPOINTS.ENTITY.UPDATE_METADATA(id), {
12303
+ ...(opts.displayName !== undefined && { displayName: opts.displayName }),
12304
+ ...(opts.description !== undefined && { description: opts.description }),
12305
+ ...(opts.isRbacEnabled !== undefined && { isRbacEnabled: opts.isRbacEnabled }),
12306
+ });
12307
+ }
12308
+ }
12309
+ /**
12310
+ * Fetches the current entity schema, applies the field delta, then posts the full updated schema.
12311
+ *
12312
+ * @param entityId - UUID of the entity to update
12313
+ * @param options - Field changes to apply
12314
+ * @private
12315
+ */
12316
+ async applySchemaUpdate(entityId, options) {
12317
+ const entityResponse = await this.get(DATA_FABRIC_ENDPOINTS.ENTITY.GET_BY_ID(entityId));
12318
+ const raw = entityResponse.data;
12319
+ // Carry forward existing non-system fields from GET response (skip system/primary-key fields)
12320
+ let fields = (raw.fields ?? [])
12321
+ .filter(f => !f.isSystemField && !f.isPrimaryKey);
12322
+ // Filter out removed fields
12323
+ if (options.removeFields?.length) {
12324
+ const removeSet = new Set(options.removeFields.map(r => r.fieldName));
12325
+ fields = fields.filter(f => !removeSet.has(f.name));
12326
+ }
12327
+ // Apply per-field metadata updates (matched by field ID)
12328
+ if (options.updateFields?.length) {
12329
+ const updateMap = new Map(options.updateFields.map(u => [u.id, u]));
12330
+ fields = fields.map(f => {
12331
+ const update = updateMap.get(f.id ?? '');
12332
+ if (!update)
12333
+ return f;
12334
+ return {
12335
+ ...f,
12336
+ ...(update.displayName !== undefined && { displayName: update.displayName }),
12337
+ ...(update.description !== undefined && { description: update.description }),
12338
+ ...(update.isRequired !== undefined && { isRequired: update.isRequired }),
12339
+ ...(update.isUnique !== undefined && { isUnique: update.isUnique }),
12340
+ ...(update.isRbacEnabled !== undefined && { isRbacEnabled: update.isRbacEnabled }),
12341
+ ...(update.isEncrypted !== undefined && { isEncrypted: update.isEncrypted }),
12342
+ ...(update.defaultValue !== undefined && { defaultValue: update.defaultValue }),
12343
+ };
12344
+ });
12345
+ }
12346
+ // Build and append new fields
12347
+ const newFields = [];
12348
+ if (options.addFields?.length) {
12349
+ for (const field of options.addFields) {
12350
+ this.validateName(field.fieldName, 'field');
12351
+ }
12352
+ newFields.push(...options.addFields.map(f => this.buildSchemaFieldPayload(f)));
12353
+ }
12354
+ await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPSERT, {
12355
+ displayName: raw.displayName,
12356
+ description: raw.description,
12357
+ entityDefinition: {
12358
+ id: entityId,
12359
+ name: raw.name,
12360
+ fields: [...fields, ...newFields],
12361
+ folderId: raw.folderId ?? DATA_FABRIC_TENANT_FOLDER_ID,
12362
+ isRbacEnabled: raw.isRbacEnabled ?? false,
12363
+ isInsightsEnabled: raw.isInsightsEnabled ?? false,
12364
+ externalFields: raw.externalFields ?? [],
12365
+ },
12366
+ });
12047
12367
  }
12048
12368
  /**
12049
12369
  * Orchestrates all field mapping transformations
@@ -12067,11 +12387,20 @@
12067
12387
  metadata.fields = metadata.fields.map(field => {
12068
12388
  // Rename sqlType to fieldDataType
12069
12389
  let transformedField = transformData(field, EntityMap);
12070
- // Map SQL field type to friendly name
12390
+ // Map field type: prefer fieldDisplayType for types that share SQL types (File, ChoiceSet, AutoNumber)
12071
12391
  if (transformedField.fieldDataType?.name) {
12072
- const sqlTypeName = transformedField.fieldDataType.name;
12073
- if (EntityFieldTypeMap[sqlTypeName]) {
12074
- transformedField.fieldDataType.name = EntityFieldTypeMap[sqlTypeName];
12392
+ const displayTypeMapped = transformedField.fieldDisplayType
12393
+ ? FieldDisplayTypeToDataType[transformedField.fieldDisplayType]
12394
+ : undefined;
12395
+ if (displayTypeMapped) {
12396
+ transformedField.fieldDataType.name = displayTypeMapped;
12397
+ }
12398
+ else {
12399
+ const rawSqlTypeName = field.sqlType?.name;
12400
+ const mapped = rawSqlTypeName ? EntityFieldTypeMap[rawSqlTypeName] : undefined;
12401
+ if (mapped) {
12402
+ transformedField.fieldDataType.name = mapped;
12403
+ }
12075
12404
  }
12076
12405
  }
12077
12406
  this.transformNestedReferences(transformedField);
@@ -12115,7 +12444,44 @@
12115
12444
  return externalSource;
12116
12445
  });
12117
12446
  }
12447
+ /** Converts a user-facing EntityCreateFieldOptions to the raw API field payload */
12448
+ buildSchemaFieldPayload(field) {
12449
+ this.validateName(field.fieldName, 'field');
12450
+ const mapping = EntitySchemaFieldTypeMap[field.type ?? exports.EntityFieldDataType.STRING];
12451
+ return {
12452
+ name: field.fieldName,
12453
+ displayName: field.displayName ?? field.fieldName,
12454
+ sqlType: { name: mapping.sqlTypeName },
12455
+ fieldDisplayType: mapping.fieldDisplayType,
12456
+ description: field.description ?? '',
12457
+ isRequired: field.isRequired ?? false,
12458
+ isUnique: field.isUnique ?? false,
12459
+ isRbacEnabled: field.isRbacEnabled ?? false,
12460
+ isEncrypted: field.isEncrypted ?? false,
12461
+ ...(field.defaultValue !== undefined && { defaultValue: field.defaultValue }),
12462
+ ...(field.choiceSetId !== undefined && { choiceSetId: field.choiceSetId }),
12463
+ ...(field.referenceEntityName !== undefined && { referenceEntityName: field.referenceEntityName }),
12464
+ ...(field.referenceFieldName !== undefined && { referenceFieldName: field.referenceFieldName }),
12465
+ };
12466
+ }
12467
+ validateName(name, context) {
12468
+ if (name.length < 3 || name.length > 100 || !/^[a-zA-Z]\w*$/.test(name)) {
12469
+ const suggestion = name.replace(/\W/g, '').replace(/^[0-9_]+/, '');
12470
+ const defaultName = `My${context.charAt(0).toUpperCase() + context.slice(1)}`;
12471
+ throw new ValidationError({
12472
+ message: `Invalid ${context} name '${name}'. Must start with a letter, contain only letters, numbers, and underscores, 3–100 characters (e.g., "${suggestion || defaultName}").`
12473
+ });
12474
+ }
12475
+ if (context === 'field' && EntityService.RESERVED_FIELD_NAMES.has(name)) {
12476
+ throw new ValidationError({
12477
+ message: `Field name '${name}' is reserved. Reserved names: ${[...EntityService.RESERVED_FIELD_NAMES].join(', ')}.`
12478
+ });
12479
+ }
12480
+ }
12118
12481
  }
12482
+ EntityService.RESERVED_FIELD_NAMES = new Set([
12483
+ 'Id', 'CreatedBy', 'CreateTime', 'UpdatedBy', 'UpdateTime'
12484
+ ]);
12119
12485
  __decorate([
12120
12486
  track('Entities.GetById')
12121
12487
  ], EntityService.prototype, "getById", null);
@@ -12143,6 +12509,12 @@
12143
12509
  __decorate([
12144
12510
  track('Entities.GetAll')
12145
12511
  ], EntityService.prototype, "getAll", null);
12512
+ __decorate([
12513
+ track('Entities.QueryRecordsById')
12514
+ ], EntityService.prototype, "queryRecordsById", null);
12515
+ __decorate([
12516
+ track('Entities.ImportRecordsById')
12517
+ ], EntityService.prototype, "importRecordsById", null);
12146
12518
  __decorate([
12147
12519
  track('Entities.DownloadAttachment')
12148
12520
  ], EntityService.prototype, "downloadAttachment", null);
@@ -12152,6 +12524,15 @@
12152
12524
  __decorate([
12153
12525
  track('Entities.DeleteAttachment')
12154
12526
  ], EntityService.prototype, "deleteAttachment", null);
12527
+ __decorate([
12528
+ track('Entities.Create')
12529
+ ], EntityService.prototype, "create", null);
12530
+ __decorate([
12531
+ track('Entities.DeleteById')
12532
+ ], EntityService.prototype, "deleteById", null);
12533
+ __decorate([
12534
+ track('Entities.UpdateById')
12535
+ ], EntityService.prototype, "updateById", null);
12155
12536
 
12156
12537
  class ChoiceSetService extends BaseService {
12157
12538
  /**
@@ -14719,6 +15100,36 @@
14719
15100
  BucketOptions["AccessDataThroughOrchestrator"] = "AccessDataThroughOrchestrator";
14720
15101
  })(exports.BucketOptions || (exports.BucketOptions = {}));
14721
15102
 
15103
+ /**
15104
+ * Creates methods for a job response object.
15105
+ *
15106
+ * @param jobData - The raw job data from API
15107
+ * @param service - The job service instance
15108
+ * @returns Object containing job methods
15109
+ */
15110
+ function createJobMethods(jobData, service) {
15111
+ return {
15112
+ async getOutput() {
15113
+ if (!jobData.key)
15114
+ throw new Error('Job key is undefined');
15115
+ if (!jobData.folderId)
15116
+ throw new Error('Job folderId is undefined');
15117
+ return service.getOutput(jobData.key, jobData.folderId);
15118
+ },
15119
+ };
15120
+ }
15121
+ /**
15122
+ * Creates a job response with bound methods.
15123
+ *
15124
+ * @param jobData - The raw job data from API
15125
+ * @param service - The job service instance
15126
+ * @returns A job object with added methods
15127
+ */
15128
+ function createJobWithMethods(jobData, service) {
15129
+ const methods = createJobMethods(jobData, service);
15130
+ return Object.assign({}, jobData, methods);
15131
+ }
15132
+
14722
15133
  /**
14723
15134
  * Maps fields for Job entities to ensure consistent naming
14724
15135
  * Semantic renames only — case conversion handled by pascalToCamelCaseKeys()
@@ -14734,27 +15145,81 @@
14734
15145
  release: 'process',
14735
15146
  };
14736
15147
 
15148
+ /**
15149
+ * Maps fields for Attachment entities to ensure consistent naming
15150
+ */
15151
+ const AttachmentsMap = {
15152
+ creationTime: 'createdTime',
15153
+ lastModificationTime: 'lastModifiedTime'
15154
+ };
15155
+
15156
+ class AttachmentService extends BaseService {
15157
+ /**
15158
+ * Gets an attachment by ID
15159
+ * @param id - The UUID of the attachment to retrieve
15160
+ * @param options - Optional query parameters (expand, select)
15161
+ * @returns Promise resolving to the attachment
15162
+ *
15163
+ * @example
15164
+ * ```typescript
15165
+ * import { Attachments } from '@uipath/uipath-typescript/attachments';
15166
+ *
15167
+ * const attachments = new Attachments(sdk);
15168
+ * const attachment = await attachments.getById('12345678-1234-1234-1234-123456789abc');
15169
+ * ```
15170
+ */
15171
+ async getById(id, options = {}) {
15172
+ if (!id) {
15173
+ throw new ValidationError({ message: 'id is required for getById' });
15174
+ }
15175
+ // Prefix all keys in options with $ for OData
15176
+ const keysToPrefix = Object.keys(options);
15177
+ const apiOptions = addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix);
15178
+ const response = await this.get(ORCHESTRATOR_ATTACHMENT_ENDPOINTS.GET_BY_ID(id), {
15179
+ params: apiOptions,
15180
+ });
15181
+ // Transform response from PascalCase to camelCase, then apply field maps
15182
+ const camelCased = pascalToCamelCaseKeys(response.data);
15183
+ camelCased.blobFileAccess = transformData(camelCased.blobFileAccess, BucketMap);
15184
+ return transformData(camelCased, AttachmentsMap);
15185
+ }
15186
+ }
15187
+ __decorate([
15188
+ track('Attachments.GetById')
15189
+ ], AttachmentService.prototype, "getById", null);
15190
+
14737
15191
  /**
14738
15192
  * Service for interacting with UiPath Orchestrator Jobs API
14739
15193
  */
14740
15194
  class JobService extends FolderScopedService {
14741
15195
  /**
14742
- * Gets all jobs across folders with optional filtering
15196
+ * Creates an instance of the Jobs service.
15197
+ *
15198
+ * @param instance - UiPath SDK instance providing authentication and configuration
15199
+ */
15200
+ constructor(instance) {
15201
+ super(instance);
15202
+ this.attachmentService = new AttachmentService(instance);
15203
+ }
15204
+ /**
15205
+ * Gets all jobs across folders with optional filtering and pagination.
14743
15206
  *
14744
- * @param options - Query options including optional folderId and pagination options
14745
- * @returns Promise resolving to array of jobs or paginated response
15207
+ * Returns jobs with full details including state, timing, and input/output arguments.
15208
+ * Pass `folderId` to scope the query to a specific folder.
14746
15209
  *
15210
+ * !!! info "Input and output fields are not included in `getAll` responses"
15211
+ * 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`.
15212
+ *
15213
+ * @param options - Query options including optional folderId, filtering, and pagination options
15214
+ * @returns Promise resolving to either an array of jobs {@link NonPaginatedResponse}<{@link JobGetResponse}> or a {@link PaginatedResponse}<{@link JobGetResponse}> when pagination options are used.
15215
+ * {@link JobGetResponse}
14747
15216
  * @example
14748
15217
  * ```typescript
14749
- * import { Jobs } from '@uipath/uipath-typescript/jobs';
14750
- *
14751
- * const jobs = new Jobs(sdk);
14752
- *
14753
15218
  * // Get all jobs
14754
15219
  * const allJobs = await jobs.getAll();
14755
15220
  *
14756
15221
  * // Get all jobs in a specific folder
14757
- * const folderJobs = await jobs.getAll({ folderId: 123 });
15222
+ * const folderJobs = await jobs.getAll({ folderId: <folderId> });
14758
15223
  *
14759
15224
  * // With filtering
14760
15225
  * const runningJobs = await jobs.getAll({
@@ -14768,10 +15233,19 @@
14768
15233
  * if (page1.hasNextPage) {
14769
15234
  * const page2 = await jobs.getAll({ cursor: page1.nextCursor });
14770
15235
  * }
15236
+ *
15237
+ * // Jump to specific page
15238
+ * const page5 = await jobs.getAll({
15239
+ * jumpToPage: 5,
15240
+ * pageSize: 10
15241
+ * });
14771
15242
  * ```
14772
15243
  */
14773
15244
  async getAll(options) {
14774
- const transformJobResponse = (job) => transformData(pascalToCamelCaseKeys(job), JobMap);
15245
+ const transformJobResponse = (job) => {
15246
+ const rawJob = transformData(pascalToCamelCaseKeys(job), JobMap);
15247
+ return createJobWithMethods(rawJob, this);
15248
+ };
14775
15249
  return PaginationHelpers.getAll({
14776
15250
  serviceAccess: this.createPaginationServiceAccess(),
14777
15251
  getEndpoint: () => JOB_ENDPOINTS.GET_ALL,
@@ -14789,10 +15263,144 @@
14789
15263
  },
14790
15264
  }, options);
14791
15265
  }
15266
+ /**
15267
+ * Gets a job by its unique key (GUID).
15268
+ *
15269
+ * Returns the full job details including state, timing, input/output arguments, and error information.
15270
+ * Use `expand` to include related entities like `robot`, or `machine`.
15271
+ *
15272
+ * @param id - The unique key (GUID) of the job to retrieve
15273
+ * @param folderId - The folder ID where the job resides
15274
+ * @param options - Optional query options for expanding or selecting fields
15275
+ * @returns Promise resolving to a {@link JobGetResponse} with full job details and bound methods
15276
+ *
15277
+ * @example
15278
+ * ```typescript
15279
+ * // Get a job by key
15280
+ * const job = await jobs.getById(<id>, <folderId>);
15281
+ * console.log(job.state, job.processName);
15282
+ * ```
15283
+ *
15284
+ * @example
15285
+ * ```typescript
15286
+ * // With expanded related entities
15287
+ * const job = await jobs.getById(<id>, <folderId>, {
15288
+ * expand: 'robot,machine'
15289
+ * });
15290
+ * console.log(job.robot?.name, job.machine?.name);
15291
+ * ```
15292
+ */
15293
+ async getById(id, folderId, options) {
15294
+ if (!id) {
15295
+ throw new ValidationError({ message: 'id is required for getById' });
15296
+ }
15297
+ if (!folderId) {
15298
+ throw new ValidationError({ message: 'folderId is required for getById' });
15299
+ }
15300
+ const headers = createHeaders({ [FOLDER_ID]: folderId });
15301
+ const keysToPrefix = Object.keys(options ?? {});
15302
+ const apiOptions = options ? addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix) : {};
15303
+ const response = await this.get(JOB_ENDPOINTS.GET_BY_KEY(id), {
15304
+ params: apiOptions,
15305
+ headers,
15306
+ });
15307
+ const rawJob = transformData(pascalToCamelCaseKeys(response.data), JobMap);
15308
+ return createJobWithMethods(rawJob, this);
15309
+ }
15310
+ /**
15311
+ * Gets the output of a completed job.
15312
+ *
15313
+ * Retrieves the job's output arguments, handling both inline output (stored directly on the job
15314
+ * as a JSON string in `outputArguments`) and file-based output (stored as a blob attachment for
15315
+ * large outputs). Returns the parsed JSON output or `null` if the job has no output.
15316
+ *
15317
+ * @param jobKey - The unique key (GUID) of the job to retrieve output from
15318
+ * @param folderId - The folder ID where the job resides
15319
+ * @returns Promise resolving to the parsed output as `Record<string, unknown>`, or `null` if no output exists
15320
+ *
15321
+ * @example
15322
+ * ```typescript
15323
+ * // Get output from a completed job
15324
+ * const output = await jobs.getOutput(<jobKey>, <folderId>);
15325
+ *
15326
+ * if (output) {
15327
+ * console.log('Job output:', output);
15328
+ * }
15329
+ * ```
15330
+ *
15331
+ * @example
15332
+ * ```typescript
15333
+ * // Get output using bound method (jobKey and folderId are taken from the job object)
15334
+ * const allJobs = await jobs.getAll();
15335
+ * const completedJob = allJobs.items.find(j => j.state === JobState.Successful);
15336
+ *
15337
+ * if (completedJob) {
15338
+ * const output = await completedJob.getOutput();
15339
+ * }
15340
+ * ```
15341
+ */
15342
+ async getOutput(jobKey, folderId) {
15343
+ if (!jobKey) {
15344
+ throw new ValidationError({ message: 'jobKey is required for getOutput' });
15345
+ }
15346
+ const job = await this.getById(jobKey, folderId, { select: 'outputArguments,outputFile' });
15347
+ if (job.outputArguments) {
15348
+ try {
15349
+ return JSON.parse(job.outputArguments);
15350
+ }
15351
+ catch {
15352
+ throw new ServerError({ message: 'Failed to parse job output arguments as JSON' });
15353
+ }
15354
+ }
15355
+ if (job.outputFile) {
15356
+ return this.downloadOutputFile(job.outputFile);
15357
+ }
15358
+ return null;
15359
+ }
15360
+ /**
15361
+ * Downloads the output file content via the Attachments API.
15362
+ * 1. Fetches blob access info from the attachment using AttachmentService
15363
+ * 2. Downloads content from the presigned blob URI
15364
+ * 3. Parses and returns the JSON content
15365
+ */
15366
+ async downloadOutputFile(outputFileKey) {
15367
+ const attachment = await this.attachmentService.getById(outputFileKey);
15368
+ const blobAccess = attachment.blobFileAccess;
15369
+ if (!blobAccess?.uri) {
15370
+ return null;
15371
+ }
15372
+ const blobHeaders = { ...blobAccess.headers };
15373
+ // Add auth header if the blob URI requires authenticated access
15374
+ if (blobAccess.requiresAuth) {
15375
+ const token = await this.getValidAuthToken();
15376
+ blobHeaders['Authorization'] = `Bearer ${token}`;
15377
+ }
15378
+ const blobResponse = await fetch(blobAccess.uri, {
15379
+ method: 'GET',
15380
+ headers: blobHeaders,
15381
+ });
15382
+ if (!blobResponse.ok) {
15383
+ const errorInfo = await errorResponseParser.parse(blobResponse);
15384
+ throw ErrorFactory.createFromHttpStatus(blobResponse.status, errorInfo);
15385
+ }
15386
+ const content = await blobResponse.text();
15387
+ try {
15388
+ return JSON.parse(content);
15389
+ }
15390
+ catch {
15391
+ throw new ServerError({ message: 'Failed to parse job output file as JSON' });
15392
+ }
15393
+ }
14792
15394
  }
14793
15395
  __decorate([
14794
15396
  track('Jobs.GetAll')
14795
15397
  ], JobService.prototype, "getAll", null);
15398
+ __decorate([
15399
+ track('Jobs.GetById')
15400
+ ], JobService.prototype, "getById", null);
15401
+ __decorate([
15402
+ track('Jobs.GetOutput')
15403
+ ], JobService.prototype, "getOutput", null);
14796
15404
 
14797
15405
  /**
14798
15406
  * Enum for job sub-state
@@ -14819,6 +15427,22 @@
14819
15427
  ServerlessJobType["PythonAgent"] = "PythonAgent";
14820
15428
  })(exports.ServerlessJobType || (exports.ServerlessJobType = {}));
14821
15429
 
15430
+ /**
15431
+ * Common enum for job state used across services
15432
+ */
15433
+ exports.JobState = void 0;
15434
+ (function (JobState) {
15435
+ JobState["Pending"] = "Pending";
15436
+ JobState["Running"] = "Running";
15437
+ JobState["Stopping"] = "Stopping";
15438
+ JobState["Terminating"] = "Terminating";
15439
+ JobState["Faulted"] = "Faulted";
15440
+ JobState["Successful"] = "Successful";
15441
+ JobState["Stopped"] = "Stopped";
15442
+ JobState["Suspended"] = "Suspended";
15443
+ JobState["Resumed"] = "Resumed";
15444
+ })(exports.JobState || (exports.JobState = {}));
15445
+
14822
15446
  /**
14823
15447
  * Maps fields for Process entities to ensure consistent naming
14824
15448
  */
@@ -15275,49 +15899,6 @@
15275
15899
  track('Queues.GetById')
15276
15900
  ], QueueService.prototype, "getById", null);
15277
15901
 
15278
- /**
15279
- * Maps fields for Attachment entities to ensure consistent naming
15280
- */
15281
- const AttachmentsMap = {
15282
- creationTime: 'createdTime',
15283
- lastModificationTime: 'lastModifiedTime'
15284
- };
15285
-
15286
- class AttachmentService extends BaseService {
15287
- /**
15288
- * Gets an attachment by ID
15289
- * @param id - The UUID of the attachment to retrieve
15290
- * @param options - Optional query parameters (expand, select)
15291
- * @returns Promise resolving to the attachment
15292
- *
15293
- * @example
15294
- * ```typescript
15295
- * import { Attachments } from '@uipath/uipath-typescript/attachments';
15296
- *
15297
- * const attachments = new Attachments(sdk);
15298
- * const attachment = await attachments.getById('12345678-1234-1234-1234-123456789abc');
15299
- * ```
15300
- */
15301
- async getById(id, options = {}) {
15302
- if (!id) {
15303
- throw new ValidationError({ message: 'id is required for getById' });
15304
- }
15305
- // Prefix all keys in options with $ for OData
15306
- const keysToPrefix = Object.keys(options);
15307
- const apiOptions = addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix);
15308
- const response = await this.get(ORCHESTRATOR_ATTACHMENT_ENDPOINTS.GET_BY_ID(id), {
15309
- params: apiOptions,
15310
- });
15311
- // Transform response from PascalCase to camelCase, then apply field maps
15312
- const camelCased = pascalToCamelCaseKeys(response.data);
15313
- camelCased.blobFileAccess = transformData(camelCased.blobFileAccess, BucketMap);
15314
- return transformData(camelCased, AttachmentsMap);
15315
- }
15316
- }
15317
- __decorate([
15318
- track('Attachments.GetById')
15319
- ], AttachmentService.prototype, "getById", null);
15320
-
15321
15902
  /**
15322
15903
  * UiPath SDK - Legacy class providing all services through property getters.
15323
15904
  *
@@ -15433,22 +16014,6 @@
15433
16014
  }
15434
16015
  }
15435
16016
 
15436
- /**
15437
- * Common enum for job state used across services
15438
- */
15439
- exports.JobState = void 0;
15440
- (function (JobState) {
15441
- JobState["Pending"] = "Pending";
15442
- JobState["Running"] = "Running";
15443
- JobState["Stopping"] = "Stopping";
15444
- JobState["Terminating"] = "Terminating";
15445
- JobState["Faulted"] = "Faulted";
15446
- JobState["Successful"] = "Successful";
15447
- JobState["Stopped"] = "Stopped";
15448
- JobState["Suspended"] = "Suspended";
15449
- JobState["Resumed"] = "Resumed";
15450
- })(exports.JobState || (exports.JobState = {}));
15451
-
15452
16017
  /**
15453
16018
  * Common Constants for Conversational Agent
15454
16019
  */
@@ -15821,6 +16386,7 @@
15821
16386
  exports.createCaseInstanceWithMethods = createCaseInstanceWithMethods;
15822
16387
  exports.createConversationWithMethods = createConversationWithMethods;
15823
16388
  exports.createEntityWithMethods = createEntityWithMethods;
16389
+ exports.createJobWithMethods = createJobWithMethods;
15824
16390
  exports.createProcessInstanceWithMethods = createProcessInstanceWithMethods;
15825
16391
  exports.createProcessWithMethods = createProcessWithMethods;
15826
16392
  exports.createTaskWithMethods = createTaskWithMethods;