@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.cjs
CHANGED
|
@@ -4573,6 +4573,12 @@ const MAESTRO_ENDPOINTS = {
|
|
|
4573
4573
|
/**
|
|
4574
4574
|
* Data Fabric Service Endpoints
|
|
4575
4575
|
*/
|
|
4576
|
+
/**
|
|
4577
|
+
* Default folder key used for tenant-level Data Fabric entities.
|
|
4578
|
+
* Tenant-level entities are not scoped to a folder; this is the
|
|
4579
|
+
* conventional placeholder value the API expects.
|
|
4580
|
+
*/
|
|
4581
|
+
const DATA_FABRIC_TENANT_FOLDER_ID = '00000000-0000-0000-0000-000000000000';
|
|
4576
4582
|
/**
|
|
4577
4583
|
* Data Fabric Entity Service Endpoints
|
|
4578
4584
|
*/
|
|
@@ -4587,6 +4593,11 @@ const DATA_FABRIC_ENDPOINTS = {
|
|
|
4587
4593
|
UPDATE_RECORD_BY_ID: (entityId, recordId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/update/${recordId}`,
|
|
4588
4594
|
UPDATE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/update-batch`,
|
|
4589
4595
|
DELETE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/delete-batch`,
|
|
4596
|
+
UPSERT: `${DATAFABRIC_BASE}/api/Entity`,
|
|
4597
|
+
DELETE: (entityId) => `${DATAFABRIC_BASE}/api/Entity/${entityId}`,
|
|
4598
|
+
UPDATE_METADATA: (entityId) => `${DATAFABRIC_BASE}/api/Entity/${entityId}/metadata`,
|
|
4599
|
+
QUERY_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/query`,
|
|
4600
|
+
BULK_UPLOAD_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/bulk-upload`,
|
|
4590
4601
|
DOWNLOAD_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
|
|
4591
4602
|
UPLOAD_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
|
|
4592
4603
|
DELETE_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
|
|
@@ -5420,7 +5431,7 @@ function normalizeBaseUrl(url) {
|
|
|
5420
5431
|
// Connection string placeholder that will be replaced during build
|
|
5421
5432
|
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";
|
|
5422
5433
|
// SDK Version placeholder
|
|
5423
|
-
const SDK_VERSION = "1.3.
|
|
5434
|
+
const SDK_VERSION = "1.3.1";
|
|
5424
5435
|
const VERSION = "Version";
|
|
5425
5436
|
const SERVICE = "Service";
|
|
5426
5437
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -5809,7 +5820,7 @@ var _UiPath_instances, _UiPath_config, _UiPath_authService, _UiPath_initialized,
|
|
|
5809
5820
|
*
|
|
5810
5821
|
* Supports two usage patterns:
|
|
5811
5822
|
* 1. Full config in constructor — for server-side or explicit configuration
|
|
5812
|
-
* 2. No config / partial config — loads from meta tags injected by @uipath/coded-apps plugin
|
|
5823
|
+
* 2. No config / partial config — loads from meta tags injected by @uipath/coded-apps-dev plugin
|
|
5813
5824
|
*
|
|
5814
5825
|
* @example
|
|
5815
5826
|
* ```typescript
|
|
@@ -6275,15 +6286,11 @@ const RESPONSE_TYPES = {
|
|
|
6275
6286
|
|
|
6276
6287
|
class ApiClient {
|
|
6277
6288
|
constructor(config, executionContext, tokenManager, clientConfig = {}) {
|
|
6278
|
-
this.defaultHeaders = {};
|
|
6279
6289
|
this.config = config;
|
|
6280
6290
|
this.executionContext = executionContext;
|
|
6281
6291
|
this.clientConfig = clientConfig;
|
|
6282
6292
|
this.tokenManager = tokenManager;
|
|
6283
6293
|
}
|
|
6284
|
-
setDefaultHeaders(headers) {
|
|
6285
|
-
this.defaultHeaders = { ...this.defaultHeaders, ...headers };
|
|
6286
|
-
}
|
|
6287
6294
|
/**
|
|
6288
6295
|
* Gets a valid authentication token, refreshing if necessary.
|
|
6289
6296
|
* Used internally for API requests and exposed for services that need manual auth headers.
|
|
@@ -6299,7 +6306,6 @@ class ApiClient {
|
|
|
6299
6306
|
return {
|
|
6300
6307
|
'Authorization': `Bearer ${token}`,
|
|
6301
6308
|
'Content-Type': CONTENT_TYPES.JSON,
|
|
6302
|
-
...this.defaultHeaders,
|
|
6303
6309
|
...this.clientConfig.headers
|
|
6304
6310
|
};
|
|
6305
6311
|
}
|
|
@@ -7355,6 +7361,8 @@ class BaseService {
|
|
|
7355
7361
|
*
|
|
7356
7362
|
* @param instance - UiPath SDK instance providing authentication and configuration.
|
|
7357
7363
|
* Services receive this via dependency injection in the modular pattern.
|
|
7364
|
+
* @param headers - Optional default headers to include in every request (e.g. `x-uipath-external-user-id` for
|
|
7365
|
+
* CAS external-app auth)
|
|
7358
7366
|
*
|
|
7359
7367
|
* @example
|
|
7360
7368
|
* ```typescript
|
|
@@ -7374,11 +7382,11 @@ class BaseService {
|
|
|
7374
7382
|
* const entities = new Entities(sdk);
|
|
7375
7383
|
* ```
|
|
7376
7384
|
*/
|
|
7377
|
-
constructor(instance) {
|
|
7385
|
+
constructor(instance, headers) {
|
|
7378
7386
|
// Private field - not visible via Object.keys() or any reflection
|
|
7379
7387
|
_BaseService_apiClient.set(this, void 0);
|
|
7380
7388
|
const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
|
|
7381
|
-
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager), "f");
|
|
7389
|
+
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
|
|
7382
7390
|
}
|
|
7383
7391
|
/**
|
|
7384
7392
|
* Gets a valid authentication token, refreshing if necessary.
|
|
@@ -7637,27 +7645,41 @@ function createEntityMethods(entityData, service) {
|
|
|
7637
7645
|
throw new Error('Entity ID is undefined');
|
|
7638
7646
|
return service.deleteAttachment(entityData.id, recordId, fieldName);
|
|
7639
7647
|
},
|
|
7648
|
+
async queryRecords(options) {
|
|
7649
|
+
if (!entityData.id)
|
|
7650
|
+
throw new Error('Entity ID is undefined');
|
|
7651
|
+
return service.queryRecordsById(entityData.id, options);
|
|
7652
|
+
},
|
|
7653
|
+
async importRecords(file) {
|
|
7654
|
+
if (!entityData.id)
|
|
7655
|
+
throw new Error('Entity ID is undefined');
|
|
7656
|
+
return service.importRecordsById(entityData.id, file);
|
|
7657
|
+
},
|
|
7640
7658
|
async insert(data, options) {
|
|
7641
7659
|
return this.insertRecord(data, options);
|
|
7642
7660
|
},
|
|
7643
7661
|
async batchInsert(data, options) {
|
|
7644
7662
|
return this.insertRecords(data, options);
|
|
7645
7663
|
},
|
|
7646
|
-
async update(data, options) {
|
|
7647
|
-
return this.updateRecords(data, options);
|
|
7648
|
-
},
|
|
7649
|
-
async delete(recordIds, options) {
|
|
7650
|
-
return this.deleteRecords(recordIds, options);
|
|
7651
|
-
},
|
|
7652
7664
|
async getRecords(options) {
|
|
7653
7665
|
return this.getAllRecords(options);
|
|
7654
|
-
}
|
|
7666
|
+
},
|
|
7667
|
+
async delete() {
|
|
7668
|
+
if (!entityData.id)
|
|
7669
|
+
throw new Error('Entity ID is undefined');
|
|
7670
|
+
return service.deleteById(entityData.id);
|
|
7671
|
+
},
|
|
7672
|
+
async update(options) {
|
|
7673
|
+
if (!entityData.id)
|
|
7674
|
+
throw new Error('Entity ID is undefined');
|
|
7675
|
+
return service.updateById(entityData.id, options);
|
|
7676
|
+
},
|
|
7655
7677
|
};
|
|
7656
7678
|
}
|
|
7657
7679
|
/**
|
|
7658
|
-
* Creates an actionable entity
|
|
7680
|
+
* Creates an actionable entity by combining entity metadata with data and management methods
|
|
7659
7681
|
*
|
|
7660
|
-
* @param
|
|
7682
|
+
* @param entityMetadata - Entity metadata
|
|
7661
7683
|
* @param service - The entity service instance
|
|
7662
7684
|
* @returns Entity metadata with added methods
|
|
7663
7685
|
*/
|
|
@@ -7667,42 +7689,7 @@ function createEntityWithMethods(entityData, service) {
|
|
|
7667
7689
|
}
|
|
7668
7690
|
|
|
7669
7691
|
/**
|
|
7670
|
-
*
|
|
7671
|
-
* @param paramsObj - Object containing parameter key-value pairs
|
|
7672
|
-
* @returns Parameters object with undefined values filtered out
|
|
7673
|
-
*
|
|
7674
|
-
* @example
|
|
7675
|
-
* ```typescript
|
|
7676
|
-
* // Entity service parameters
|
|
7677
|
-
* const params = createParams({
|
|
7678
|
-
* start: 0,
|
|
7679
|
-
* limit: 10,
|
|
7680
|
-
* expansionLevel: 1
|
|
7681
|
-
* });
|
|
7682
|
-
*
|
|
7683
|
-
* // With optional/undefined values (automatically filtered)
|
|
7684
|
-
* const params = createParams({
|
|
7685
|
-
* start: options.start, // Could be undefined
|
|
7686
|
-
* limit: options.limit, // Could be undefined
|
|
7687
|
-
* expansionLevel: options.expansionLevel // Could be undefined
|
|
7688
|
-
* });
|
|
7689
|
-
*
|
|
7690
|
-
* // Empty params
|
|
7691
|
-
* const params = createParams();
|
|
7692
|
-
* ```
|
|
7693
|
-
*/
|
|
7694
|
-
function createParams(paramsObj = {}) {
|
|
7695
|
-
const params = {};
|
|
7696
|
-
for (const [key, value] of Object.entries(paramsObj)) {
|
|
7697
|
-
if (value !== undefined && value !== null) {
|
|
7698
|
-
params[key] = value;
|
|
7699
|
-
}
|
|
7700
|
-
}
|
|
7701
|
-
return params;
|
|
7702
|
-
}
|
|
7703
|
-
|
|
7704
|
-
/**
|
|
7705
|
-
* Entity field type names
|
|
7692
|
+
* Entity field data type names (SQL-level types returned by the API)
|
|
7706
7693
|
*/
|
|
7707
7694
|
exports.EntityFieldDataType = void 0;
|
|
7708
7695
|
(function (EntityFieldDataType) {
|
|
@@ -7718,7 +7705,41 @@ exports.EntityFieldDataType = void 0;
|
|
|
7718
7705
|
EntityFieldDataType["BOOLEAN"] = "BOOLEAN";
|
|
7719
7706
|
EntityFieldDataType["BIG_INTEGER"] = "BIG_INTEGER";
|
|
7720
7707
|
EntityFieldDataType["MULTILINE_TEXT"] = "MULTILINE_TEXT";
|
|
7708
|
+
EntityFieldDataType["FILE"] = "FILE";
|
|
7709
|
+
EntityFieldDataType["CHOICE_SET_SINGLE"] = "CHOICE_SET_SINGLE";
|
|
7710
|
+
EntityFieldDataType["CHOICE_SET_MULTIPLE"] = "CHOICE_SET_MULTIPLE";
|
|
7711
|
+
EntityFieldDataType["AUTO_NUMBER"] = "AUTO_NUMBER";
|
|
7712
|
+
EntityFieldDataType["RELATIONSHIP"] = "RELATIONSHIP";
|
|
7721
7713
|
})(exports.EntityFieldDataType || (exports.EntityFieldDataType = {}));
|
|
7714
|
+
/**
|
|
7715
|
+
* Logical operator for combining query filter groups
|
|
7716
|
+
*/
|
|
7717
|
+
exports.LogicalOperator = void 0;
|
|
7718
|
+
(function (LogicalOperator) {
|
|
7719
|
+
/** Combine conditions with AND — all conditions must match */
|
|
7720
|
+
LogicalOperator[LogicalOperator["And"] = 0] = "And";
|
|
7721
|
+
/** Combine conditions with OR — any condition must match */
|
|
7722
|
+
LogicalOperator[LogicalOperator["Or"] = 1] = "Or";
|
|
7723
|
+
})(exports.LogicalOperator || (exports.LogicalOperator = {}));
|
|
7724
|
+
/**
|
|
7725
|
+
* Comparison operators for entity query filters.
|
|
7726
|
+
* Not all operators are valid for all field types.
|
|
7727
|
+
*/
|
|
7728
|
+
exports.QueryFilterOperator = void 0;
|
|
7729
|
+
(function (QueryFilterOperator) {
|
|
7730
|
+
QueryFilterOperator["Equals"] = "=";
|
|
7731
|
+
QueryFilterOperator["NotEquals"] = "!=";
|
|
7732
|
+
QueryFilterOperator["GreaterThan"] = ">";
|
|
7733
|
+
QueryFilterOperator["LessThan"] = "<";
|
|
7734
|
+
QueryFilterOperator["GreaterThanOrEqual"] = ">=";
|
|
7735
|
+
QueryFilterOperator["LessThanOrEqual"] = "<=";
|
|
7736
|
+
QueryFilterOperator["Contains"] = "contains";
|
|
7737
|
+
QueryFilterOperator["NotContains"] = "not contains";
|
|
7738
|
+
QueryFilterOperator["StartsWith"] = "startswith";
|
|
7739
|
+
QueryFilterOperator["EndsWith"] = "endswith";
|
|
7740
|
+
QueryFilterOperator["In"] = "in";
|
|
7741
|
+
QueryFilterOperator["NotIn"] = "not in";
|
|
7742
|
+
})(exports.QueryFilterOperator || (exports.QueryFilterOperator = {}));
|
|
7722
7743
|
/**
|
|
7723
7744
|
* Entity type enum
|
|
7724
7745
|
*/
|
|
@@ -7764,6 +7785,41 @@ exports.JoinType = void 0;
|
|
|
7764
7785
|
JoinType["LeftJoin"] = "LeftJoin";
|
|
7765
7786
|
})(exports.JoinType || (exports.JoinType = {}));
|
|
7766
7787
|
|
|
7788
|
+
/**
|
|
7789
|
+
* Creates query parameters object from key-value pairs, filtering out undefined values
|
|
7790
|
+
* @param paramsObj - Object containing parameter key-value pairs
|
|
7791
|
+
* @returns Parameters object with undefined values filtered out
|
|
7792
|
+
*
|
|
7793
|
+
* @example
|
|
7794
|
+
* ```typescript
|
|
7795
|
+
* // Entity service parameters
|
|
7796
|
+
* const params = createParams({
|
|
7797
|
+
* start: 0,
|
|
7798
|
+
* limit: 10,
|
|
7799
|
+
* expansionLevel: 1
|
|
7800
|
+
* });
|
|
7801
|
+
*
|
|
7802
|
+
* // With optional/undefined values (automatically filtered)
|
|
7803
|
+
* const params = createParams({
|
|
7804
|
+
* start: options.start, // Could be undefined
|
|
7805
|
+
* limit: options.limit, // Could be undefined
|
|
7806
|
+
* expansionLevel: options.expansionLevel // Could be undefined
|
|
7807
|
+
* });
|
|
7808
|
+
*
|
|
7809
|
+
* // Empty params
|
|
7810
|
+
* const params = createParams();
|
|
7811
|
+
* ```
|
|
7812
|
+
*/
|
|
7813
|
+
function createParams(paramsObj = {}) {
|
|
7814
|
+
const params = {};
|
|
7815
|
+
for (const [key, value] of Object.entries(paramsObj)) {
|
|
7816
|
+
if (value !== undefined && value !== null) {
|
|
7817
|
+
params[key] = value;
|
|
7818
|
+
}
|
|
7819
|
+
}
|
|
7820
|
+
return params;
|
|
7821
|
+
}
|
|
7822
|
+
|
|
7767
7823
|
/**
|
|
7768
7824
|
* Entity field data types (SQL types from API)
|
|
7769
7825
|
*/
|
|
@@ -7782,6 +7838,7 @@ var SqlFieldType;
|
|
|
7782
7838
|
SqlFieldType["DECIMAL"] = "DECIMAL";
|
|
7783
7839
|
SqlFieldType["MULTILINE"] = "MULTILINE";
|
|
7784
7840
|
})(SqlFieldType || (SqlFieldType = {}));
|
|
7841
|
+
|
|
7785
7842
|
/**
|
|
7786
7843
|
* Maps fields for Entities
|
|
7787
7844
|
*/
|
|
@@ -7791,6 +7848,40 @@ const EntityMap = {
|
|
|
7791
7848
|
sqlType: 'fieldDataType',
|
|
7792
7849
|
fieldDefinition: 'fieldMetaData'
|
|
7793
7850
|
};
|
|
7851
|
+
/**
|
|
7852
|
+
* Maps EntityFieldDataType values to the API field payload components for create/update operations
|
|
7853
|
+
*/
|
|
7854
|
+
const EntitySchemaFieldTypeMap = {
|
|
7855
|
+
[exports.EntityFieldDataType.UUID]: { sqlTypeName: SqlFieldType.UNIQUEIDENTIFIER, fieldDisplayType: exports.FieldDisplayType.Basic },
|
|
7856
|
+
[exports.EntityFieldDataType.STRING]: { sqlTypeName: SqlFieldType.NVARCHAR, fieldDisplayType: exports.FieldDisplayType.Basic },
|
|
7857
|
+
[exports.EntityFieldDataType.INTEGER]: { sqlTypeName: SqlFieldType.INT, fieldDisplayType: exports.FieldDisplayType.Basic },
|
|
7858
|
+
[exports.EntityFieldDataType.DATETIME]: { sqlTypeName: SqlFieldType.DATETIME2, fieldDisplayType: exports.FieldDisplayType.Basic },
|
|
7859
|
+
[exports.EntityFieldDataType.DATETIME_WITH_TZ]: { sqlTypeName: SqlFieldType.DATETIMEOFFSET, fieldDisplayType: exports.FieldDisplayType.Basic },
|
|
7860
|
+
[exports.EntityFieldDataType.DECIMAL]: { sqlTypeName: SqlFieldType.DECIMAL, fieldDisplayType: exports.FieldDisplayType.Basic },
|
|
7861
|
+
[exports.EntityFieldDataType.FLOAT]: { sqlTypeName: SqlFieldType.FLOAT, fieldDisplayType: exports.FieldDisplayType.Basic },
|
|
7862
|
+
[exports.EntityFieldDataType.DOUBLE]: { sqlTypeName: SqlFieldType.REAL, fieldDisplayType: exports.FieldDisplayType.Basic },
|
|
7863
|
+
[exports.EntityFieldDataType.DATE]: { sqlTypeName: SqlFieldType.DATE, fieldDisplayType: exports.FieldDisplayType.Basic },
|
|
7864
|
+
[exports.EntityFieldDataType.BOOLEAN]: { sqlTypeName: SqlFieldType.BIT, fieldDisplayType: exports.FieldDisplayType.Basic },
|
|
7865
|
+
[exports.EntityFieldDataType.BIG_INTEGER]: { sqlTypeName: SqlFieldType.BIGINT, fieldDisplayType: exports.FieldDisplayType.Basic },
|
|
7866
|
+
[exports.EntityFieldDataType.MULTILINE_TEXT]: { sqlTypeName: SqlFieldType.MULTILINE, fieldDisplayType: exports.FieldDisplayType.Basic },
|
|
7867
|
+
[exports.EntityFieldDataType.FILE]: { sqlTypeName: SqlFieldType.UNIQUEIDENTIFIER, fieldDisplayType: exports.FieldDisplayType.File },
|
|
7868
|
+
[exports.EntityFieldDataType.CHOICE_SET_SINGLE]: { sqlTypeName: SqlFieldType.INT, fieldDisplayType: exports.FieldDisplayType.ChoiceSetSingle },
|
|
7869
|
+
[exports.EntityFieldDataType.CHOICE_SET_MULTIPLE]: { sqlTypeName: SqlFieldType.NVARCHAR, fieldDisplayType: exports.FieldDisplayType.ChoiceSetMultiple },
|
|
7870
|
+
[exports.EntityFieldDataType.AUTO_NUMBER]: { sqlTypeName: SqlFieldType.DECIMAL, fieldDisplayType: exports.FieldDisplayType.AutoNumber },
|
|
7871
|
+
[exports.EntityFieldDataType.RELATIONSHIP]: { sqlTypeName: SqlFieldType.UNIQUEIDENTIFIER, fieldDisplayType: exports.FieldDisplayType.Relationship },
|
|
7872
|
+
};
|
|
7873
|
+
/**
|
|
7874
|
+
* Maps FieldDisplayType values to EntityFieldDataType for types that share SQL types
|
|
7875
|
+
* with other field types (File, ChoiceSetSingle, ChoiceSetMultiple, AutoNumber).
|
|
7876
|
+
* Used during read-side transformation to produce the correct EntityFieldDataType.
|
|
7877
|
+
*/
|
|
7878
|
+
const FieldDisplayTypeToDataType = {
|
|
7879
|
+
[exports.FieldDisplayType.File]: exports.EntityFieldDataType.FILE,
|
|
7880
|
+
[exports.FieldDisplayType.ChoiceSetSingle]: exports.EntityFieldDataType.CHOICE_SET_SINGLE,
|
|
7881
|
+
[exports.FieldDisplayType.ChoiceSetMultiple]: exports.EntityFieldDataType.CHOICE_SET_MULTIPLE,
|
|
7882
|
+
[exports.FieldDisplayType.AutoNumber]: exports.EntityFieldDataType.AUTO_NUMBER,
|
|
7883
|
+
[exports.FieldDisplayType.Relationship]: exports.EntityFieldDataType.RELATIONSHIP,
|
|
7884
|
+
};
|
|
7794
7885
|
/**
|
|
7795
7886
|
* Maps SQL field types to friendly display names
|
|
7796
7887
|
*/
|
|
@@ -7806,7 +7897,7 @@ const EntityFieldTypeMap = {
|
|
|
7806
7897
|
[SqlFieldType.DATE]: exports.EntityFieldDataType.DATE,
|
|
7807
7898
|
[SqlFieldType.BIT]: exports.EntityFieldDataType.BOOLEAN,
|
|
7808
7899
|
[SqlFieldType.DECIMAL]: exports.EntityFieldDataType.DECIMAL,
|
|
7809
|
-
[SqlFieldType.MULTILINE]: exports.EntityFieldDataType.MULTILINE_TEXT
|
|
7900
|
+
[SqlFieldType.MULTILINE]: exports.EntityFieldDataType.MULTILINE_TEXT,
|
|
7810
7901
|
};
|
|
7811
7902
|
|
|
7812
7903
|
/**
|
|
@@ -8136,6 +8227,99 @@ class EntityService extends BaseService {
|
|
|
8136
8227
|
});
|
|
8137
8228
|
return entities;
|
|
8138
8229
|
}
|
|
8230
|
+
/**
|
|
8231
|
+
* Queries entity records with filters, sorting, and pagination
|
|
8232
|
+
*
|
|
8233
|
+
* @param id - UUID of the entity
|
|
8234
|
+
* @param options - Query options including filterGroup, selectedFields, sortOptions, and pagination
|
|
8235
|
+
* @returns Promise resolving to {@link NonPaginatedResponse} without pagination options,
|
|
8236
|
+
* or {@link PaginatedResponse} when `pageSize`, `cursor`, or `jumpToPage` are provided
|
|
8237
|
+
*
|
|
8238
|
+
* @example
|
|
8239
|
+
* ```typescript
|
|
8240
|
+
* import { Entities, LogicalOperator, QueryFilterOperator } from '@uipath/uipath-typescript/entities';
|
|
8241
|
+
*
|
|
8242
|
+
* const entities = new Entities(sdk);
|
|
8243
|
+
*
|
|
8244
|
+
* // Non-paginated query with a filter
|
|
8245
|
+
* const result = await entities.queryRecordsById("<entityId>", {
|
|
8246
|
+
* filterGroup: {
|
|
8247
|
+
* logicalOperator: LogicalOperator.And,
|
|
8248
|
+
* queryFilters: [
|
|
8249
|
+
* { fieldName: "status", operator: QueryFilterOperator.Equals, value: "active" }
|
|
8250
|
+
* ]
|
|
8251
|
+
* },
|
|
8252
|
+
* sortOptions: [{ fieldName: "created_at", isDescending: true }],
|
|
8253
|
+
* });
|
|
8254
|
+
* console.log(`Found ${result.totalCount} records`);
|
|
8255
|
+
*
|
|
8256
|
+
* // With pagination
|
|
8257
|
+
* const page1 = await entities.queryRecordsById("<entityId>", {
|
|
8258
|
+
* filterGroup: { queryFilters: [{ fieldName: "status", operator: QueryFilterOperator.Equals, value: "active" }] },
|
|
8259
|
+
* pageSize: 25,
|
|
8260
|
+
* });
|
|
8261
|
+
* if (page1.hasNextPage) {
|
|
8262
|
+
* const page2 = await entities.queryRecordsById("<entityId>", { cursor: page1.nextCursor });
|
|
8263
|
+
* }
|
|
8264
|
+
* ```
|
|
8265
|
+
*/
|
|
8266
|
+
async queryRecordsById(id, options) {
|
|
8267
|
+
return PaginationHelpers.getAll({
|
|
8268
|
+
serviceAccess: this.createPaginationServiceAccess(),
|
|
8269
|
+
getEndpoint: () => DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_ID(id),
|
|
8270
|
+
method: HTTP_METHODS.POST,
|
|
8271
|
+
pagination: {
|
|
8272
|
+
paginationType: PaginationType.OFFSET,
|
|
8273
|
+
itemsField: ENTITY_PAGINATION.ITEMS_FIELD,
|
|
8274
|
+
totalCountField: ENTITY_PAGINATION.TOTAL_COUNT_FIELD,
|
|
8275
|
+
paginationParams: {
|
|
8276
|
+
pageSizeParam: ENTITY_OFFSET_PARAMS.PAGE_SIZE_PARAM,
|
|
8277
|
+
offsetParam: ENTITY_OFFSET_PARAMS.OFFSET_PARAM,
|
|
8278
|
+
countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
|
|
8279
|
+
}
|
|
8280
|
+
},
|
|
8281
|
+
excludeFromPrefix: ['expansionLevel', 'filterGroup', 'selectedFields', 'sortOptions']
|
|
8282
|
+
}, options);
|
|
8283
|
+
}
|
|
8284
|
+
/**
|
|
8285
|
+
* Imports records from a CSV file into an entity
|
|
8286
|
+
*
|
|
8287
|
+
* @param id - UUID of the entity
|
|
8288
|
+
* @param file - CSV file to import (Blob, File, or Uint8Array)
|
|
8289
|
+
* @returns Promise resolving to import result with record counts
|
|
8290
|
+
*
|
|
8291
|
+
* @example
|
|
8292
|
+
* ```typescript
|
|
8293
|
+
* import { Entities } from '@uipath/uipath-typescript/entities';
|
|
8294
|
+
*
|
|
8295
|
+
* const entities = new Entities(sdk);
|
|
8296
|
+
*
|
|
8297
|
+
* // Browser: upload from file input
|
|
8298
|
+
* const fileInput = document.getElementById('csv-input') as HTMLInputElement;
|
|
8299
|
+
* const result = await entities.importRecordsById("<entityId>", fileInput.files[0]);
|
|
8300
|
+
*
|
|
8301
|
+
* // Node.js: read from disk
|
|
8302
|
+
* const fileBuffer = fs.readFileSync('records.csv');
|
|
8303
|
+
* const result = await entities.importRecordsById("<entityId>", new Blob([fileBuffer], { type: 'text/csv' }));
|
|
8304
|
+
*
|
|
8305
|
+
* console.log(`Inserted ${result.insertedRecords} of ${result.totalRecords} records`);
|
|
8306
|
+
* if (result.errorFileLink) {
|
|
8307
|
+
* console.log(`Error file link: ${result.errorFileLink}`);
|
|
8308
|
+
* }
|
|
8309
|
+
* ```
|
|
8310
|
+
* @internal
|
|
8311
|
+
*/
|
|
8312
|
+
async importRecordsById(id, file) {
|
|
8313
|
+
const formData = new FormData();
|
|
8314
|
+
if (file instanceof Uint8Array) {
|
|
8315
|
+
formData.append('file', new Blob([file.buffer]));
|
|
8316
|
+
}
|
|
8317
|
+
else {
|
|
8318
|
+
formData.append('file', file);
|
|
8319
|
+
}
|
|
8320
|
+
const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.BULK_UPLOAD_BY_ID(id), formData);
|
|
8321
|
+
return response.data;
|
|
8322
|
+
}
|
|
8139
8323
|
/**
|
|
8140
8324
|
* Downloads an attachment from an entity record field
|
|
8141
8325
|
*
|
|
@@ -8260,18 +8444,169 @@ class EntityService extends BaseService {
|
|
|
8260
8444
|
return this.insertRecordsById(id, data, options);
|
|
8261
8445
|
}
|
|
8262
8446
|
/**
|
|
8263
|
-
*
|
|
8264
|
-
*
|
|
8447
|
+
* Creates a new Data Fabric entity with the given schema
|
|
8448
|
+
*
|
|
8449
|
+
* @param name - Entity name — must start with a letter and contain
|
|
8450
|
+
* only letters, numbers, and underscores (e.g., `"productCatalog"`).
|
|
8451
|
+
* @param fields - Array of field definitions
|
|
8452
|
+
* @param options - Optional entity-level settings ({@link EntityCreateOptions})
|
|
8453
|
+
* @returns Promise resolving to the ID of the created entity
|
|
8454
|
+
*
|
|
8455
|
+
* @example
|
|
8456
|
+
* ```typescript
|
|
8457
|
+
* const entityId = await entities.create("product_catalog", [
|
|
8458
|
+
* { fieldName: "product_name", type: EntityFieldDataType.STRING, isRequired: true, isUnique: true },
|
|
8459
|
+
* { fieldName: "price", type: EntityFieldDataType.INTEGER, defaultValue: "0" },
|
|
8460
|
+
* ], { displayName: "Product Catalog", description: "Our product catalog", isRbacEnabled: true });
|
|
8461
|
+
* ```
|
|
8462
|
+
* @internal
|
|
8265
8463
|
*/
|
|
8266
|
-
async
|
|
8267
|
-
|
|
8464
|
+
async create(name, fields, options) {
|
|
8465
|
+
this.validateName(name, 'entity');
|
|
8466
|
+
for (const field of fields) {
|
|
8467
|
+
this.validateName(field.fieldName, 'field');
|
|
8468
|
+
}
|
|
8469
|
+
const opts = options ?? {};
|
|
8470
|
+
const payload = {
|
|
8471
|
+
...(opts.description !== undefined && { description: opts.description }),
|
|
8472
|
+
displayName: opts.displayName ?? name,
|
|
8473
|
+
entityDefinition: {
|
|
8474
|
+
name,
|
|
8475
|
+
fields: fields.map(f => this.buildSchemaFieldPayload(f)),
|
|
8476
|
+
folderId: opts.folderKey ?? DATA_FABRIC_TENANT_FOLDER_ID,
|
|
8477
|
+
isRbacEnabled: opts.isRbacEnabled ?? false,
|
|
8478
|
+
isInsightsEnabled: opts.isAnalyticsEnabled ?? false,
|
|
8479
|
+
externalFields: opts.externalFields ?? [],
|
|
8480
|
+
},
|
|
8481
|
+
};
|
|
8482
|
+
const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPSERT, payload);
|
|
8483
|
+
return response.data;
|
|
8268
8484
|
}
|
|
8269
8485
|
/**
|
|
8270
|
-
*
|
|
8271
|
-
*
|
|
8486
|
+
* Deletes a Data Fabric entity and all its records
|
|
8487
|
+
*
|
|
8488
|
+
* @param id - UUID of the entity to delete
|
|
8489
|
+
* @returns Promise resolving when the entity is deleted
|
|
8490
|
+
*
|
|
8491
|
+
* @example
|
|
8492
|
+
* ```typescript
|
|
8493
|
+
* await entities.deleteById("<entityId>");
|
|
8494
|
+
* ```
|
|
8495
|
+
* @internal
|
|
8272
8496
|
*/
|
|
8273
|
-
async deleteById(id
|
|
8274
|
-
|
|
8497
|
+
async deleteById(id) {
|
|
8498
|
+
await this.delete(DATA_FABRIC_ENDPOINTS.ENTITY.DELETE(id));
|
|
8499
|
+
}
|
|
8500
|
+
/**
|
|
8501
|
+
* Updates an existing Data Fabric entity — schema and/or metadata.
|
|
8502
|
+
*
|
|
8503
|
+
* Provide any combination of schema fields (`addFields`, `removeFields`, `updateFields`) and
|
|
8504
|
+
* metadata fields (`displayName`, `description`, `isRbacEnabled`). Each group is applied
|
|
8505
|
+
* only when the corresponding fields are present.
|
|
8506
|
+
*
|
|
8507
|
+
* **Warning:** Schema changes (`addFields`, `removeFields`, `updateFields`) use a
|
|
8508
|
+
* read-modify-write pattern — concurrent calls on the same entity may silently
|
|
8509
|
+
* overwrite each other's changes.
|
|
8510
|
+
*
|
|
8511
|
+
* @param id - UUID of the entity to update
|
|
8512
|
+
* @param options - Changes to apply ({@link EntityUpdateByIdOptions})
|
|
8513
|
+
* @returns Promise resolving when the update is complete
|
|
8514
|
+
*
|
|
8515
|
+
* @example
|
|
8516
|
+
* ```typescript
|
|
8517
|
+
* // Schema-only
|
|
8518
|
+
* await entities.updateById("<entityId>", {
|
|
8519
|
+
* addFields: [{ fieldName: "notes", type: EntityFieldDataType.MULTILINE_TEXT }],
|
|
8520
|
+
* removeFields: [{ fieldName: "old_field" }],
|
|
8521
|
+
* });
|
|
8522
|
+
*
|
|
8523
|
+
* // Metadata-only
|
|
8524
|
+
* await entities.updateById("<entityId>", {
|
|
8525
|
+
* displayName: "My Updated Entity",
|
|
8526
|
+
* description: "Updated description",
|
|
8527
|
+
* });
|
|
8528
|
+
*
|
|
8529
|
+
* // Combined
|
|
8530
|
+
* await entities.updateById("<entityId>", {
|
|
8531
|
+
* updateFields: [{ id: "<fieldId>", displayName: "Unit Price", isRequired: true }],
|
|
8532
|
+
* displayName: "Price Catalog",
|
|
8533
|
+
* });
|
|
8534
|
+
* ```
|
|
8535
|
+
* @internal
|
|
8536
|
+
*/
|
|
8537
|
+
async updateById(id, options) {
|
|
8538
|
+
const opts = options ?? {};
|
|
8539
|
+
const hasSchemaChanges = !!(opts.addFields?.length || opts.removeFields?.length || opts.updateFields?.length);
|
|
8540
|
+
const hasMetadataChanges = opts.displayName !== undefined || opts.description !== undefined || opts.isRbacEnabled !== undefined;
|
|
8541
|
+
if (hasSchemaChanges) {
|
|
8542
|
+
await this.applySchemaUpdate(id, opts);
|
|
8543
|
+
}
|
|
8544
|
+
if (hasMetadataChanges) {
|
|
8545
|
+
await this.patch(DATA_FABRIC_ENDPOINTS.ENTITY.UPDATE_METADATA(id), {
|
|
8546
|
+
...(opts.displayName !== undefined && { displayName: opts.displayName }),
|
|
8547
|
+
...(opts.description !== undefined && { description: opts.description }),
|
|
8548
|
+
...(opts.isRbacEnabled !== undefined && { isRbacEnabled: opts.isRbacEnabled }),
|
|
8549
|
+
});
|
|
8550
|
+
}
|
|
8551
|
+
}
|
|
8552
|
+
/**
|
|
8553
|
+
* Fetches the current entity schema, applies the field delta, then posts the full updated schema.
|
|
8554
|
+
*
|
|
8555
|
+
* @param entityId - UUID of the entity to update
|
|
8556
|
+
* @param options - Field changes to apply
|
|
8557
|
+
* @private
|
|
8558
|
+
*/
|
|
8559
|
+
async applySchemaUpdate(entityId, options) {
|
|
8560
|
+
const entityResponse = await this.get(DATA_FABRIC_ENDPOINTS.ENTITY.GET_BY_ID(entityId));
|
|
8561
|
+
const raw = entityResponse.data;
|
|
8562
|
+
// Carry forward existing non-system fields from GET response (skip system/primary-key fields)
|
|
8563
|
+
let fields = (raw.fields ?? [])
|
|
8564
|
+
.filter(f => !f.isSystemField && !f.isPrimaryKey);
|
|
8565
|
+
// Filter out removed fields
|
|
8566
|
+
if (options.removeFields?.length) {
|
|
8567
|
+
const removeSet = new Set(options.removeFields.map(r => r.fieldName));
|
|
8568
|
+
fields = fields.filter(f => !removeSet.has(f.name));
|
|
8569
|
+
}
|
|
8570
|
+
// Apply per-field metadata updates (matched by field ID)
|
|
8571
|
+
if (options.updateFields?.length) {
|
|
8572
|
+
const updateMap = new Map(options.updateFields.map(u => [u.id, u]));
|
|
8573
|
+
fields = fields.map(f => {
|
|
8574
|
+
const update = updateMap.get(f.id ?? '');
|
|
8575
|
+
if (!update)
|
|
8576
|
+
return f;
|
|
8577
|
+
return {
|
|
8578
|
+
...f,
|
|
8579
|
+
...(update.displayName !== undefined && { displayName: update.displayName }),
|
|
8580
|
+
...(update.description !== undefined && { description: update.description }),
|
|
8581
|
+
...(update.isRequired !== undefined && { isRequired: update.isRequired }),
|
|
8582
|
+
...(update.isUnique !== undefined && { isUnique: update.isUnique }),
|
|
8583
|
+
...(update.isRbacEnabled !== undefined && { isRbacEnabled: update.isRbacEnabled }),
|
|
8584
|
+
...(update.isEncrypted !== undefined && { isEncrypted: update.isEncrypted }),
|
|
8585
|
+
...(update.defaultValue !== undefined && { defaultValue: update.defaultValue }),
|
|
8586
|
+
};
|
|
8587
|
+
});
|
|
8588
|
+
}
|
|
8589
|
+
// Build and append new fields
|
|
8590
|
+
const newFields = [];
|
|
8591
|
+
if (options.addFields?.length) {
|
|
8592
|
+
for (const field of options.addFields) {
|
|
8593
|
+
this.validateName(field.fieldName, 'field');
|
|
8594
|
+
}
|
|
8595
|
+
newFields.push(...options.addFields.map(f => this.buildSchemaFieldPayload(f)));
|
|
8596
|
+
}
|
|
8597
|
+
await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPSERT, {
|
|
8598
|
+
displayName: raw.displayName,
|
|
8599
|
+
description: raw.description,
|
|
8600
|
+
entityDefinition: {
|
|
8601
|
+
id: entityId,
|
|
8602
|
+
name: raw.name,
|
|
8603
|
+
fields: [...fields, ...newFields],
|
|
8604
|
+
folderId: raw.folderId ?? DATA_FABRIC_TENANT_FOLDER_ID,
|
|
8605
|
+
isRbacEnabled: raw.isRbacEnabled ?? false,
|
|
8606
|
+
isInsightsEnabled: raw.isInsightsEnabled ?? false,
|
|
8607
|
+
externalFields: raw.externalFields ?? [],
|
|
8608
|
+
},
|
|
8609
|
+
});
|
|
8275
8610
|
}
|
|
8276
8611
|
/**
|
|
8277
8612
|
* Orchestrates all field mapping transformations
|
|
@@ -8295,11 +8630,20 @@ class EntityService extends BaseService {
|
|
|
8295
8630
|
metadata.fields = metadata.fields.map(field => {
|
|
8296
8631
|
// Rename sqlType to fieldDataType
|
|
8297
8632
|
let transformedField = transformData(field, EntityMap);
|
|
8298
|
-
// Map
|
|
8633
|
+
// Map field type: prefer fieldDisplayType for types that share SQL types (File, ChoiceSet, AutoNumber)
|
|
8299
8634
|
if (transformedField.fieldDataType?.name) {
|
|
8300
|
-
const
|
|
8301
|
-
|
|
8302
|
-
|
|
8635
|
+
const displayTypeMapped = transformedField.fieldDisplayType
|
|
8636
|
+
? FieldDisplayTypeToDataType[transformedField.fieldDisplayType]
|
|
8637
|
+
: undefined;
|
|
8638
|
+
if (displayTypeMapped) {
|
|
8639
|
+
transformedField.fieldDataType.name = displayTypeMapped;
|
|
8640
|
+
}
|
|
8641
|
+
else {
|
|
8642
|
+
const rawSqlTypeName = field.sqlType?.name;
|
|
8643
|
+
const mapped = rawSqlTypeName ? EntityFieldTypeMap[rawSqlTypeName] : undefined;
|
|
8644
|
+
if (mapped) {
|
|
8645
|
+
transformedField.fieldDataType.name = mapped;
|
|
8646
|
+
}
|
|
8303
8647
|
}
|
|
8304
8648
|
}
|
|
8305
8649
|
this.transformNestedReferences(transformedField);
|
|
@@ -8343,7 +8687,44 @@ class EntityService extends BaseService {
|
|
|
8343
8687
|
return externalSource;
|
|
8344
8688
|
});
|
|
8345
8689
|
}
|
|
8690
|
+
/** Converts a user-facing EntityCreateFieldOptions to the raw API field payload */
|
|
8691
|
+
buildSchemaFieldPayload(field) {
|
|
8692
|
+
this.validateName(field.fieldName, 'field');
|
|
8693
|
+
const mapping = EntitySchemaFieldTypeMap[field.type ?? exports.EntityFieldDataType.STRING];
|
|
8694
|
+
return {
|
|
8695
|
+
name: field.fieldName,
|
|
8696
|
+
displayName: field.displayName ?? field.fieldName,
|
|
8697
|
+
sqlType: { name: mapping.sqlTypeName },
|
|
8698
|
+
fieldDisplayType: mapping.fieldDisplayType,
|
|
8699
|
+
description: field.description ?? '',
|
|
8700
|
+
isRequired: field.isRequired ?? false,
|
|
8701
|
+
isUnique: field.isUnique ?? false,
|
|
8702
|
+
isRbacEnabled: field.isRbacEnabled ?? false,
|
|
8703
|
+
isEncrypted: field.isEncrypted ?? false,
|
|
8704
|
+
...(field.defaultValue !== undefined && { defaultValue: field.defaultValue }),
|
|
8705
|
+
...(field.choiceSetId !== undefined && { choiceSetId: field.choiceSetId }),
|
|
8706
|
+
...(field.referenceEntityName !== undefined && { referenceEntityName: field.referenceEntityName }),
|
|
8707
|
+
...(field.referenceFieldName !== undefined && { referenceFieldName: field.referenceFieldName }),
|
|
8708
|
+
};
|
|
8709
|
+
}
|
|
8710
|
+
validateName(name, context) {
|
|
8711
|
+
if (name.length < 3 || name.length > 100 || !/^[a-zA-Z]\w*$/.test(name)) {
|
|
8712
|
+
const suggestion = name.replace(/\W/g, '').replace(/^[0-9_]+/, '');
|
|
8713
|
+
const defaultName = `My${context.charAt(0).toUpperCase() + context.slice(1)}`;
|
|
8714
|
+
throw new ValidationError({
|
|
8715
|
+
message: `Invalid ${context} name '${name}'. Must start with a letter, contain only letters, numbers, and underscores, 3–100 characters (e.g., "${suggestion || defaultName}").`
|
|
8716
|
+
});
|
|
8717
|
+
}
|
|
8718
|
+
if (context === 'field' && EntityService.RESERVED_FIELD_NAMES.has(name)) {
|
|
8719
|
+
throw new ValidationError({
|
|
8720
|
+
message: `Field name '${name}' is reserved. Reserved names: ${[...EntityService.RESERVED_FIELD_NAMES].join(', ')}.`
|
|
8721
|
+
});
|
|
8722
|
+
}
|
|
8723
|
+
}
|
|
8346
8724
|
}
|
|
8725
|
+
EntityService.RESERVED_FIELD_NAMES = new Set([
|
|
8726
|
+
'Id', 'CreatedBy', 'CreateTime', 'UpdatedBy', 'UpdateTime'
|
|
8727
|
+
]);
|
|
8347
8728
|
__decorate([
|
|
8348
8729
|
track('Entities.GetById')
|
|
8349
8730
|
], EntityService.prototype, "getById", null);
|
|
@@ -8371,6 +8752,12 @@ __decorate([
|
|
|
8371
8752
|
__decorate([
|
|
8372
8753
|
track('Entities.GetAll')
|
|
8373
8754
|
], EntityService.prototype, "getAll", null);
|
|
8755
|
+
__decorate([
|
|
8756
|
+
track('Entities.QueryRecordsById')
|
|
8757
|
+
], EntityService.prototype, "queryRecordsById", null);
|
|
8758
|
+
__decorate([
|
|
8759
|
+
track('Entities.ImportRecordsById')
|
|
8760
|
+
], EntityService.prototype, "importRecordsById", null);
|
|
8374
8761
|
__decorate([
|
|
8375
8762
|
track('Entities.DownloadAttachment')
|
|
8376
8763
|
], EntityService.prototype, "downloadAttachment", null);
|
|
@@ -8380,6 +8767,15 @@ __decorate([
|
|
|
8380
8767
|
__decorate([
|
|
8381
8768
|
track('Entities.DeleteAttachment')
|
|
8382
8769
|
], EntityService.prototype, "deleteAttachment", null);
|
|
8770
|
+
__decorate([
|
|
8771
|
+
track('Entities.Create')
|
|
8772
|
+
], EntityService.prototype, "create", null);
|
|
8773
|
+
__decorate([
|
|
8774
|
+
track('Entities.DeleteById')
|
|
8775
|
+
], EntityService.prototype, "deleteById", null);
|
|
8776
|
+
__decorate([
|
|
8777
|
+
track('Entities.UpdateById')
|
|
8778
|
+
], EntityService.prototype, "updateById", null);
|
|
8383
8779
|
|
|
8384
8780
|
class ChoiceSetService extends BaseService {
|
|
8385
8781
|
/**
|
|
@@ -11110,6 +11506,50 @@ class JobService extends FolderScopedService {
|
|
|
11110
11506
|
},
|
|
11111
11507
|
}, options);
|
|
11112
11508
|
}
|
|
11509
|
+
/**
|
|
11510
|
+
* Gets a job by its unique key (GUID).
|
|
11511
|
+
*
|
|
11512
|
+
* Returns the full job details including state, timing, input/output arguments, and error information.
|
|
11513
|
+
* Use `expand` to include related entities like `robot`, or `machine`.
|
|
11514
|
+
*
|
|
11515
|
+
* @param id - The unique key (GUID) of the job to retrieve
|
|
11516
|
+
* @param folderId - The folder ID where the job resides
|
|
11517
|
+
* @param options - Optional query options for expanding or selecting fields
|
|
11518
|
+
* @returns Promise resolving to a {@link JobGetResponse} with full job details and bound methods
|
|
11519
|
+
*
|
|
11520
|
+
* @example
|
|
11521
|
+
* ```typescript
|
|
11522
|
+
* // Get a job by key
|
|
11523
|
+
* const job = await jobs.getById(<id>, <folderId>);
|
|
11524
|
+
* console.log(job.state, job.processName);
|
|
11525
|
+
* ```
|
|
11526
|
+
*
|
|
11527
|
+
* @example
|
|
11528
|
+
* ```typescript
|
|
11529
|
+
* // With expanded related entities
|
|
11530
|
+
* const job = await jobs.getById(<id>, <folderId>, {
|
|
11531
|
+
* expand: 'robot,machine'
|
|
11532
|
+
* });
|
|
11533
|
+
* console.log(job.robot?.name, job.machine?.name);
|
|
11534
|
+
* ```
|
|
11535
|
+
*/
|
|
11536
|
+
async getById(id, folderId, options) {
|
|
11537
|
+
if (!id) {
|
|
11538
|
+
throw new ValidationError({ message: 'id is required for getById' });
|
|
11539
|
+
}
|
|
11540
|
+
if (!folderId) {
|
|
11541
|
+
throw new ValidationError({ message: 'folderId is required for getById' });
|
|
11542
|
+
}
|
|
11543
|
+
const headers = createHeaders({ [FOLDER_ID]: folderId });
|
|
11544
|
+
const keysToPrefix = Object.keys(options ?? {});
|
|
11545
|
+
const apiOptions = options ? addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix) : {};
|
|
11546
|
+
const response = await this.get(JOB_ENDPOINTS.GET_BY_KEY(id), {
|
|
11547
|
+
params: apiOptions,
|
|
11548
|
+
headers,
|
|
11549
|
+
});
|
|
11550
|
+
const rawJob = transformData(pascalToCamelCaseKeys(response.data), JobMap);
|
|
11551
|
+
return createJobWithMethods(rawJob, this);
|
|
11552
|
+
}
|
|
11113
11553
|
/**
|
|
11114
11554
|
* Gets the output of a completed job.
|
|
11115
11555
|
*
|
|
@@ -11146,34 +11586,20 @@ class JobService extends FolderScopedService {
|
|
|
11146
11586
|
if (!jobKey) {
|
|
11147
11587
|
throw new ValidationError({ message: 'jobKey is required for getOutput' });
|
|
11148
11588
|
}
|
|
11149
|
-
const job = await this.
|
|
11150
|
-
if (job.
|
|
11589
|
+
const job = await this.getById(jobKey, folderId, { select: 'outputArguments,outputFile' });
|
|
11590
|
+
if (job.outputArguments) {
|
|
11151
11591
|
try {
|
|
11152
|
-
return JSON.parse(job.
|
|
11592
|
+
return JSON.parse(job.outputArguments);
|
|
11153
11593
|
}
|
|
11154
11594
|
catch {
|
|
11155
11595
|
throw new ServerError({ message: 'Failed to parse job output arguments as JSON' });
|
|
11156
11596
|
}
|
|
11157
11597
|
}
|
|
11158
|
-
if (job.
|
|
11159
|
-
return this.downloadOutputFile(job.
|
|
11598
|
+
if (job.outputFile) {
|
|
11599
|
+
return this.downloadOutputFile(job.outputFile);
|
|
11160
11600
|
}
|
|
11161
11601
|
return null;
|
|
11162
11602
|
}
|
|
11163
|
-
/**
|
|
11164
|
-
* Fetches a job by its Key (GUID) using the GetByKey endpoint.
|
|
11165
|
-
* Only selects fields needed for output extraction.
|
|
11166
|
-
*/
|
|
11167
|
-
async fetchJobByKey(jobKey, folderId) {
|
|
11168
|
-
const headers = createHeaders({ [FOLDER_ID]: folderId });
|
|
11169
|
-
const response = await this.get(JOB_ENDPOINTS.GET_BY_KEY(jobKey), {
|
|
11170
|
-
params: {
|
|
11171
|
-
$select: 'OutputArguments,OutputFile',
|
|
11172
|
-
},
|
|
11173
|
-
headers,
|
|
11174
|
-
});
|
|
11175
|
-
return response.data;
|
|
11176
|
-
}
|
|
11177
11603
|
/**
|
|
11178
11604
|
* Downloads the output file content via the Attachments API.
|
|
11179
11605
|
* 1. Fetches blob access info from the attachment using AttachmentService
|
|
@@ -11212,6 +11638,9 @@ class JobService extends FolderScopedService {
|
|
|
11212
11638
|
__decorate([
|
|
11213
11639
|
track('Jobs.GetAll')
|
|
11214
11640
|
], JobService.prototype, "getAll", null);
|
|
11641
|
+
__decorate([
|
|
11642
|
+
track('Jobs.GetById')
|
|
11643
|
+
], JobService.prototype, "getById", null);
|
|
11215
11644
|
__decorate([
|
|
11216
11645
|
track('Jobs.GetOutput')
|
|
11217
11646
|
], JobService.prototype, "getOutput", null);
|