@uipath/uipath-typescript 1.3.10 → 1.3.11

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.
@@ -126,6 +126,8 @@ const MAESTRO_ENDPOINTS = {
126
126
  TOP_PROCESSES_BY_RUN_COUNT: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcessesByRunCount`,
127
127
  /** Top processes ranked by failure count */
128
128
  TOP_PROCESSES_WITH_FAILURE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcesseswithFailure`,
129
+ /** Top elements ranked by failure count */
130
+ TOP_ELEMENTS_WITH_FAILURE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopElementswithFailure`,
129
131
  /** Instance status aggregated by date for time-series charts */
130
132
  INSTANCE_STATUS_BY_DATE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/InstanceStatusByDate`,
131
133
  /** Top processes ranked by total duration */
@@ -2111,6 +2113,52 @@ class CasesService extends BaseService {
2111
2113
  const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_RUN_COUNT, buildInsightsTopBody(startTime, endTime, true, options));
2112
2114
  return (data ?? []).map(process => ({ ...process, name: this.extractCaseName(process.packageId) }));
2113
2115
  }
2116
+ /**
2117
+ * Get the top 10 BPMN elements ranked by failure count within a time range.
2118
+ *
2119
+ * Returns an array of up to 10 elements sorted by how many times they failed,
2120
+ * useful for identifying the most error-prone activities in case processes.
2121
+ *
2122
+ * @param startTime - Start of the time range to query
2123
+ * @param endTime - End of the time range to query
2124
+ * @param options - Optional filters (packageId, processKey, version)
2125
+ * @returns Promise resolving to an array of {@link ElementGetTopFailedCountResponse}
2126
+ * @example
2127
+ * ```typescript
2128
+ * import { Cases } from '@uipath/uipath-typescript/cases';
2129
+ *
2130
+ * const cases = new Cases(sdk);
2131
+ *
2132
+ * // Get top failing elements for the last 7 days
2133
+ * const topFailing = await cases.getTopElementFailedCount(
2134
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
2135
+ * new Date()
2136
+ * );
2137
+ *
2138
+ * for (const element of topFailing) {
2139
+ * console.log(`${element.elementName} (${element.elementType}): ${element.failedCount} failures`);
2140
+ * }
2141
+ * ```
2142
+ *
2143
+ * @example
2144
+ * ```typescript
2145
+ * // Get top failing elements for a specific process
2146
+ * const filtered = await cases.getTopElementFailedCount(
2147
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
2148
+ * new Date(),
2149
+ * { processKey: '<processKey>' }
2150
+ * );
2151
+ * ```
2152
+ */
2153
+ async getTopElementFailedCount(startTime, endTime, options) {
2154
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_ELEMENTS_WITH_FAILURE, buildInsightsTopBody(startTime, endTime, true, options));
2155
+ return (data ?? []).map(item => ({
2156
+ elementName: item.elementName,
2157
+ elementType: item.elementType,
2158
+ processKey: item.processKey,
2159
+ failedCount: item.count,
2160
+ }));
2161
+ }
2114
2162
  /**
2115
2163
  * Get all instances status counts aggregated by date for case management processes.
2116
2164
  *
@@ -2266,6 +2314,9 @@ __decorate([
2266
2314
  __decorate([
2267
2315
  track('Cases.GetTopRunCount')
2268
2316
  ], CasesService.prototype, "getTopRunCount", null);
2317
+ __decorate([
2318
+ track('Cases.GetTopElementFailedCount')
2319
+ ], CasesService.prototype, "getTopElementFailedCount", null);
2269
2320
  __decorate([
2270
2321
  track('Cases.GetInstanceStatusTimeline')
2271
2322
  ], CasesService.prototype, "getInstanceStatusTimeline", null);
@@ -39,6 +39,20 @@ interface GetTopFaultedCountResponse extends GetTopBaseResponse {
39
39
  /** Number of faulted instances in the given time range */
40
40
  faultedCount: number;
41
41
  }
