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