@uipath/uipath-typescript 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +7 -5
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.mjs +7 -5
- 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 +520 -89
- package/dist/index.d.ts +604 -52
- package/dist/index.mjs +521 -90
- package/dist/index.umd.js +520 -89
- 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}`,
|
|
@@ -4991,6 +5002,7 @@ class TokenManager {
|
|
|
4991
5002
|
}
|
|
4992
5003
|
}
|
|
4993
5004
|
|
|
5005
|
+
const GUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
4994
5006
|
class AuthService {
|
|
4995
5007
|
constructor(config, executionContext) {
|
|
4996
5008
|
// Only use stored OAuth context when completing an active callback (URL has ?code=).
|
|
@@ -5274,6 +5286,8 @@ class AuthService {
|
|
|
5274
5286
|
*/
|
|
5275
5287
|
getAuthorizationUrl(params) {
|
|
5276
5288
|
const orgName = this.config.orgName;
|
|
5289
|
+
const isGuid = GUID_REGEX.test(orgName);
|
|
5290
|
+
const acrValues = isGuid ? `tenant:${orgName}` : `tenantName:${orgName}`;
|
|
5277
5291
|
const queryParams = new URLSearchParams({
|
|
5278
5292
|
response_type: 'code',
|
|
5279
5293
|
client_id: params.clientId,
|
|
@@ -5283,13 +5297,12 @@ class AuthService {
|
|
|
5283
5297
|
scope: params.scope + ' offline_access',
|
|
5284
5298
|
state: params.state || this.generateCodeVerifier().slice(0, 16)
|
|
5285
5299
|
});
|
|
5286
|
-
return `${this.config.baseUrl}/${
|
|
5300
|
+
return `${this.config.baseUrl}/${IDENTITY_ENDPOINTS.AUTHORIZE}?${queryParams.toString()}&acr_values=${acrValues}`;
|
|
5287
5301
|
}
|
|
5288
5302
|
/**
|
|
5289
5303
|
* Exchanges the authorization code for an access token and automatically updates the current token
|
|
5290
5304
|
*/
|
|
5291
5305
|
async _getAccessToken(params) {
|
|
5292
|
-
const orgName = this.config.orgName;
|
|
5293
5306
|
const body = new URLSearchParams({
|
|
5294
5307
|
grant_type: 'authorization_code',
|
|
5295
5308
|
client_id: params.clientId,
|
|
@@ -5297,7 +5310,7 @@ class AuthService {
|
|
|
5297
5310
|
redirect_uri: params.redirectUri,
|
|
5298
5311
|
code_verifier: params.codeVerifier
|
|
5299
5312
|
});
|
|
5300
|
-
const response = await fetch(`${this.config.baseUrl}/${
|
|
5313
|
+
const response = await fetch(`${this.config.baseUrl}/${IDENTITY_ENDPOINTS.TOKEN}`, {
|
|
5301
5314
|
method: 'POST',
|
|
5302
5315
|
headers: {
|
|
5303
5316
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
@@ -5418,7 +5431,7 @@ function normalizeBaseUrl(url) {
|
|
|
5418
5431
|
// Connection string placeholder that will be replaced during build
|
|
5419
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";
|
|
5420
5433
|
// SDK Version placeholder
|
|
5421
|
-
const SDK_VERSION = "1.3.
|
|
5434
|
+
const SDK_VERSION = "1.3.2";
|
|
5422
5435
|
const VERSION = "Version";
|
|
5423
5436
|
const SERVICE = "Service";
|
|
5424
5437
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -5807,7 +5820,7 @@ var _UiPath_instances, _UiPath_config, _UiPath_authService, _UiPath_initialized,
|
|
|
5807
5820
|
*
|
|
5808
5821
|
* Supports two usage patterns:
|
|
5809
5822
|
* 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
|
|
5823
|
+
* 2. No config / partial config — loads from meta tags injected by @uipath/coded-apps-dev plugin
|
|
5811
5824
|
*
|
|
5812
5825
|
* @example
|
|
5813
5826
|
* ```typescript
|
|
@@ -6273,15 +6286,11 @@ const RESPONSE_TYPES = {
|
|
|
6273
6286
|
|
|
6274
6287
|
class ApiClient {
|
|
6275
6288
|
constructor(config, executionContext, tokenManager, clientConfig = {}) {
|
|
6276
|
-
this.defaultHeaders = {};
|
|
6277
6289
|
this.config = config;
|
|
6278
6290
|
this.executionContext = executionContext;
|
|
6279
6291
|
this.clientConfig = clientConfig;
|
|
6280
6292
|
this.tokenManager = tokenManager;
|
|
6281
6293
|
}
|
|
6282
|
-
setDefaultHeaders(headers) {
|
|
6283
|
-
this.defaultHeaders = { ...this.defaultHeaders, ...headers };
|
|
6284
|
-
}
|
|
6285
6294
|
/**
|
|
6286
6295
|
* Gets a valid authentication token, refreshing if necessary.
|
|
6287
6296
|
* Used internally for API requests and exposed for services that need manual auth headers.
|
|
@@ -6297,7 +6306,6 @@ class ApiClient {
|
|
|
6297
6306
|
return {
|
|
6298
6307
|
'Authorization': `Bearer ${token}`,
|
|
6299
6308
|
'Content-Type': CONTENT_TYPES.JSON,
|
|
6300
|
-
...this.defaultHeaders,
|
|
6301
6309
|
...this.clientConfig.headers
|
|
6302
6310
|
};
|
|
6303
6311
|
}
|
|
@@ -7353,6 +7361,8 @@ class BaseService {
|
|
|
7353
7361
|
*
|
|
7354
7362
|
* @param instance - UiPath SDK instance providing authentication and configuration.
|
|
7355
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)
|
|
7356
7366
|
*
|
|
7357
7367
|
* @example
|
|
7358
7368
|
* ```typescript
|
|
@@ -7372,11 +7382,11 @@ class BaseService {
|
|
|
7372
7382
|
* const entities = new Entities(sdk);
|
|
7373
7383
|
* ```
|
|
7374
7384
|
*/
|
|
7375
|
-
constructor(instance) {
|
|
7385
|
+
constructor(instance, headers) {
|
|
7376
7386
|
// Private field - not visible via Object.keys() or any reflection
|
|
7377
7387
|
_BaseService_apiClient.set(this, void 0);
|
|
7378
7388
|
const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
|
|
7379
|
-
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager), "f");
|
|
7389
|
+
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
|
|
7380
7390
|
}
|
|
7381
7391
|
/**
|
|
7382
7392
|
* Gets a valid authentication token, refreshing if necessary.
|
|
@@ -7635,27 +7645,41 @@ function createEntityMethods(entityData, service) {
|
|
|
7635
7645
|
throw new Error('Entity ID is undefined');
|
|
7636
7646
|
return service.deleteAttachment(entityData.id, recordId, fieldName);
|
|
7637
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
|
+
},
|
|
7638
7658
|
async insert(data, options) {
|
|
7639
7659
|
return this.insertRecord(data, options);
|
|
7640
7660
|
},
|
|
7641
7661
|
async batchInsert(data, options) {
|
|
7642
7662
|
return this.insertRecords(data, options);
|
|
7643
7663
|
},
|
|
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
7664
|
async getRecords(options) {
|
|
7651
7665
|
return this.getAllRecords(options);
|
|
7652
|
-
}
|
|
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
|
+
},
|
|
7653
7677
|
};
|
|
7654
7678
|
}
|
|
7655
7679
|
/**
|
|
7656
|
-
* Creates an actionable entity
|
|
7680
|
+
* Creates an actionable entity by combining entity metadata with data and management methods
|
|
7657
7681
|
*
|
|
7658
|
-
* @param
|
|
7682
|
+
* @param entityMetadata - Entity metadata
|
|
7659
7683
|
* @param service - The entity service instance
|
|
7660
7684
|
* @returns Entity metadata with added methods
|
|
7661
7685
|
*/
|
|
@@ -7665,42 +7689,7 @@ function createEntityWithMethods(entityData, service) {
|
|
|
7665
7689
|
}
|
|
7666
7690
|
|
|
7667
7691
|
/**
|
|
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
|
|
7692
|
+
* Entity field data type names (SQL-level types returned by the API)
|
|
7704
7693
|
*/
|
|
7705
7694
|
var EntityFieldDataType;
|
|
7706
7695
|
(function (EntityFieldDataType) {
|
|
@@ -7716,7 +7705,41 @@ var EntityFieldDataType;
|
|
|
7716
7705
|
EntityFieldDataType["BOOLEAN"] = "BOOLEAN";
|
|
7717
7706
|
EntityFieldDataType["BIG_INTEGER"] = "BIG_INTEGER";
|
|
7718
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";
|
|
7719
7713
|
})(EntityFieldDataType || (EntityFieldDataType = {}));
|
|
7714
|
+
/**
|
|
7715
|
+
* Logical operator for combining query filter groups
|
|
7716
|
+
*/
|
|
7717
|
+
var LogicalOperator;
|
|
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
|
+
})(LogicalOperator || (LogicalOperator = {}));
|
|
7724
|
+
/**
|
|
7725
|
+
* Comparison operators for entity query filters.
|
|
7726
|
+
* Not all operators are valid for all field types.
|
|
7727
|
+
*/
|
|
7728
|
+
var QueryFilterOperator;
|
|
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
|
+
})(QueryFilterOperator || (QueryFilterOperator = {}));
|
|
7720
7743
|
/**
|
|
7721
7744
|
* Entity type enum
|
|
7722
7745
|
*/
|
|
@@ -7762,6 +7785,41 @@ var JoinType;
|
|
|
7762
7785
|
JoinType["LeftJoin"] = "LeftJoin";
|
|
7763
7786
|
})(JoinType || (JoinType = {}));
|
|
7764
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
|
+
|
|
7765
7823
|
/**
|
|
7766
7824
|
* Entity field data types (SQL types from API)
|
|
7767
7825
|
*/
|
|
@@ -7780,6 +7838,7 @@ var SqlFieldType;
|
|
|
7780
7838
|
SqlFieldType["DECIMAL"] = "DECIMAL";
|
|
7781
7839
|
SqlFieldType["MULTILINE"] = "MULTILINE";
|
|
7782
7840
|
})(SqlFieldType || (SqlFieldType = {}));
|
|
7841
|
+
|
|
7783
7842
|
/**
|
|
7784
7843
|
* Maps fields for Entities
|
|
7785
7844
|
*/
|
|
@@ -7789,6 +7848,40 @@ const EntityMap = {
|
|
|
7789
7848
|
sqlType: 'fieldDataType',
|
|
7790
7849
|
fieldDefinition: 'fieldMetaData'
|
|
7791
7850
|
};
|
|
7851
|
+
/**
|
|
7852
|
+
* Maps EntityFieldDataType values to the API field payload components for create/update operations
|
|
7853
|
+
*/
|
|
7854
|
+
const EntitySchemaFieldTypeMap = {
|
|
7855
|
+
[EntityFieldDataType.UUID]: { sqlTypeName: SqlFieldType.UNIQUEIDENTIFIER, fieldDisplayType: FieldDisplayType.Basic },
|
|
7856
|
+
[EntityFieldDataType.STRING]: { sqlTypeName: SqlFieldType.NVARCHAR, fieldDisplayType: FieldDisplayType.Basic },
|
|
7857
|
+
[EntityFieldDataType.INTEGER]: { sqlTypeName: SqlFieldType.INT, fieldDisplayType: FieldDisplayType.Basic },
|
|
7858
|
+
[EntityFieldDataType.DATETIME]: { sqlTypeName: SqlFieldType.DATETIME2, fieldDisplayType: FieldDisplayType.Basic },
|
|
7859
|
+
[EntityFieldDataType.DATETIME_WITH_TZ]: { sqlTypeName: SqlFieldType.DATETIMEOFFSET, fieldDisplayType: FieldDisplayType.Basic },
|
|
7860
|
+
[EntityFieldDataType.DECIMAL]: { sqlTypeName: SqlFieldType.DECIMAL, fieldDisplayType: FieldDisplayType.Basic },
|
|
7861
|
+
[EntityFieldDataType.FLOAT]: { sqlTypeName: SqlFieldType.FLOAT, fieldDisplayType: FieldDisplayType.Basic },
|
|
7862
|
+
[EntityFieldDataType.DOUBLE]: { sqlTypeName: SqlFieldType.REAL, fieldDisplayType: FieldDisplayType.Basic },
|
|
7863
|
+
[EntityFieldDataType.DATE]: { sqlTypeName: SqlFieldType.DATE, fieldDisplayType: FieldDisplayType.Basic },
|
|
7864
|
+
[EntityFieldDataType.BOOLEAN]: { sqlTypeName: SqlFieldType.BIT, fieldDisplayType: FieldDisplayType.Basic },
|
|
7865
|
+
[EntityFieldDataType.BIG_INTEGER]: { sqlTypeName: SqlFieldType.BIGINT, fieldDisplayType: FieldDisplayType.Basic },
|
|
7866
|
+
[EntityFieldDataType.MULTILINE_TEXT]: { sqlTypeName: SqlFieldType.MULTILINE, fieldDisplayType: FieldDisplayType.Basic },
|
|
7867
|
+
[EntityFieldDataType.FILE]: { sqlTypeName: SqlFieldType.UNIQUEIDENTIFIER, fieldDisplayType: FieldDisplayType.File },
|
|
7868
|
+
[EntityFieldDataType.CHOICE_SET_SINGLE]: { sqlTypeName: SqlFieldType.INT, fieldDisplayType: FieldDisplayType.ChoiceSetSingle },
|
|
7869
|
+
[EntityFieldDataType.CHOICE_SET_MULTIPLE]: { sqlTypeName: SqlFieldType.NVARCHAR, fieldDisplayType: FieldDisplayType.ChoiceSetMultiple },
|
|
7870
|
+
[EntityFieldDataType.AUTO_NUMBER]: { sqlTypeName: SqlFieldType.DECIMAL, fieldDisplayType: FieldDisplayType.AutoNumber },
|
|
7871
|
+
[EntityFieldDataType.RELATIONSHIP]: { sqlTypeName: SqlFieldType.UNIQUEIDENTIFIER, fieldDisplayType: 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
|
+
[FieldDisplayType.File]: EntityFieldDataType.FILE,
|
|
7880
|
+
[FieldDisplayType.ChoiceSetSingle]: EntityFieldDataType.CHOICE_SET_SINGLE,
|
|
7881
|
+
[FieldDisplayType.ChoiceSetMultiple]: EntityFieldDataType.CHOICE_SET_MULTIPLE,
|
|
7882
|
+
[FieldDisplayType.AutoNumber]: EntityFieldDataType.AUTO_NUMBER,
|
|
7883
|
+
[FieldDisplayType.Relationship]: EntityFieldDataType.RELATIONSHIP,
|
|
7884
|
+
};
|
|
7792
7885
|
/**
|
|
7793
7886
|
* Maps SQL field types to friendly display names
|
|
7794
7887
|
*/
|
|
@@ -7804,7 +7897,7 @@ const EntityFieldTypeMap = {
|
|
|
7804
7897
|
[SqlFieldType.DATE]: EntityFieldDataType.DATE,
|
|
7805
7898
|
[SqlFieldType.BIT]: EntityFieldDataType.BOOLEAN,
|
|
7806
7899
|
[SqlFieldType.DECIMAL]: EntityFieldDataType.DECIMAL,
|
|
7807
|
-
[SqlFieldType.MULTILINE]: EntityFieldDataType.MULTILINE_TEXT
|
|
7900
|
+
[SqlFieldType.MULTILINE]: EntityFieldDataType.MULTILINE_TEXT,
|
|
7808
7901
|
};
|
|
7809
7902
|
|
|
7810
7903
|
/**
|
|
@@ -8134,6 +8227,99 @@ class EntityService extends BaseService {
|
|
|
8134
8227
|
});
|
|
8135
8228
|
return entities;
|
|
8136
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
|
+
}
|
|
8137
8323
|
/**
|
|
8138
8324
|
* Downloads an attachment from an entity record field
|
|
8139
8325
|
*
|
|
@@ -8258,18 +8444,169 @@ class EntityService extends BaseService {
|
|
|
8258
8444
|
return this.insertRecordsById(id, data, options);
|
|
8259
8445
|
}
|
|
8260
8446
|
/**
|
|
8261
|
-
*
|
|
8262
|
-
*
|
|
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
|
|
8263
8463
|
*/
|
|
8264
|
-
async
|
|
8265
|
-
|
|
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;
|
|
8266
8484
|
}
|
|
8267
8485
|
/**
|
|
8268
|
-
*
|
|
8269
|
-
*
|
|
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
|
|
8496
|
+
*/
|
|
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
|
|
8270
8558
|
*/
|
|
8271
|
-
async
|
|
8272
|
-
|
|
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
|
+
});
|
|
8273
8610
|
}
|
|
8274
8611
|
/**
|
|
8275
8612
|
* Orchestrates all field mapping transformations
|
|
@@ -8293,11 +8630,20 @@ class EntityService extends BaseService {
|
|
|
8293
8630
|
metadata.fields = metadata.fields.map(field => {
|
|
8294
8631
|
// Rename sqlType to fieldDataType
|
|
8295
8632
|
let transformedField = transformData(field, EntityMap);
|
|
8296
|
-
// Map
|
|
8633
|
+
// Map field type: prefer fieldDisplayType for types that share SQL types (File, ChoiceSet, AutoNumber)
|
|
8297
8634
|
if (transformedField.fieldDataType?.name) {
|
|
8298
|
-
const
|
|
8299
|
-
|
|
8300
|
-
|
|
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
|
+
}
|
|
8301
8647
|
}
|
|
8302
8648
|
}
|
|
8303
8649
|
this.transformNestedReferences(transformedField);
|
|
@@ -8341,7 +8687,44 @@ class EntityService extends BaseService {
|
|
|
8341
8687
|
return externalSource;
|
|
8342
8688
|
});
|
|
8343
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 ?? 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
|
+
}
|
|
8344
8724
|
}
|
|
8725
|
+
EntityService.RESERVED_FIELD_NAMES = new Set([
|
|
8726
|
+
'Id', 'CreatedBy', 'CreateTime', 'UpdatedBy', 'UpdateTime'
|
|
8727
|
+
]);
|
|
8345
8728
|
__decorate([
|
|
8346
8729
|
track('Entities.GetById')
|
|
8347
8730
|
], EntityService.prototype, "getById", null);
|
|
@@ -8369,6 +8752,12 @@ __decorate([
|
|
|
8369
8752
|
__decorate([
|
|
8370
8753
|
track('Entities.GetAll')
|
|
8371
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);
|
|
8372
8761
|
__decorate([
|
|
8373
8762
|
track('Entities.DownloadAttachment')
|
|
8374
8763
|
], EntityService.prototype, "downloadAttachment", null);
|
|
@@ -8378,6 +8767,15 @@ __decorate([
|
|
|
8378
8767
|
__decorate([
|
|
8379
8768
|
track('Entities.DeleteAttachment')
|
|
8380
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);
|
|
8381
8779
|
|
|
8382
8780
|
class ChoiceSetService extends BaseService {
|
|
8383
8781
|
/**
|
|
@@ -11108,6 +11506,50 @@ class JobService extends FolderScopedService {
|
|
|
11108
11506
|
},
|
|
11109
11507
|
}, options);
|
|
11110
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
|
+
}
|
|
11111
11553
|
/**
|
|
11112
11554
|
* Gets the output of a completed job.
|
|
11113
11555
|
*
|
|
@@ -11144,34 +11586,20 @@ class JobService extends FolderScopedService {
|
|
|
11144
11586
|
if (!jobKey) {
|
|
11145
11587
|
throw new ValidationError({ message: 'jobKey is required for getOutput' });
|
|
11146
11588
|
}
|
|
11147
|
-
const job = await this.
|
|
11148
|
-
if (job.
|
|
11589
|
+
const job = await this.getById(jobKey, folderId, { select: 'outputArguments,outputFile' });
|
|
11590
|
+
if (job.outputArguments) {
|
|
11149
11591
|
try {
|
|
11150
|
-
return JSON.parse(job.
|
|
11592
|
+
return JSON.parse(job.outputArguments);
|
|
11151
11593
|
}
|
|
11152
11594
|
catch {
|
|
11153
11595
|
throw new ServerError({ message: 'Failed to parse job output arguments as JSON' });
|
|
11154
11596
|
}
|
|
11155
11597
|
}
|
|
11156
|
-
if (job.
|
|
11157
|
-
return this.downloadOutputFile(job.
|
|
11598
|
+
if (job.outputFile) {
|
|
11599
|
+
return this.downloadOutputFile(job.outputFile);
|
|
11158
11600
|
}
|
|
11159
11601
|
return null;
|
|
11160
11602
|
}
|
|
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
11603
|
/**
|
|
11176
11604
|
* Downloads the output file content via the Attachments API.
|
|
11177
11605
|
* 1. Fetches blob access info from the attachment using AttachmentService
|
|
@@ -11210,6 +11638,9 @@ class JobService extends FolderScopedService {
|
|
|
11210
11638
|
__decorate([
|
|
11211
11639
|
track('Jobs.GetAll')
|
|
11212
11640
|
], JobService.prototype, "getAll", null);
|
|
11641
|
+
__decorate([
|
|
11642
|
+
track('Jobs.GetById')
|
|
11643
|
+
], JobService.prototype, "getById", null);
|
|
11213
11644
|
__decorate([
|
|
11214
11645
|
track('Jobs.GetOutput')
|
|
11215
11646
|
], JobService.prototype, "getOutput", null);
|
|
@@ -12159,4 +12590,4 @@ function getAppBase() {
|
|
|
12159
12590
|
return getMetaTagContent(UiPathMetaTags.APP_BASE) || '/';
|
|
12160
12591
|
}
|
|
12161
12592
|
|
|
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 };
|
|
12593
|
+
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 };
|