42
+ /**
43
+ * SDK response for top elements with failure.
44
+ * Shared by both MaestroProcesses and Cases — no service-specific enrichment.
45
+ */
46
+ interface ElementGetTopFailedCountResponse {
47
+ /** BPMN element name (falls back to element ID if name is empty) */
48
+ elementName: string;
49
+ /** BPMN element type (e.g. ServiceTask, ReceiveTask, IntermediateCatchEvent) */
50
+ elementType: string;
51
+ /** The unique process key this element belongs to */
52
+ processKey: string;
53
+ /** Number of failed executions of this element in the given time range */
54
+ failedCount: number;
55
+ }
42
56
  /**
43
57
  * Time bucketing granularity for insights time-series queries.
44
58
  *
@@ -371,6 +385,44 @@ interface CasesServiceModel {
371
385
  * ```
372
386
  */
373
387
  getTopFaultedCount(startTime: Date, endTime: Date, options?: TopQueryOptions): Promise<CaseGetTopFaultedCountResponse[]>;
388
+ /**
389
+ * Get the top 10 BPMN elements ranked by failure count within a time range.
390
+ *
391
+ * Returns an array of up to 10 elements sorted by how many times they failed,
392
+ * useful for identifying the most error-prone activities in case processes.
393
+ *
394
+ * @param startTime - Start of the time range to query
395
+ * @param endTime - End of the time range to query
396
+ * @param options - Optional filters (packageId, processKey, version)
397
+ * @returns Promise resolving to an array of {@link ElementGetTopFailedCountResponse}
398
+ * @example
399
+ * ```typescript
400
+ * import { Cases } from '@uipath/uipath-typescript/cases';
401
+ *
402
+ * const cases = new Cases(sdk);
403
+ *
404
+ * // Get top failing elements for the last 7 days
405
+ * const topFailing = await cases.getTopElementFailedCount(
406
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
407
+ * new Date()
408
+ * );
409
+ *
410
+ * for (const element of topFailing) {
411
+ * console.log(`${element.elementName} (${element.elementType}): ${element.failedCount} failures`);
412
+ * }
413
+ * ```
414
+ *
415
+ * @example
416
+ * ```typescript
417
+ * // Get top failing elements for a specific process
418
+ * const filtered = await cases.getTopElementFailedCount(
419
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
420
+ * new Date(),
421
+ * { processKey: '<processKey>' }
422
+ * );
423
+ * ```
424
+ */
425
+ getTopElementFailedCount(startTime: Date, endTime: Date, options?: TopQueryOptions): Promise<ElementGetTopFailedCountResponse[]>;
374
426
  /**
375
427
  * Get all instances status counts aggregated by date for case management processes.
376
428
  *
@@ -1759,6 +1811,44 @@ declare class CasesService extends BaseService implements CasesServiceModel {
1759
1811
  * ```
1760
1812
  */
1761
1813
  getTopRunCount(startTime: Date, endTime: Date, options?: TopQueryOptions): Promise<CaseGetTopRunCountResponse[]>;
