@uipath/uipath-typescript 1.3.0 → 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.
- package/dist/assets/index.cjs +5 -8
- package/dist/assets/index.d.ts +3 -1
- package/dist/assets/index.mjs +5 -8
- package/dist/attachments/index.cjs +5 -8
- package/dist/attachments/index.d.ts +3 -1
- package/dist/attachments/index.mjs +5 -8
- package/dist/buckets/index.cjs +5 -8
- package/dist/buckets/index.d.ts +3 -1
- package/dist/buckets/index.mjs +5 -8
- package/dist/cases/index.cjs +5 -8
- package/dist/cases/index.d.ts +3 -1
- package/dist/cases/index.mjs +5 -8
- package/dist/conversational-agent/index.cjs +38 -16
- package/dist/conversational-agent/index.d.ts +26 -4
- package/dist/conversational-agent/index.mjs +38 -16
- package/dist/core/index.cjs +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.mjs +2 -2
- package/dist/entities/index.cjs +680 -284
- package/dist/entities/index.d.ts +559 -45
- package/dist/entities/index.mjs +681 -285
- package/dist/index.cjs +515 -86
- package/dist/index.d.ts +604 -52
- package/dist/index.mjs +516 -87
- package/dist/index.umd.js +515 -86
- package/dist/jobs/index.cjs +57 -27
- package/dist/jobs/index.d.ts +70 -11
- package/dist/jobs/index.mjs +57 -27
- package/dist/maestro-processes/index.cjs +5 -8
- package/dist/maestro-processes/index.d.ts +3 -1
- package/dist/maestro-processes/index.mjs +5 -8
- package/dist/processes/index.cjs +5 -8
- package/dist/processes/index.d.ts +3 -1
- package/dist/processes/index.mjs +5 -8
- package/dist/queues/index.cjs +5 -8
- package/dist/queues/index.d.ts +3 -1
- package/dist/queues/index.mjs +5 -8
- package/dist/tasks/index.cjs +5 -8
- package/dist/tasks/index.d.ts +3 -1
- package/dist/tasks/index.mjs +5 -8
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4571,6 +4571,12 @@ const MAESTRO_ENDPOINTS = {
|
|
|
4571
4571
|
/**
|
|
4572
4572
|
* Data Fabric Service Endpoints
|
|
4573
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';
|
|
4574
4580
|
/**
|
|
4575
4581
|
* Data Fabric Entity Service Endpoints
|
|
4576
4582
|
*/
|
|
@@ -4585,6 +4591,11 @@ const DATA_FABRIC_ENDPOINTS = {
|
|
|
4585
4591
|
UPDATE_RECORD_BY_ID: (entityId, recordId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/update/${recordId}`,
|
|
4586
4592
|
UPDATE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/update-batch`,
|
|
4587
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`,
|
|
4588
4599
|
DOWNLOAD_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
|
|
4589
4600
|
UPLOAD_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
|
|
4590
4601
|
DELETE_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
|
|
@@ -5418,7 +5429,7 @@ function normalizeBaseUrl(url) {
|
|
|
5418
5429
|
// Connection string placeholder that will be replaced during build
|
|
5419
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";
|
|
5420
5431
|
// SDK Version placeholder
|
|
5421
|
-
const SDK_VERSION = "1.3.
|
|
5432
|
+
const SDK_VERSION = "1.3.1";
|
|
5422
5433
|
const VERSION = "Version";
|
|
5423
5434
|
const SERVICE = "Service";
|
|
5424
5435
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -5807,7 +5818,7 @@ var _UiPath_instances, _UiPath_config, _UiPath_authService, _UiPath_initialized,
|
|
|
5807
5818
|
*
|
|
5808
5819
|
* Supports two usage patterns:
|
|
5809
5820
|
* 1. Full config in constructor — for server-side or explicit configuration
|
|
5810
|
-
* 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
|
|
5811
5822
|
*
|
|
5812
5823
|
* @example
|
|
5813
5824
|
* ```typescript
|
|
@@ -6273,15 +6284,11 @@ const RESPONSE_TYPES = {
|
|
|
6273
6284
|
|
|
6274
6285
|
class ApiClient {
|
|
6275
6286
|
constructor(config, executionContext, tokenManager, clientConfig = {}) {
|
|
6276
|
-
this.defaultHeaders = {};
|
|
6277
6287
|
this.config = config;
|
|
6278
6288
|
this.executionContext = executionContext;
|
|
6279
6289
|
this.clientConfig = clientConfig;
|
|
6280
6290
|
this.tokenManager = tokenManager;
|
|
6281
6291
|
}
|
|
6282
|
-
setDefaultHeaders(headers) {
|
|
6283
|
-
this.defaultHeaders = { ...this.defaultHeaders, ...headers };
|
|
6284
|
-
}
|
|
6285
6292
|
/**
|
|
6286
6293
|
* Gets a valid authentication token, refreshing if necessary.
|
|
6287
6294
|
* Used internally for API requests and exposed for services that need manual auth headers.
|
|
@@ -6297,7 +6304,6 @@ class ApiClient {
|
|
|
6297
6304
|
return {
|
|
6298
6305
|
'Authorization': `Bearer ${token}`,
|
|
6299
6306
|
'Content-Type': CONTENT_TYPES.JSON,
|
|
6300
|
-
...this.defaultHeaders,
|
|
6301
6307
|
...this.clientConfig.headers
|
|
6302
6308
|
};
|
|
6303
6309
|
}
|
|
@@ -7353,6 +7359,8 @@ class BaseService {
|
|
|
7353
7359
|
*
|
|
7354
7360
|
* @param instance - UiPath SDK instance providing authentication and configuration.
|
|
7355
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)
|
|
7356
7364
|
*
|
|
7357
7365
|
* @example
|
|
7358
7366
|
* ```typescript
|
|
@@ -7372,11 +7380,11 @@ class BaseService {
|
|
|
7372
7380
|
* const entities = new Entities(sdk);
|
|
7373
7381
|
* ```
|
|
7374
7382
|
*/
|
|
7375
|
-
constructor(instance) {
|
|
7383
|
+
constructor(instance, headers) {
|
|
7376
7384
|
// Private field - not visible via Object.keys() or any reflection
|
|
7377
7385
|
_BaseService_apiClient.set(this, void 0);
|
|
7378
7386
|
const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
|
|
7379
|
-
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager), "f");
|
|
7387
|
+
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
|
|
7380
7388
|
}
|
|
7381
7389
|
/**
|
|
7382
7390
|
* Gets a valid authentication token, refreshing if necessary.
|
|
@@ -7635,27 +7643,41 @@ function createEntityMethods(entityData, service) {
|
|
|
7635
7643
|
throw new Error('Entity ID is undefined');
|
|
7636
7644
|
return service.deleteAttachment(entityData.id, recordId, fieldName);
|
|
7637
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
|
+
},
|
|
7638
7656
|
async insert(data, options) {
|
|
7639
7657
|
return this.insertRecord(data, options);
|
|
7640
7658
|
},
|
|
7641
7659
|
async batchInsert(data, options) {
|
|
7642
7660
|
return this.insertRecords(data, options);
|
|
7643
7661
|
},
|
|
7644
|
-
async update(data, options) {
|
|
7645
|
-
return this.updateRecords(data, options);
|
|
7646
|
-
},
|
|
7647
|
-
async delete(recordIds, options) {
|
|
7648
|
-
return this.deleteRecords(recordIds, options);
|
|
7649
|
-
},
|
|
7650
7662
|
async getRecords(options) {
|
|
7651
7663
|
return this.getAllRecords(options);
|
|
7652
|
-
}
|
|
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
|
+
},
|
|
7653
7675
|
};
|
|
7654
7676
|
}
|
|
7655
7677
|
/**
|
|
7656
|
-
* Creates an actionable entity
|
|
7678
|
+
* Creates an actionable entity by combining entity metadata with data and management methods
|
|
7657
7679
|
*
|
|
7658
|
-
* @param
|
|
7680
|
+
* @param entityMetadata - Entity metadata
|
|
7659
7681
|
* @param service - The entity service instance
|
|
7660
7682
|
* @returns Entity metadata with added methods
|
|
7661
7683
|
*/
|
|
@@ -7665,42 +7687,7 @@ function createEntityWithMethods(entityData, service) {
|
|
|
7665
7687
|
}
|
|
7666
7688
|
|
|
7667
7689
|
/**
|
|
7668
|
-
*
|
|
7669
|
-
* @param paramsObj - Object containing parameter key-value pairs
|
|
7670
|
-
* @returns Parameters object with undefined values filtered out
|
|
7671
|
-
*
|
|
7672
|
-
* @example
|
|
7673
|
-
* ```typescript
|
|
7674
|
-
* // Entity service parameters
|
|
7675
|
-
* const params = createParams({
|
|
7676
|
-
* start: 0,
|
|
7677
|
-
* limit: 10,
|
|
7678
|
-
* expansionLevel: 1
|
|
7679
|
-
* });
|
|
7680
|
-
*
|
|
7681
|
-
* // With optional/undefined values (automatically filtered)
|
|
7682
|
-
* const params = createParams({
|
|
7683
|
-
* start: options.start, // Could be undefined
|
|
7684
|
-
* limit: options.limit, // Could be undefined
|
|
7685
|
-
* expansionLevel: options.expansionLevel // Could be undefined
|
|
7686
|
-
* });
|
|
7687
|
-
*
|
|
7688
|
-
* // Empty params
|
|
7689
|
-
* const params = createParams();
|
|
7690
|
-
* ```
|
|
7691
|
-
*/
|
|
7692
|
-
function createParams(paramsObj = {}) {
|
|
7693
|
-
const params = {};
|
|
7694
|
-
for (const [key, value] of Object.entries(paramsObj)) {
|
|
7695
|
-
if (value !== undefined && value !== null) {
|
|
7696
|
-
params[key] = value;
|
|
7697
|
-
}
|
|
7698
|
-
}
|
|
7699
|
-
return params;
|
|
7700
|
-
}
|
|
7701
|
-
|
|
7702
|
-
/**
|
|
7703
|
-
* Entity field type names
|
|
7690
|
+
* Entity field data type names (SQL-level types returned by the API)
|
|
7704
7691
|
*/
|
|
7705
7692
|
var EntityFieldDataType;
|
|
7706
7693
|
(function (EntityFieldDataType) {
|
|
@@ -7716,7 +7703,41 @@ var EntityFieldDataType;
|
|
|
7716
7703
|
EntityFieldDataType["BOOLEAN"] = "BOOLEAN";
|
|
7717
7704
|
EntityFieldDataType["BIG_INTEGER"] = "BIG_INTEGER";
|
|
7718
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";
|
|
7719
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 = {}));
|
|
7720
7741
|
/**
|
|
7721
7742
|
* Entity type enum
|
|
7722
7743
|
*/
|
|
@@ -7762,6 +7783,41 @@ var JoinType;
|
|
|
7762
7783
|
JoinType["LeftJoin"] = "LeftJoin";
|
|
7763
7784
|
})(JoinType || (JoinType = {}));
|
|
7764
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
|
+
|
|
7765
7821
|
/**
|
|
7766
7822
|
* Entity field data types (SQL types from API)
|
|
7767
7823
|
*/
|
|
@@ -7780,6 +7836,7 @@ var SqlFieldType;
|
|
|
7780
7836
|
SqlFieldType["DECIMAL"] = "DECIMAL";
|
|
7781
7837
|
SqlFieldType["MULTILINE"] = "MULTILINE";
|
|
7782
7838
|
})(SqlFieldType || (SqlFieldType = {}));
|
|
7839
|
+
|
|
7783
7840
|
/**
|
|
7784
7841
|
* Maps fields for Entities
|
|
7785
7842
|
*/
|
|
@@ -7789,6 +7846,40 @@ const EntityMap = {
|
|
|
7789
7846
|
sqlType: 'fieldDataType',
|
|
7790
7847
|
fieldDefinition: 'fieldMetaData'
|
|
7791
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
|
+
};
|
|
7792
7883
|
/**
|
|
7793
7884
|
* Maps SQL field types to friendly display names
|
|
7794
7885
|
*/
|
|
@@ -7804,7 +7895,7 @@ const EntityFieldTypeMap = {
|
|
|
7804
7895
|
[SqlFieldType.DATE]: EntityFieldDataType.DATE,
|
|
7805
7896
|
[SqlFieldType.BIT]: EntityFieldDataType.BOOLEAN,
|
|
7806
7897
|
[SqlFieldType.DECIMAL]: EntityFieldDataType.DECIMAL,
|
|
7807
|
-
[SqlFieldType.MULTILINE]: EntityFieldDataType.MULTILINE_TEXT
|
|
7898
|
+
[SqlFieldType.MULTILINE]: EntityFieldDataType.MULTILINE_TEXT,
|
|
7808
7899
|
};
|
|
7809
7900
|
|
|
7810
7901
|
/**
|
|
@@ -8134,6 +8225,99 @@ class EntityService extends BaseService {
|
|
|
8134
8225
|
});
|
|
8135
8226
|
return entities;
|
|
8136
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
|
+
}
|
|
8137
8321
|
/**
|
|
8138
8322
|
* Downloads an attachment from an entity record field
|
|
8139
8323
|
*
|
|
@@ -8258,18 +8442,169 @@ class EntityService extends BaseService {
|
|
|
8258
8442
|
return this.insertRecordsById(id, data, options);
|
|
8259
8443
|
}
|
|
8260
8444
|
/**
|
|
8261
|
-
*
|
|
8262
|
-
*
|
|
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
|
|
8263
8461
|
*/
|
|
8264
|
-
async
|
|
8265
|
-
|
|
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;
|
|
8266
8482
|
}
|
|
8267
8483
|
/**
|
|
8268
|
-
*
|
|
8269
|
-
*
|
|
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
|
|
8270
8494
|
*/
|
|
8271
|
-
async deleteById(id
|
|
8272
|
-
|
|
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
|
|
8556
|
+
*/
|
|
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
|
+
});
|
|
8273
8608
|
}
|
|
8274
8609
|
/**
|
|
8275
8610
|
* Orchestrates all field mapping transformations
|
|
@@ -8293,11 +8628,20 @@ class EntityService extends BaseService {
|
|
|
8293
8628
|
metadata.fields = metadata.fields.map(field => {
|
|
8294
8629
|
// Rename sqlType to fieldDataType
|
|
8295
8630
|
let transformedField = transformData(field, EntityMap);
|
|
8296
|
-
// Map
|
|
8631
|
+
// Map field type: prefer fieldDisplayType for types that share SQL types (File, ChoiceSet, AutoNumber)
|
|
8297
8632
|
if (transformedField.fieldDataType?.name) {
|
|
8298
|
-
const
|
|
8299
|
-
|
|
8300
|
-
|
|
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
|
+
}
|
|
8301
8645
|
}
|
|
8302
8646
|
}
|
|
8303
8647
|
this.transformNestedReferences(transformedField);
|
|
@@ -8341,7 +8685,44 @@ class EntityService extends BaseService {
|
|
|
8341
8685
|
return externalSource;
|
|
8342
8686
|
});
|
|
8343
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
|
+
}
|
|
8344
8722
|
}
|
|
8723
|
+
EntityService.RESERVED_FIELD_NAMES = new Set([
|
|
8724
|
+
'Id', 'CreatedBy', 'CreateTime', 'UpdatedBy', 'UpdateTime'
|
|
8725
|
+
]);
|
|
8345
8726
|
__decorate([
|
|
8346
8727
|
track('Entities.GetById')
|
|
8347
8728
|
], EntityService.prototype, "getById", null);
|
|
@@ -8369,6 +8750,12 @@ __decorate([
|
|
|
8369
8750
|
__decorate([
|
|
8370
8751
|
track('Entities.GetAll')
|
|
8371
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);
|
|
8372
8759
|
__decorate([
|
|
8373
8760
|
track('Entities.DownloadAttachment')
|
|
8374
8761
|
], EntityService.prototype, "downloadAttachment", null);
|
|
@@ -8378,6 +8765,15 @@ __decorate([
|
|
|
8378
8765
|
__decorate([
|
|
8379
8766
|
track('Entities.DeleteAttachment')
|
|
8380
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);
|
|
8381
8777
|
|
|
8382
8778
|
class ChoiceSetService extends BaseService {
|
|
8383
8779
|
/**
|
|
@@ -11108,6 +11504,50 @@ class JobService extends FolderScopedService {
|
|
|
11108
11504
|
},
|
|
11109
11505
|
}, options);
|
|
11110
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
|
+
}
|
|
11111
11551
|
/**
|
|
11112
11552
|
* Gets the output of a completed job.
|
|
11113
11553
|
*
|
|
@@ -11144,34 +11584,20 @@ class JobService extends FolderScopedService {
|
|
|
11144
11584
|
if (!jobKey) {
|
|
11145
11585
|
throw new ValidationError({ message: 'jobKey is required for getOutput' });
|
|
11146
11586
|
}
|
|
11147
|
-
const job = await this.
|
|
11148
|
-
if (job.
|
|
11587
|
+
const job = await this.getById(jobKey, folderId, { select: 'outputArguments,outputFile' });
|
|
11588
|
+
if (job.outputArguments) {
|
|
11149
11589
|
try {
|
|
11150
|
-
return JSON.parse(job.
|
|
11590
|
+
return JSON.parse(job.outputArguments);
|
|
11151
11591
|
}
|
|
11152
11592
|
catch {
|
|
11153
11593
|
throw new ServerError({ message: 'Failed to parse job output arguments as JSON' });
|
|
11154
11594
|
}
|
|
11155
11595
|
}
|
|
11156
|
-
if (job.
|
|
11157
|
-
return this.downloadOutputFile(job.
|
|
11596
|
+
if (job.outputFile) {
|
|
11597
|
+
return this.downloadOutputFile(job.outputFile);
|
|
11158
11598
|
}
|
|
11159
11599
|
return null;
|
|
11160
11600
|
}
|
|
11161
|
-
/**
|
|
11162
|
-
* Fetches a job by its Key (GUID) using the GetByKey endpoint.
|
|
11163
|
-
* Only selects fields needed for output extraction.
|
|
11164
|
-
*/
|
|
11165
|
-
async fetchJobByKey(jobKey, folderId) {
|
|
11166
|
-
const headers = createHeaders({ [FOLDER_ID]: folderId });
|
|
11167
|
-
const response = await this.get(JOB_ENDPOINTS.GET_BY_KEY(jobKey), {
|
|
11168
|
-
params: {
|
|
11169
|
-
$select: 'OutputArguments,OutputFile',
|
|
11170
|
-
},
|
|
11171
|
-
headers,
|
|
11172
|
-
});
|
|
11173
|
-
return response.data;
|
|
11174
|
-
}
|
|
11175
11601
|
/**
|
|
11176
11602
|
* Downloads the output file content via the Attachments API.
|
|
11177
11603
|
* 1. Fetches blob access info from the attachment using AttachmentService
|
|
@@ -11210,6 +11636,9 @@ class JobService extends FolderScopedService {
|
|
|
11210
11636
|
__decorate([
|
|
11211
11637
|
track('Jobs.GetAll')
|
|
11212
11638
|
], JobService.prototype, "getAll", null);
|
|
11639
|
+
__decorate([
|
|
11640
|
+
track('Jobs.GetById')
|
|
11641
|
+
], JobService.prototype, "getById", null);
|
|
11213
11642
|
__decorate([
|
|
11214
11643
|
track('Jobs.GetOutput')
|
|
11215
11644
|
], JobService.prototype, "getOutput", null);
|
|
@@ -12159,4 +12588,4 @@ function getAppBase() {
|
|
|
12159
12588
|
return getMetaTagContent(UiPathMetaTags.APP_BASE) || '/';
|
|
12160
12589
|
}
|
|
12161
12590
|
|
|
12162
|
-
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, createJobWithMethods, 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 };
|