1814
+ /**
1815
+ * Get the top 10 BPMN elements ranked by failure count within a time range.
1816
+ *
1817
+ * Returns an array of up to 10 elements sorted by how many times they failed,
1818
+ * useful for identifying the most error-prone activities in case processes.
1819
+ *
1820
+ * @param startTime - Start of the time range to query
1821
+ * @param endTime - End of the time range to query
1822
+ * @param options - Optional filters (packageId, processKey, version)
1823
+ * @returns Promise resolving to an array of {@link ElementGetTopFailedCountResponse}
1824
+ * @example
1825
+ * ```typescript
1826
+ * import { Cases } from '@uipath/uipath-typescript/cases';
1827
+ *
1828
+ * const cases = new Cases(sdk);
1829
+ *
1830
+ * // Get top failing elements for the last 7 days
1831
+ * const topFailing = await cases.getTopElementFailedCount(
1832
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
1833
+ * new Date()
1834
+ * );
1835
+ *
1836
+ * for (const element of topFailing) {
1837
+ * console.log(`${element.elementName} (${element.elementType}): ${element.failedCount} failures`);
1838
+ * }
1839
+ * ```
1840
+ *
1841
+ * @example
1842
+ * ```typescript
1843
+ * // Get top failing elements for a specific process
1844
+ * const filtered = await cases.getTopElementFailedCount(
1845
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
1846
+ * new Date(),
1847
+ * { processKey: '<processKey>' }
1848
+ * );
1849
+ * ```
1850
+ */
1851
+ getTopElementFailedCount(startTime: Date, endTime: Date, options?: TopQueryOptions): Promise<ElementGetTopFailedCountResponse[]>;
1762
1852
  /**
1763
1853
  * Get all instances status counts aggregated by date for case management processes.
1764
1854
  *
@@ -2134,4 +2224,4 @@ declare class CaseInstancesService extends BaseService implements CaseInstancesS
2134
2224
  }
2135
2225
 
2136
2226
  export { CaseInstancesService as CaseInstances, CaseInstancesService, CasesService as Cases, CasesService, EscalationActionType, EscalationRecipientScope, EscalationTriggerType, InstanceFinalStatus, InstanceStatus, SLADurationUnit, SlaSummaryStatus, StageTaskType, TimeInterval, createCaseInstanceWithMethods };
2137
- export type { CaseAppConfig, CaseAppOverview, CaseGetAllResponse, CaseGetStageResponse, CaseGetTopDurationResponse, CaseGetTopFaultedCountResponse, CaseGetTopRunCountResponse, CaseInstanceExecutionHistoryResponse, CaseInstanceGetAllOptions, CaseInstanceGetAllWithPaginationOptions, CaseInstanceGetResponse, CaseInstanceMethods, CaseInstanceOperationOptions, CaseInstanceOperationResponse, CaseInstanceReopenOptions, CaseInstanceRun, CaseInstanceSlaSummaryOptions, CaseInstanceStageSLAOptions, CaseInstanceStageSLAResponse, CaseInstanceStageSLAStage, CaseInstancesServiceModel, CasesServiceModel, ElementExecutionMetadata, ElementRunMetadata, EscalationAction, EscalationRecipient, EscalationRule, EscalationTriggerMetadata, GetTopBaseResponse, GetTopDurationResponse, GetTopFaultedCountResponse, GetTopRunCountResponse, InstanceStatusTimelineResponse, RawCaseInstanceGetResponse, SlaSummaryResponse, StageSLA, StageTask, TimelineOptions, TopQueryOptions };
2227
+ export type { CaseAppConfig, CaseAppOverview, CaseGetAllResponse, CaseGetStageResponse, CaseGetTopDurationResponse, CaseGetTopFaultedCountResponse, CaseGetTopRunCountResponse, CaseInstanceExecutionHistoryResponse, CaseInstanceGetAllOptions, CaseInstanceGetAllWithPaginationOptions, CaseInstanceGetResponse, CaseInstanceMethods, CaseInstanceOperationOptions, CaseInstanceOperationResponse, CaseInstanceReopenOptions, CaseInstanceRun, CaseInstanceSlaSummaryOptions, CaseInstanceStageSLAOptions, CaseInstanceStageSLAResponse, CaseInstanceStageSLAStage, CaseInstancesServiceModel, CasesServiceModel, ElementExecutionMetadata, ElementGetTopFailedCountResponse, ElementRunMetadata, EscalationAction, EscalationRecipient, EscalationRule, EscalationTriggerMetadata, GetTopBaseResponse, GetTopDurationResponse, GetTopFaultedCountResponse, GetTopRunCountResponse, InstanceStatusTimelineResponse, RawCaseInstanceGetResponse, SlaSummaryResponse, StageSLA, StageTask, TimelineOptions, TopQueryOptions };
@@ -124,6 +124,8 @@ const MAESTRO_ENDPOINTS = {
124
124
  TOP_PROCESSES_BY_RUN_COUNT: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcessesByRunCount`,
125
125
  /** Top processes ranked by failure count */
126
126
  TOP_PROCESSES_WITH_FAILURE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcesseswithFailure`,
127
+ /** Top elements ranked by failure count */
128
+ TOP_ELEMENTS_WITH_FAILURE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopElementswithFailure`,
127
129
  /** Instance status aggregated by date for time-series charts */
128
130
  INSTANCE_STATUS_BY_DATE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/InstanceStatusByDate`,
129
131
  /** Top processes ranked by total duration */
@@ -2109,6 +2111,52 @@ class CasesService extends BaseService {
2109
2111
  const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_RUN_COUNT, buildInsightsTopBody(startTime, endTime, true, options));
2110
2112
  return (data ?? []).map(process => ({ ...process, name: this.extractCaseName(process.packageId) }));
2111
2113
  }
2114
+ /**
2115
+ * Get the top 10 BPMN elements ranked by failure count within a time range.
2116
+ *
2117
+ * Returns an array of up to 10 elements sorted by how many times they failed,
2118
+ * useful for identifying the most error-prone activities in case processes.
2119
+ *
2120
+ * @param startTime - Start of the time range to query
2121
+ * @param endTime - End of the time range to query
2122
+ * @param options - Optional filters (packageId, processKey, version)
2123
+ * @returns Promise resolving to an array of {@link ElementGetTopFailedCountResponse}
2124
+ * @example
2125
+ * ```typescript
2126
+ * import { Cases } from '@uipath/uipath-typescript/cases';
2127
+ *
2128
+ * const cases = new Cases(sdk);
2129
+ *
2130
+ * // Get top failing elements for the last 7 days
2131
+ * const topFailing = await cases.getTopElementFailedCount(
2132
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
2133
+ * new Date()
2134
+ * );
2135
+ *
2136
+ * for (const element of topFailing) {
2137
+ * console.log(`${element.elementName} (${element.elementType}): ${element.failedCount} failures`);
2138
+ * }
2139
+ * ```
2140
+ *
2141
+ * @example
2142
+ * ```typescript
2143
+ * // Get top failing elements for a specific process
2144
+ * const filtered = await cases.getTopElementFailedCount(
2145
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
2146
+ * new Date(),
2147
+ * { processKey: '<processKey>' }
2148
+ * );
2149
+ * ```
2150
+ */
2151
+ async getTopElementFailedCount(startTime, endTime, options) {
2152
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_ELEMENTS_WITH_FAILURE, buildInsightsTopBody(startTime, endTime, true, options));
2153
+ return (data ?? []).map(item => ({
2154
+ elementName: item.elementName,
2155
+ elementType: item.elementType,
2156
+ processKey: item.processKey,
2157
+ failedCount: item.count,
2158
+ }));
2159
+ }
2112
2160
  /**
2113
2161
  * Get all instances status counts aggregated by date for case management processes.
2114
2162
  *
@@ -2264,6 +2312,9 @@ __decorate([
2264
2312
  __decorate([
2265
2313
  track('Cases.GetTopRunCount')
2266
2314
  ], CasesService.prototype, "getTopRunCount", null);
2315
+ __decorate([
2316
+ track('Cases.GetTopElementFailedCount')
2317
+ ], CasesService.prototype, "getTopElementFailedCount", null);
2267
2318
  __decorate([
2268
2319
  track('Cases.GetInstanceStatusTimeline')
2269
2320
  ], CasesService.prototype, "getInstanceStatusTimeline", null);
@@ -5312,7 +5312,7 @@ function normalizeBaseUrl(url) {
5312
5312
  * SDK's public API.
5313
5313
  */
5314
5314
  /** SDK version placeholder — patched by the SDK publish workflow. */
5315
- const SDK_VERSION = '1.3.10';
5315
+ const SDK_VERSION = '1.3.11';
5316
5316
  const CLOUD_ROLE_NAME = 'uipath-ts-sdk';
5317
5317
  const SDK_SERVICE_NAME = 'UiPath.TypeScript.Sdk';
5318
5318
  const SDK_LOGGER_NAME = 'uipath-ts-sdk-telemetry';
@@ -5310,7 +5310,7 @@ function normalizeBaseUrl(url) {
5310
5310
  * SDK's public API.
5311
5311
  */
5312
5312
  /** SDK version placeholder — patched by the SDK publish workflow. */
5313
- const SDK_VERSION = '1.3.10';
5313
+ const SDK_VERSION = '1.3.11';
5314
5314
  const CLOUD_ROLE_NAME = 'uipath-ts-sdk';
5315
5315
  const SDK_SERVICE_NAME = 'UiPath.TypeScript.Sdk';
5316
5316
  const SDK_LOGGER_NAME = 'uipath-ts-sdk-telemetry';
@@ -2791,10 +2791,6 @@ class EntityService extends BaseService {
2791
2791
  * @internal
2792
2792
  */
2793
2793
  async create(name, fields, options) {
2794
- this.validateName(name, 'entity');
2795
- for (const field of fields) {
2796
- this.validateName(field.fieldName, 'field');
2797
- }
2798
2794
  const opts = options ?? {};
2799
2795
  const payload = {
2800
2796
  ...(opts.description !== undefined && { description: opts.description }),
@@ -2937,6 +2933,7 @@ class EntityService extends BaseService {
2937
2933
  ...(update.isUnique !== undefined && { isUnique: update.isUnique }),
2938
2934
  ...(update.isRbacEnabled !== undefined && { isRbacEnabled: update.isRbacEnabled }),
2939
2935
  ...(update.isEncrypted !== undefined && { isEncrypted: update.isEncrypted }),
2936
+ ...(update.isHiddenField !== undefined && { isHiddenField: update.isHiddenField }),
2940
2937
  ...(update.defaultValue !== undefined && { defaultValue: update.defaultValue }),
2941
2938
  ...(hasConstraintUpdate && f.sqlType && { sqlType: { ...f.sqlType, ...constraintUpdate } }),
2942
2939
  };
@@ -2945,9 +2942,6 @@ class EntityService extends BaseService {
2945
2942
  // Build and append new fields
2946
2943
  const newFields = [];
2947
2944
  if (options.addFields?.length) {
2948
- for (const field of options.addFields) {
2949
- this.validateName(field.fieldName, 'field');
2950
- }
2951
2945
  newFields.push(...options.addFields.map(f => this.buildSchemaFieldPayload(f)));
2952
2946
  }
2953
2947
  await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPSERT, {
@@ -3048,9 +3042,15 @@ class EntityService extends BaseService {
3048
3042
  }
3049
3043
  /** Converts a user-facing EntityCreateFieldOptions to the raw API field payload */
3050
3044
  buildSchemaFieldPayload(field) {
3051
- this.validateName(field.fieldName, 'field');
3052
3045
  const fieldType = field.type ?? exports.EntityFieldDataType.STRING;
3053
3046
  this.validateFieldConstraints(fieldType, field, field.fieldName);
3047
+ const isRelationship = fieldType === exports.EntityFieldDataType.RELATIONSHIP;
3048
+ const isFile = fieldType === exports.EntityFieldDataType.FILE;
3049
+ if ((isRelationship || isFile) && (!field.referenceEntityId || !field.referenceFieldId)) {
3050
+ throw new ValidationError({
3051
+ message: `Field '${field.fieldName}' of type ${fieldType} requires both referenceEntityId and referenceFieldId (UUIDs of the target entity and field).`,
3052
+ });
3053
+ }
3054
3054
  const mapping = EntitySchemaFieldTypeMap[fieldType];
3055
3055
  return {
3056
3056
  name: field.fieldName,
@@ -3065,10 +3065,13 @@ class EntityService extends BaseService {
3065
3065
  isUnique: field.isUnique ?? false,
3066
3066
  isRbacEnabled: field.isRbacEnabled ?? false,
3067
3067
  isEncrypted: field.isEncrypted ?? false,
3068
+ isHiddenField: field.isHiddenField ?? false,
3068
3069
  ...(field.defaultValue !== undefined && { defaultValue: field.defaultValue }),
3069
3070
  ...(field.choiceSetId !== undefined && { choiceSetId: field.choiceSetId }),
3070
- ...(field.referenceEntityName !== undefined && { referenceEntityName: field.referenceEntityName }),
3071
- ...(field.referenceFieldName !== undefined && { referenceFieldName: field.referenceFieldName }),
3071
+ ...((isRelationship || isFile) && { isForeignKey: true }),
3072
+ ...(isRelationship && { referenceType: exports.ReferenceType.ManyToOne }),
3073
+ ...(field.referenceEntityId !== undefined && { referenceEntity: { id: field.referenceEntityId } }),
3074
+ ...(field.referenceFieldId !== undefined && { referenceField: { id: field.referenceFieldId } }),
3072
3075
  };
3073
3076
  }
3074
3077
  /**
@@ -3172,24 +3175,7 @@ class EntityService extends BaseService {
3172
3175
  return {};
3173
3176
  }
3174
3177
  }
3175
- validateName(name, context) {
3176
- if (name.length < 3 || name.length > 100 || !/^[a-zA-Z]\w*$/.test(name)) {
3177
- const suggestion = name.replace(/\W/g, '').replace(/^[0-9_]+/, '');
3178
- const defaultName = `My${context.charAt(0).toUpperCase() + context.slice(1)}`;
3179
- throw new ValidationError({
3180
- message: `Invalid ${context} name '${name}'. Must start with a letter, contain only letters, numbers, and underscores, 3–100 characters (e.g., "${suggestion || defaultName}").`
3181
- });
3182
- }
3183
- if (context === 'field' && EntityService.RESERVED_FIELD_NAMES.has(name)) {
3184
- throw new ValidationError({
3185
- message: `Field name '${name}' is reserved. Reserved names: ${[...EntityService.RESERVED_FIELD_NAMES].join(', ')}.`
3186
- });
3187
- }
3188
- }
3189
3178
  }
3190
- EntityService.RESERVED_FIELD_NAMES = new Set([
3191
- 'Id', 'CreatedBy', 'CreateTime', 'UpdatedBy', 'UpdateTime'
3192
- ]);
3193
3179
  __decorate([
3194
3180
  track('Entities.GetById')
3195
3181
  ], EntityService.prototype, "getById", null);
@@ -549,6 +549,8 @@ interface EntityFieldBase {
549
549
  isRbacEnabled?: boolean;
550
550
  /** Whether the field value is encrypted at rest (default: false) */
551
551
  isEncrypted?: boolean;
552
+ /** Whether the field is hidden from the UI (default: false) */
553
+ isHiddenField?: boolean;
552
554
  /** Default value for the field */
553
555
  defaultValue?: string;
554
556
  /** Maximum character length for STRING fields (default: 200, range: 1–4000) and MULTILINE_TEXT fields (default: 200, range: 1–10000). */
@@ -573,10 +575,10 @@ interface EntityCreateFieldOptions extends EntityFieldBase {
573
575
  type?: EntityFieldDataType;
574
576
  /** Choice set ID for choice-set fields */
575
577
  choiceSetId?: string;
576
- /** Name of the referenced entity for relationship fields */
577
- referenceEntityName?: string;
578
- /** Name of the field in the referenced entity */
579
- referenceFieldName?: string;
578
+ /** UUID of the referenced entity (required when `type` is `RELATIONSHIP` or `FILE`) */
579
+ referenceEntityId?: string;
580
+ /** UUID of the referenced field on the target entity (required when `type` is `RELATIONSHIP` or `FILE`) */
581
+ referenceFieldId?: string;
580
582
  }
581
583
  /**
582
584
  * Options for creating a new Data Fabric entity
@@ -806,10 +808,6 @@ interface FieldMetaData {
806
808
  referenceType?: ReferenceType;
807
809
  choiceSetId?: string;
808
810
  defaultValue?: string;
809
- /** Name of the referenced entity (used on write payloads for relationship fields) */
810
- referenceEntityName?: string;
811
- /** Name of the field in the referenced entity (used on write payloads for relationship fields) */
812
- referenceFieldName?: string;
813
811
  }
814
812
  /**
815
813
  * External object details
@@ -2296,8 +2294,6 @@ declare class EntityService extends BaseService implements EntityServiceModel {
2296
2294
  * override the defaults where the type accepts overrides.
2297
2295
  */
2298
2296
  private buildSqlTypeConstraints;
2299
- private static readonly RESERVED_FIELD_NAMES;
2300
- private validateName;
2301
2297
  }
2302
2298
 
2303
2299
  /**
@@ -2789,10 +2789,6 @@ class EntityService extends BaseService {
2789
2789
  * @internal
2790
2790
  */
2791
2791
  async create(name, fields, options) {
2792
- this.validateName(name, 'entity');
2793
- for (const field of fields) {
2794
- this.validateName(field.fieldName, 'field');
2795
- }
2796
2792
  const opts = options ?? {};
2797
2793
  const payload = {
2798
2794
  ...(opts.description !== undefined && { description: opts.description }),
@@ -2935,6 +2931,7 @@ class EntityService extends BaseService {
2935
2931
  ...(update.isUnique !== undefined && { isUnique: update.isUnique }),
2936
2932
  ...(update.isRbacEnabled !== undefined && { isRbacEnabled: update.isRbacEnabled }),
2937
2933
  ...(update.isEncrypted !== undefined && { isEncrypted: update.isEncrypted }),
2934
+ ...(update.isHiddenField !== undefined && { isHiddenField: update.isHiddenField }),
2938
2935
  ...(update.defaultValue !== undefined && { defaultValue: update.defaultValue }),
2939
2936
  ...(hasConstraintUpdate && f.sqlType && { sqlType: { ...f.sqlType, ...constraintUpdate } }),
2940
2937
  };
@@ -2943,9 +2940,6 @@ class EntityService extends BaseService {
2943
2940
  // Build and append new fields
2944
2941
  const newFields = [];
2945
2942
  if (options.addFields?.length) {
2946
- for (const field of options.addFields) {
2947
- this.validateName(field.fieldName, 'field');
2948
- }
2949
2943
  newFields.push(...options.addFields.map(f => this.buildSchemaFieldPayload(f)));
2950
2944
  }
2951
2945
  await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPSERT, {
@@ -3046,9 +3040,15 @@ class EntityService extends BaseService {
3046
3040
  }
3047
3041
  /** Converts a user-facing EntityCreateFieldOptions to the raw API field payload */
3048
3042
  buildSchemaFieldPayload(field) {
3049
- this.validateName(field.fieldName, 'field');
3050
3043
  const fieldType = field.type ?? EntityFieldDataType.STRING;
3051
3044
  this.validateFieldConstraints(fieldType, field, field.fieldName);
3045
+ const isRelationship = fieldType === EntityFieldDataType.RELATIONSHIP;
3046
+ const isFile = fieldType === EntityFieldDataType.FILE;
3047
+ if ((isRelationship || isFile) && (!field.referenceEntityId || !field.referenceFieldId)) {
3048
+ throw new ValidationError({
3049
+ message: `Field '${field.fieldName}' of type ${fieldType} requires both referenceEntityId and referenceFieldId (UUIDs of the target entity and field).`,
3050
+ });
3051
+ }
3052
3052
  const mapping = EntitySchemaFieldTypeMap[fieldType];
3053
3053
  return {
3054
3054
  name: field.fieldName,
@@ -3063,10 +3063,13 @@ class EntityService extends BaseService {
3063
3063
  isUnique: field.isUnique ?? false,
3064
3064
  isRbacEnabled: field.isRbacEnabled ?? false,
3065
3065
  isEncrypted: field.isEncrypted ?? false,
3066
+ isHiddenField: field.isHiddenField ?? false,
3066
3067
  ...(field.defaultValue !== undefined && { defaultValue: field.defaultValue }),
3067
3068
  ...(field.choiceSetId !== undefined && { choiceSetId: field.choiceSetId }),
3068
- ...(field.referenceEntityName !== undefined && { referenceEntityName: field.referenceEntityName }),
3069
- ...(field.referenceFieldName !== undefined && { referenceFieldName: field.referenceFieldName }),
3069
+ ...((isRelationship || isFile) && { isForeignKey: true }),
3070
+ ...(isRelationship && { referenceType: ReferenceType.ManyToOne }),
3071
+ ...(field.referenceEntityId !== undefined && { referenceEntity: { id: field.referenceEntityId } }),
3072
+ ...(field.referenceFieldId !== undefined && { referenceField: { id: field.referenceFieldId } }),
3070
3073
  };
3071
3074
  }
3072
3075
  /**
@@ -3170,24 +3173,7 @@ class EntityService extends BaseService {
3170
3173
  return {};
3171
3174
  }
3172
3175
  }
3173
- validateName(name, context) {
3174
- if (name.length < 3 || name.length > 100 || !/^[a-zA-Z]\w*$/.test(name)) {
3175
- const suggestion = name.replace(/\W/g, '').replace(/^[0-9_]+/, '');
3176
- const defaultName = `My${context.charAt(0).toUpperCase() + context.slice(1)}`;
3177
- throw new ValidationError({
3178
- message: `Invalid ${context} name '${name}'. Must start with a letter, contain only letters, numbers, and underscores, 3–100 characters (e.g., "${suggestion || defaultName}").`
3179
- });
3180
- }
3181
- if (context === 'field' && EntityService.RESERVED_FIELD_NAMES.has(name)) {
3182
- throw new ValidationError({
3183
- message: `Field name '${name}' is reserved. Reserved names: ${[...EntityService.RESERVED_FIELD_NAMES].join(', ')}.`
3184
- });
3185
- }
3186
- }
3187
3176
  }
3188
- EntityService.RESERVED_FIELD_NAMES = new Set([
3189
- 'Id', 'CreatedBy', 'CreateTime', 'UpdatedBy', 'UpdateTime'
3190
- ]);
3191
3177
  __decorate([
3192
3178
  track('Entities.GetById')
3193
3179
  ], EntityService.prototype, "getById", null);