@uipath/uipath-typescript 1.3.4 → 1.3.6

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.
Files changed (38) hide show
  1. package/README.md +1 -1
  2. package/dist/assets/index.cjs +1 -1
  3. package/dist/assets/index.mjs +1 -1
  4. package/dist/attachments/index.cjs +1 -1
  5. package/dist/attachments/index.mjs +1 -1
  6. package/dist/buckets/index.cjs +1 -1
  7. package/dist/buckets/index.mjs +1 -1
  8. package/dist/cases/index.cjs +1 -1
  9. package/dist/cases/index.mjs +1 -1
  10. package/dist/conversational-agent/index.cjs +1 -1
  11. package/dist/conversational-agent/index.mjs +1 -1
  12. package/dist/core/index.cjs +29 -4
  13. package/dist/core/index.d.ts +11 -1
  14. package/dist/core/index.mjs +29 -4
  15. package/dist/document-understanding/index.cjs +257 -0
  16. package/dist/document-understanding/index.d.ts +1185 -0
  17. package/dist/document-understanding/index.mjs +255 -0
  18. package/dist/entities/index.cjs +236 -15
  19. package/dist/entities/index.d.ts +81 -0
  20. package/dist/entities/index.mjs +236 -15
  21. package/dist/feedback/index.cjs +38 -4
  22. package/dist/feedback/index.d.ts +52 -1
  23. package/dist/feedback/index.mjs +38 -4
  24. package/dist/index.cjs +519 -18
  25. package/dist/index.d.ts +1313 -8
  26. package/dist/index.mjs +521 -21
  27. package/dist/index.umd.js +519 -18
  28. package/dist/jobs/index.cjs +1 -1
  29. package/dist/jobs/index.mjs +1 -1
  30. package/dist/maestro-processes/index.cjs +1 -1
  31. package/dist/maestro-processes/index.mjs +1 -1
  32. package/dist/processes/index.cjs +1 -1
  33. package/dist/processes/index.mjs +1 -1
  34. package/dist/queues/index.cjs +1 -1
  35. package/dist/queues/index.mjs +1 -1
  36. package/dist/tasks/index.cjs +1 -1
  37. package/dist/tasks/index.mjs +1 -1
  38. package/package.json +11 -1
@@ -0,0 +1,255 @@
1
+ // Auto-generated from the OpenAPI spec — do not edit manually.
2
+ var DocumentActionPriority;
3
+ (function (DocumentActionPriority) {
4
+ DocumentActionPriority["Low"] = "Low";
5
+ DocumentActionPriority["Medium"] = "Medium";
6
+ DocumentActionPriority["High"] = "High";
7
+ DocumentActionPriority["Critical"] = "Critical";
8
+ })(DocumentActionPriority || (DocumentActionPriority = {}));
9
+ var DocumentActionStatus;
10
+ (function (DocumentActionStatus) {
11
+ DocumentActionStatus["Unassigned"] = "Unassigned";
12
+ DocumentActionStatus["Pending"] = "Pending";
13
+ DocumentActionStatus["Completed"] = "Completed";
14
+ })(DocumentActionStatus || (DocumentActionStatus = {}));
15
+ var DocumentActionType;
16
+ (function (DocumentActionType) {
17
+ DocumentActionType["Validation"] = "Validation";
18
+ DocumentActionType["Classification"] = "Classification";
19
+ })(DocumentActionType || (DocumentActionType = {}));
20
+
21
+ // Auto-generated from the OpenAPI spec — do not edit manually.
22
+ var ProjectProperties;
23
+ (function (ProjectProperties) {
24
+ ProjectProperties["IsPredefined"] = "IsPredefined";
25
+ ProjectProperties["SupportsTags"] = "SupportsTags";
26
+ ProjectProperties["SupportsVersions"] = "SupportsVersions";
27
+ ProjectProperties["IsSplittingEnabled"] = "IsSplittingEnabled";
28
+ })(ProjectProperties || (ProjectProperties = {}));
29
+ var ProjectType;
30
+ (function (ProjectType) {
31
+ ProjectType["Classic"] = "Classic";
32
+ ProjectType["Modern"] = "Modern";
33
+ ProjectType["IXP"] = "IXP";
34
+ ProjectType["Unknown"] = "Unknown";
35
+ })(ProjectType || (ProjectType = {}));
36
+ var ResourceStatus;
37
+ (function (ResourceStatus) {
38
+ ResourceStatus["Unknown"] = "Unknown";
39
+ ResourceStatus["NotStarted"] = "NotStarted";
40
+ ResourceStatus["ExportInProgress"] = "ExportInProgress";
41
+ ResourceStatus["ExportCompleted"] = "ExportCompleted";
42
+ ResourceStatus["InProgress"] = "InProgress";
43
+ ResourceStatus["Suspended"] = "Suspended";
44
+ ResourceStatus["Resuming"] = "Resuming";
45
+ ResourceStatus["Available"] = "Available";
46
+ ResourceStatus["Error"] = "Error";
47
+ ResourceStatus["Deleting"] = "Deleting";
48
+ })(ResourceStatus || (ResourceStatus = {}));
49
+ var ResourceType;
50
+ (function (ResourceType) {
51
+ ResourceType["Specialized"] = "Specialized";
52
+ ResourceType["Generative"] = "Generative";
53
+ ResourceType["Custom"] = "Custom";
54
+ ResourceType["Unknown"] = "Unknown";
55
+ })(ResourceType || (ResourceType = {}));
56
+
57
+ // Auto-generated from the OpenAPI spec — do not edit manually.
58
+ var MarkupType;
59
+ (function (MarkupType) {
60
+ MarkupType["Unknown"] = "Unknown";
61
+ MarkupType["Circled"] = "Circled";
62
+ MarkupType["Underlined"] = "Underlined";
63
+ MarkupType["Strikethrough"] = "Strikethrough";
64
+ })(MarkupType || (MarkupType = {}));
65
+ var ProcessingSource;
66
+ (function (ProcessingSource) {
67
+ ProcessingSource["Unknown"] = "Unknown";
68
+ ProcessingSource["Ocr"] = "Ocr";
69
+ ProcessingSource["Pdf"] = "Pdf";
70
+ ProcessingSource["PlainText"] = "PlainText";
71
+ ProcessingSource["PdfAndOcr"] = "PdfAndOcr";
72
+ })(ProcessingSource || (ProcessingSource = {}));
73
+ var Rotation;
74
+ (function (Rotation) {
75
+ Rotation["None"] = "None";
76
+ Rotation["Rotated90"] = "Rotated90";
77
+ Rotation["Rotated180"] = "Rotated180";
78
+ Rotation["Rotated270"] = "Rotated270";
79
+ Rotation["Other"] = "Other";
80
+ })(Rotation || (Rotation = {}));
81
+ var SectionType;
82
+ (function (SectionType) {
83
+ SectionType["Vertical"] = "Vertical";
84
+ SectionType["Paragraph"] = "Paragraph";
85
+ SectionType["Header"] = "Header";
86
+ SectionType["Footer"] = "Footer";
87
+ SectionType["Table"] = "Table";
88
+ })(SectionType || (SectionType = {}));
89
+ var TextType;
90
+ (function (TextType) {
91
+ TextType["Unknown"] = "Unknown";
92
+ TextType["Text"] = "Text";
93
+ TextType["Checkbox"] = "Checkbox";
94
+ TextType["Handwriting"] = "Handwriting";
95
+ TextType["Barcode"] = "Barcode";
96
+ TextType["QRcode"] = "QRcode";
97
+ TextType["Stamp"] = "Stamp";
98
+ TextType["Logo"] = "Logo";
99
+ TextType["Circle"] = "Circle";
100
+ TextType["Underline"] = "Underline";
101
+ TextType["Cut"] = "Cut";
102
+ })(TextType || (TextType = {}));
103
+ var WordGroupType;
104
+ (function (WordGroupType) {
105
+ WordGroupType["Sentence"] = "Sentence";
106
+ WordGroupType["TableCell"] = "TableCell";
107
+ WordGroupType["TableRowEnd"] = "TableRowEnd";
108
+ WordGroupType["Heading"] = "Heading";
109
+ WordGroupType["Other"] = "Other";
110
+ })(WordGroupType || (WordGroupType = {}));
111
+
112
+ // Auto-generated from the OpenAPI spec — do not edit manually.
113
+ var ModelKind;
114
+ (function (ModelKind) {
115
+ ModelKind["Classifier"] = "Classifier";
116
+ ModelKind["Extractor"] = "Extractor";
117
+ })(ModelKind || (ModelKind = {}));
118
+ var ModelType;
119
+ (function (ModelType) {
120
+ ModelType["IXP"] = "IXP";
121
+ ModelType["Modern"] = "Modern";
122
+ ModelType["Predefined"] = "Predefined";
123
+ })(ModelType || (ModelType = {}));
124
+
125
+ // Auto-generated from the OpenAPI spec — do not edit manually.
126
+ var ClassifierDocumentTypeType;
127
+ (function (ClassifierDocumentTypeType) {
128
+ ClassifierDocumentTypeType["FormsAi"] = "FormsAi";
129
+ ClassifierDocumentTypeType["SemiStructuredAi"] = "SemiStructuredAi";
130
+ ClassifierDocumentTypeType["Helix"] = "Helix";
131
+ ClassifierDocumentTypeType["Unknown"] = "Unknown";
132
+ })(ClassifierDocumentTypeType || (ClassifierDocumentTypeType = {}));
133
+ var CreateTaskPriority;
134
+ (function (CreateTaskPriority) {
135
+ CreateTaskPriority["Low"] = "Low";
136
+ CreateTaskPriority["Medium"] = "Medium";
137
+ CreateTaskPriority["High"] = "High";
138
+ CreateTaskPriority["Critical"] = "Critical";
139
+ })(CreateTaskPriority || (CreateTaskPriority = {}));
140
+ var GptFieldType;
141
+ (function (GptFieldType) {
142
+ GptFieldType["Address"] = "Address";
143
+ GptFieldType["Boolean"] = "Boolean";
144
+ GptFieldType["Date"] = "Date";
145
+ GptFieldType["Name"] = "Name";
146
+ GptFieldType["Number"] = "Number";
147
+ GptFieldType["Text"] = "Text";
148
+ })(GptFieldType || (GptFieldType = {}));
149
+ var ValidationDisplayMode;
150
+ (function (ValidationDisplayMode) {
151
+ ValidationDisplayMode["Classic"] = "Classic";
152
+ ValidationDisplayMode["Compact"] = "Compact";
153
+ })(ValidationDisplayMode || (ValidationDisplayMode = {}));
154
+
155
+ // Auto-generated from the OpenAPI spec — do not edit manually.
156
+ var ResultsDataSource;
157
+ (function (ResultsDataSource) {
158
+ ResultsDataSource["Automatic"] = "Automatic";
159
+ ResultsDataSource["Manual"] = "Manual";
160
+ ResultsDataSource["ManuallyChanged"] = "ManuallyChanged";
161
+ ResultsDataSource["Defaulted"] = "Defaulted";
162
+ ResultsDataSource["External"] = "External";
163
+ })(ResultsDataSource || (ResultsDataSource = {}));
164
+
165
+ // Auto-generated from the OpenAPI spec — do not edit manually.
166
+ var ComparisonOperator;
167
+ (function (ComparisonOperator) {
168
+ ComparisonOperator["Equals"] = "Equals";
169
+ ComparisonOperator["NotEquals"] = "NotEquals";
170
+ ComparisonOperator["Greater"] = "Greater";
171
+ ComparisonOperator["Less"] = "Less";
172
+ ComparisonOperator["GreaterOrEqual"] = "GreaterOrEqual";
173
+ ComparisonOperator["LessOrEqual"] = "LessOrEqual";
174
+ })(ComparisonOperator || (ComparisonOperator = {}));
175
+ var Criticality;
176
+ (function (Criticality) {
177
+ Criticality["Must"] = "Must";
178
+ Criticality["Should"] = "Should";
179
+ })(Criticality || (Criticality = {}));
180
+ var FieldType;
181
+ (function (FieldType) {
182
+ FieldType["Text"] = "Text";
183
+ FieldType["Number"] = "Number";
184
+ FieldType["Date"] = "Date";
185
+ FieldType["Name"] = "Name";
186
+ FieldType["Address"] = "Address";
187
+ FieldType["Keyword"] = "Keyword";
188
+ FieldType["Set"] = "Set";
189
+ FieldType["Boolean"] = "Boolean";
190
+ FieldType["Table"] = "Table";
191
+ FieldType["Internal"] = "Internal";
192
+ FieldType["FieldGroup"] = "FieldGroup";
193
+ FieldType["MonetaryQuantity"] = "MonetaryQuantity";
194
+ })(FieldType || (FieldType = {}));
195
+ var LogicalOperator;
196
+ (function (LogicalOperator) {
197
+ LogicalOperator["AND"] = "AND";
198
+ LogicalOperator["OR"] = "OR";
199
+ })(LogicalOperator || (LogicalOperator = {}));
200
+ var RuleType;
201
+ (function (RuleType) {
202
+ RuleType["Mandatory"] = "Mandatory";
203
+ RuleType["PossibleValues"] = "PossibleValues";
204
+ RuleType["Regex"] = "Regex";
205
+ RuleType["StartsWith"] = "StartsWith";
206
+ RuleType["EndsWith"] = "EndsWith";
207
+ RuleType["FixedLength"] = "FixedLength";
208
+ RuleType["IsNumeric"] = "IsNumeric";
209
+ RuleType["IsDate"] = "IsDate";
210
+ RuleType["IsEmail"] = "IsEmail";
211
+ RuleType["Contains"] = "Contains";
212
+ RuleType["Expression"] = "Expression";
213
+ RuleType["TableExpression"] = "TableExpression";
214
+ RuleType["IsEmpty"] = "IsEmpty";
215
+ })(RuleType || (RuleType = {}));
216
+
217
+ // Auto-generated from the OpenAPI spec — do not edit manually.
218
+ var ActionStatus;
219
+ (function (ActionStatus) {
220
+ ActionStatus["Unassigned"] = "Unassigned";
221
+ ActionStatus["Pending"] = "Pending";
222
+ ActionStatus["Completed"] = "Completed";
223
+ })(ActionStatus || (ActionStatus = {}));
224
+
225
+ var index = /*#__PURE__*/Object.freeze({
226
+ __proto__: null,
227
+ get ActionStatus () { return ActionStatus; },
228
+ get ClassifierDocumentTypeType () { return ClassifierDocumentTypeType; },
229
+ get ComparisonOperator () { return ComparisonOperator; },
230
+ get CreateTaskPriority () { return CreateTaskPriority; },
231
+ get Criticality () { return Criticality; },
232
+ get DocumentActionPriority () { return DocumentActionPriority; },
233
+ get DocumentActionStatus () { return DocumentActionStatus; },
234
+ get DocumentActionType () { return DocumentActionType; },
235
+ get FieldType () { return FieldType; },
236
+ get GptFieldType () { return GptFieldType; },
237
+ get LogicalOperator () { return LogicalOperator; },
238
+ get MarkupType () { return MarkupType; },
239
+ get ModelKind () { return ModelKind; },
240
+ get ModelType () { return ModelType; },
241
+ get ProcessingSource () { return ProcessingSource; },
242
+ get ProjectProperties () { return ProjectProperties; },
243
+ get ProjectType () { return ProjectType; },
244
+ get ResourceStatus () { return ResourceStatus; },
245
+ get ResourceType () { return ResourceType; },
246
+ get ResultsDataSource () { return ResultsDataSource; },
247
+ get Rotation () { return Rotation; },
248
+ get RuleType () { return RuleType; },
249
+ get SectionType () { return SectionType; },
250
+ get TextType () { return TextType; },
251
+ get ValidationDisplayMode () { return ValidationDisplayMode; },
252
+ get WordGroupType () { return WordGroupType; }
253
+ });
254
+
255
+ export { index as DuFramework };
@@ -1929,6 +1929,20 @@ function createParams(paramsObj = {}) {
1929
1929
  return params;
1930
1930
  }
1931
1931
 
1932
+ /**
1933
+ * Names of the per-field SQL constraint properties (i.e. the contents of `sqlType`
1934
+ * excluding its `name`). Used internally to validate user-supplied constraints
1935
+ * against the set of constraints that each `EntityFieldDataType` accepts.
1936
+ *
1937
+ * Enum values match the corresponding property names on `EntityCreateFieldOptions`.
1938
+ */
1939
+ var EntityFieldConstraint;
1940
+ (function (EntityFieldConstraint) {
1941
+ EntityFieldConstraint["LengthLimit"] = "lengthLimit";
1942
+ EntityFieldConstraint["MaxValue"] = "maxValue";
1943
+ EntityFieldConstraint["MinValue"] = "minValue";
1944
+ EntityFieldConstraint["DecimalPrecision"] = "decimalPrecision";
1945
+ })(EntityFieldConstraint || (EntityFieldConstraint = {}));
1932
1946
  /**
1933
1947
  * Entity field data types (SQL types from API)
1934
1948
  */
@@ -1991,6 +2005,70 @@ const FieldDisplayTypeToDataType = {
1991
2005
  [exports.FieldDisplayType.AutoNumber]: exports.EntityFieldDataType.AUTO_NUMBER,
1992
2006
  [exports.FieldDisplayType.Relationship]: exports.EntityFieldDataType.RELATIONSHIP,
1993
2007
  };
2008
+ /**
2009
+ * Default and fixed sqlType constraint values applied when the user does not provide them.
2010
+ * The API requires these to be present on field creation — without them the field
2011
+ * is stored in an incomplete state, causing "Field type cannot be changed" errors
2012
+ * when the UI later tries to edit advanced options.
2013
+ */
2014
+ const ENTITY_FIELD_CONSTRAINT_DEFAULTS = {
2015
+ STRING_LENGTH_LIMIT: 200,
2016
+ MULTILINE_TEXT_LENGTH_LIMIT: 200,
2017
+ /** Fixed (non-overridable) length limit on DECIMAL payloads*/
2018
+ DECIMAL_LENGTH_LIMIT: 1000,
2019
+ DECIMAL_PRECISION: 2,
2020
+ /** Fixed (non-overridable) length limit for BIT (BOOLEAN) fields */
2021
+ BOOLEAN_LENGTH_LIMIT: 100,
2022
+ /** Fixed (non-overridable) length limit for DATE / DATETIMEOFFSET fields */
2023
+ DATE_LENGTH_LIMIT: 1000,
2024
+ /** Fixed (non-overridable) length limit for UNIQUEIDENTIFIER-backed FILE and RELATIONSHIP fields */
2025
+ UNIQUEIDENTIFIER_LENGTH_LIMIT: 300,
2026
+ /** Fixed (non-overridable) length limit for CHOICE_SET_MULTIPLE fields */
2027
+ CHOICE_SET_MULTIPLE_LENGTH_LIMIT: 4000,
2028
+ NUMERIC_MAX_VALUE: 1000000000000,
2029
+ NUMERIC_MIN_VALUE: -1e12,
2030
+ };
2031
+ /**
2032
+ * Per-field-type spec describing which {@link EntityFieldConstraint}s the user
2033
+ * may supply on create / update, and the inclusive value range for each.
2034
+ *
2035
+ * Source of truth: the platform's `Constants.cs` constraint table. Keys absent
2036
+ * from a type's spec are not user-configurable for that type; passing one
2037
+ * throws a `ValidationError`. Field types absent from this map (BOOLEAN, DATE,
2038
+ * DATETIME, DATETIME_WITH_TZ, FILE, RELATIONSHIP, UUID, CHOICE_SET_SINGLE,
2039
+ * CHOICE_SET_MULTIPLE, AUTO_NUMBER) accept no user-supplied constraints.
2040
+ */
2041
+ const ENTITY_FIELD_CONSTRAINT_SPEC = {
2042
+ [exports.EntityFieldDataType.STRING]: {
2043
+ [EntityFieldConstraint.LengthLimit]: { min: 1, max: 4000 },
2044
+ },
2045
+ [exports.EntityFieldDataType.MULTILINE_TEXT]: {
2046
+ [EntityFieldConstraint.LengthLimit]: { min: 1, max: 10000 },
2047
+ },
2048
+ [exports.EntityFieldDataType.INTEGER]: {
2049
+ [EntityFieldConstraint.MaxValue]: { min: -Number.MAX_SAFE_INTEGER, max: Number.MAX_SAFE_INTEGER },
2050
+ [EntityFieldConstraint.MinValue]: { min: -Number.MAX_SAFE_INTEGER, max: Number.MAX_SAFE_INTEGER },
2051
+ },
2052
+ [exports.EntityFieldDataType.BIG_INTEGER]: {
2053
+ [EntityFieldConstraint.MaxValue]: { min: -Number.MAX_SAFE_INTEGER, max: Number.MAX_SAFE_INTEGER },
2054
+ [EntityFieldConstraint.MinValue]: { min: -Number.MAX_SAFE_INTEGER, max: Number.MAX_SAFE_INTEGER },
2055
+ },
2056
+ [exports.EntityFieldDataType.DECIMAL]: {
2057
+ [EntityFieldConstraint.MaxValue]: { min: -Number.MAX_SAFE_INTEGER, max: Number.MAX_SAFE_INTEGER },
2058
+ [EntityFieldConstraint.MinValue]: { min: -Number.MAX_SAFE_INTEGER, max: Number.MAX_SAFE_INTEGER },
2059
+ [EntityFieldConstraint.DecimalPrecision]: { min: 0, max: 10 },
2060
+ },
2061
+ [exports.EntityFieldDataType.FLOAT]: {
2062
+ [EntityFieldConstraint.MaxValue]: { min: -Number.MAX_SAFE_INTEGER, max: Number.MAX_SAFE_INTEGER },
2063
+ [EntityFieldConstraint.MinValue]: { min: -Number.MAX_SAFE_INTEGER, max: Number.MAX_SAFE_INTEGER },
2064
+ [EntityFieldConstraint.DecimalPrecision]: { min: 0, max: 10 },
2065
+ },
2066
+ [exports.EntityFieldDataType.DOUBLE]: {
2067
+ [EntityFieldConstraint.MaxValue]: { min: -Number.MAX_SAFE_INTEGER, max: Number.MAX_SAFE_INTEGER },
2068
+ [EntityFieldConstraint.MinValue]: { min: -Number.MAX_SAFE_INTEGER, max: Number.MAX_SAFE_INTEGER },
2069
+ [EntityFieldConstraint.DecimalPrecision]: { min: 0, max: 10 },
2070
+ },
2071
+ };
1994
2072
  /**
1995
2073
  * Maps SQL field types to friendly display names
1996
2074
  */
@@ -2015,7 +2093,7 @@ const EntityFieldTypeMap = {
2015
2093
  // Connection string placeholder that will be replaced during build
2016
2094
  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";
2017
2095
  // SDK Version placeholder
2018
- const SDK_VERSION = "1.3.4";
2096
+ const SDK_VERSION = "1.3.6";
2019
2097
  const VERSION = "Version";
2020
2098
  const SERVICE = "Service";
2021
2099
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -2864,6 +2942,13 @@ class EntityService extends BaseService {
2864
2942
  * { fieldName: "product_name", type: EntityFieldDataType.STRING, isRequired: true, isUnique: true },
2865
2943
  * { fieldName: "price", type: EntityFieldDataType.INTEGER, defaultValue: "0" },
2866
2944
  * ], { displayName: "Product Catalog", description: "Our product catalog", isRbacEnabled: true });
2945
+ *
2946
+ * // With advanced sqlType constraints (lengthLimit, decimalPrecision, maxValue, minValue) and defaultValue
2947
+ * const ordersId = await entities.create("orders", [
2948
+ * { fieldName: "product_name", type: EntityFieldDataType.STRING, isRequired: true, isUnique: true, lengthLimit: 500 },
2949
+ * { fieldName: "price", type: EntityFieldDataType.DECIMAL, decimalPrecision: 4, maxValue: 999999, minValue: 0 },
2950
+ * { fieldName: "quantity", type: EntityFieldDataType.INTEGER, maxValue: 10000, minValue: 1, defaultValue: "0" },
2951
+ * ]);
2867
2952
  * ```
2868
2953
  * @internal
2869
2954
  */
@@ -2937,6 +3022,17 @@ class EntityService extends BaseService {
2937
3022
  * updateFields: [{ id: "<fieldId>", displayName: "Unit Price", isRequired: true }],
2938
3023
  * displayName: "Price Catalog",
2939
3024
  * });
3025
+ *
3026
+ * // Add a STRING/DECIMAL field with explicit advanced sqlType constraints and defaultValue
3027
+ * await entities.updateById("<entityId>", {
3028
+ * addFields: [
3029
+ * { fieldName: "summary", type: EntityFieldDataType.STRING, lengthLimit: 500, defaultValue: "summary" },
3030
+ * { fieldName: "amount", type: EntityFieldDataType.DECIMAL, decimalPrecision: 4, maxValue: 999999, minValue: 0 },
3031
+ * ],
3032
+ * updateFields: [
3033
+ * { id: "<fieldId>", lengthLimit: 1000 },
3034
+ * ],
3035
+ * });
2940
3036
  * ```
2941
3037
  * @internal
2942
3038
  */
@@ -2980,6 +3076,21 @@ class EntityService extends BaseService {
2980
3076
  const update = updateMap.get(f.id ?? '');
2981
3077
  if (!update)
2982
3078
  return f;
3079
+ const constraintUpdate = {
3080
+ ...(update.lengthLimit !== undefined && { lengthLimit: update.lengthLimit }),
3081
+ ...(update.maxValue !== undefined && { maxValue: update.maxValue }),
3082
+ ...(update.minValue !== undefined && { minValue: update.minValue }),
3083
+ ...(update.decimalPrecision !== undefined && { decimalPrecision: update.decimalPrecision }),
3084
+ };
3085
+ const hasConstraintUpdate = Object.keys(constraintUpdate).length > 0;
3086
+ if (hasConstraintUpdate) {
3087
+ if (!f.sqlType) {
3088
+ throw new ValidationError({
3089
+ message: `Cannot update constraints on field '${f.name}' (id: ${f.id}) — the field is missing sqlType metadata in the entity definition.`,
3090
+ });
3091
+ }
3092
+ this.validateFieldConstraints(this.resolveFieldDataType(f), update, f.name);
3093
+ }
2983
3094
  return {
2984
3095
  ...f,
2985
3096
  ...(update.displayName !== undefined && { displayName: update.displayName }),
@@ -2989,6 +3100,7 @@ class EntityService extends BaseService {
2989
3100
  ...(update.isRbacEnabled !== undefined && { isRbacEnabled: update.isRbacEnabled }),
2990
3101
  ...(update.isEncrypted !== undefined && { isEncrypted: update.isEncrypted }),
2991
3102
  ...(update.defaultValue !== undefined && { defaultValue: update.defaultValue }),
3103
+ ...(hasConstraintUpdate && f.sqlType && { sqlType: { ...f.sqlType, ...constraintUpdate } }),
2992
3104
  };
2993
3105
  });
2994
3106
  }
@@ -3038,24 +3150,27 @@ class EntityService extends BaseService {
3038
3150
  let transformedField = transformData(field, EntityMap);
3039
3151
  // Map field type: prefer fieldDisplayType for types that share SQL types (File, ChoiceSet, AutoNumber)
3040
3152
  if (transformedField.fieldDataType?.name) {
3041
- const displayTypeMapped = transformedField.fieldDisplayType
3042
- ? FieldDisplayTypeToDataType[transformedField.fieldDisplayType]
3043
- : undefined;
3044
- if (displayTypeMapped) {
3045
- transformedField.fieldDataType.name = displayTypeMapped;
3046
- }
3047
- else {
3048
- const rawSqlTypeName = field.sqlType?.name;
3049
- const mapped = rawSqlTypeName ? EntityFieldTypeMap[rawSqlTypeName] : undefined;
3050
- if (mapped) {
3051
- transformedField.fieldDataType.name = mapped;
3052
- }
3153
+ const mapped = this.tryResolveFieldDataType(transformedField.fieldDisplayType, field.sqlType?.name);
3154
+ if (mapped) {
3155
+ transformedField.fieldDataType.name = mapped;
3053
3156
  }
3054
3157
  }
3055
3158
  this.transformNestedReferences(transformedField);
3056
3159
  return transformedField;
3057
3160
  });
3058
3161
  }
3162
+ /**
3163
+ * Resolves an {@link EntityFieldDataType} from a field's `fieldDisplayType` and
3164
+ * raw SQL type name. Prefers `fieldDisplayType` to disambiguate types that
3165
+ * share a SQL type (FILE, CHOICE_SET_*, AUTO_NUMBER, RELATIONSHIP); falls back
3166
+ * to the SQL-type-name mapping. Returns `undefined` if neither resolves.
3167
+ */
3168
+ tryResolveFieldDataType(fieldDisplayType, sqlTypeName) {
3169
+ const displayMapped = fieldDisplayType ? FieldDisplayTypeToDataType[fieldDisplayType] : undefined;
3170
+ if (displayMapped)
3171
+ return displayMapped;
3172
+ return sqlTypeName ? EntityFieldTypeMap[sqlTypeName] : undefined;
3173
+ }
3059
3174
  /**
3060
3175
  * Transforms nested reference objects in field metadata
3061
3176
  */
@@ -3096,11 +3211,16 @@ class EntityService extends BaseService {
3096
3211
  /** Converts a user-facing EntityCreateFieldOptions to the raw API field payload */
3097
3212
  buildSchemaFieldPayload(field) {
3098
3213
  this.validateName(field.fieldName, 'field');
3099
- const mapping = EntitySchemaFieldTypeMap[field.type ?? exports.EntityFieldDataType.STRING];
3214
+ const fieldType = field.type ?? exports.EntityFieldDataType.STRING;
3215
+ this.validateFieldConstraints(fieldType, field, field.fieldName);
3216
+ const mapping = EntitySchemaFieldTypeMap[fieldType];
3100
3217
  return {
3101
3218
  name: field.fieldName,
3102
3219
  displayName: field.displayName ?? field.fieldName,
3103
- sqlType: { name: mapping.sqlTypeName },
3220
+ sqlType: {
3221
+ name: mapping.sqlTypeName,
3222
+ ...this.buildSqlTypeConstraints(fieldType, field),
3223
+ },
3104
3224
  fieldDisplayType: mapping.fieldDisplayType,
3105
3225
  description: field.description ?? '',
3106
3226
  isRequired: field.isRequired ?? false,
@@ -3113,6 +3233,107 @@ class EntityService extends BaseService {
3113
3233
  ...(field.referenceFieldName !== undefined && { referenceFieldName: field.referenceFieldName }),
3114
3234
  };
3115
3235
  }
3236
+ /**
3237
+ * Derives the user-facing {@link EntityFieldDataType} for a field on the raw
3238
+ * API response. Throws if the field's `fieldDisplayType` and `sqlType.name`
3239
+ * are both unmappable.
3240
+ */
3241
+ resolveFieldDataType(f) {
3242
+ const mapped = this.tryResolveFieldDataType(f.fieldDisplayType, f.sqlType?.name);
3243
+ if (!mapped) {
3244
+ throw new ValidationError({
3245
+ message: `Cannot determine field type for '${f.name}' (id: ${f.id}) — sqlType '${f.sqlType?.name ?? '(missing)'}' and fieldDisplayType '${f.fieldDisplayType ?? '(missing)'}' are both unrecognized.`,
3246
+ });
3247
+ }
3248
+ return mapped;
3249
+ }
3250
+ /**
3251
+ * Validates that the user-supplied constraint properties on a field are
3252
+ * supported by the field's data type. Throws a `ValidationError` listing
3253
+ * any unsupported properties.
3254
+ */
3255
+ validateFieldConstraints(type, field, fieldName) {
3256
+ const spec = ENTITY_FIELD_CONSTRAINT_SPEC[type] ?? {};
3257
+ const supported = Object.keys(spec);
3258
+ const provided = Object.values(EntityFieldConstraint).filter(name => field[name] !== undefined);
3259
+ const unsupported = provided.filter(p => !(p in spec));
3260
+ if (unsupported.length > 0) {
3261
+ const allowedDesc = supported.length > 0 ? supported.join(', ') : 'none';
3262
+ throw new ValidationError({
3263
+ message: `Field '${fieldName}' of type ${type} does not accept ${unsupported.join(', ')}. Allowed constraints for this type: ${allowedDesc}.`,
3264
+ });
3265
+ }
3266
+ // Range check: each user-supplied constraint must be within its allowed bounds.
3267
+ for (const name of provided) {
3268
+ const range = spec[name];
3269
+ const value = field[name];
3270
+ if (range && value !== undefined && (value < range.min || value > range.max)) {
3271
+ throw new ValidationError({
3272
+ message: `Field '${fieldName}' of type ${type} has ${name} ${value} out of range [${range.min}, ${range.max}].`,
3273
+ });
3274
+ }
3275
+ }
3276
+ // Cross-field check: when both bounds are user-supplied in the same call,
3277
+ // minValue must be strictly less than maxValue.
3278
+ if (field.minValue !== undefined && field.maxValue !== undefined && field.minValue >= field.maxValue) {
3279
+ throw new ValidationError({
3280
+ message: `Field '${fieldName}' of type ${type} has minValue ${field.minValue} >= maxValue ${field.maxValue}. minValue must be strictly less than maxValue.`,
3281
+ });
3282
+ }
3283
+ }
3284
+ /**
3285
+ * Returns the sqlType constraint fields for a given field type.
3286
+ *
3287
+ * The API requires specific constraint properties to be set per SQL type;
3288
+ * without them the field is stored in an incomplete state, causing
3289
+ * "Field type cannot be changed" errors when the UI later tries to edit
3290
+ * advanced options. User-supplied values from `EntityCreateFieldOptions`
3291
+ * override the defaults where the type accepts overrides.
3292
+ */
3293
+ buildSqlTypeConstraints(type, field) {
3294
+ const defaults = ENTITY_FIELD_CONSTRAINT_DEFAULTS;
3295
+ switch (type) {
3296
+ case exports.EntityFieldDataType.STRING:
3297
+ return { lengthLimit: field.lengthLimit ?? defaults.STRING_LENGTH_LIMIT };
3298
+ case exports.EntityFieldDataType.MULTILINE_TEXT:
3299
+ return { lengthLimit: field.lengthLimit ?? defaults.MULTILINE_TEXT_LENGTH_LIMIT };
3300
+ case exports.EntityFieldDataType.DECIMAL:
3301
+ return {
3302
+ lengthLimit: defaults.DECIMAL_LENGTH_LIMIT,
3303
+ decimalPrecision: field.decimalPrecision ?? defaults.DECIMAL_PRECISION,
3304
+ maxValue: field.maxValue ?? defaults.NUMERIC_MAX_VALUE,
3305
+ minValue: field.minValue ?? defaults.NUMERIC_MIN_VALUE,
3306
+ };
3307
+ case exports.EntityFieldDataType.BOOLEAN:
3308
+ return { lengthLimit: defaults.BOOLEAN_LENGTH_LIMIT };
3309
+ case exports.EntityFieldDataType.DATE:
3310
+ case exports.EntityFieldDataType.DATETIME_WITH_TZ:
3311
+ return { lengthLimit: defaults.DATE_LENGTH_LIMIT };
3312
+ case exports.EntityFieldDataType.INTEGER:
3313
+ case exports.EntityFieldDataType.BIG_INTEGER:
3314
+ return {
3315
+ maxValue: field.maxValue ?? defaults.NUMERIC_MAX_VALUE,
3316
+ minValue: field.minValue ?? defaults.NUMERIC_MIN_VALUE,
3317
+ };
3318
+ case exports.EntityFieldDataType.FLOAT:
3319
+ case exports.EntityFieldDataType.DOUBLE:
3320
+ return {
3321
+ decimalPrecision: field.decimalPrecision ?? defaults.DECIMAL_PRECISION,
3322
+ maxValue: field.maxValue ?? defaults.NUMERIC_MAX_VALUE,
3323
+ minValue: field.minValue ?? defaults.NUMERIC_MIN_VALUE,
3324
+ };
3325
+ case exports.EntityFieldDataType.FILE:
3326
+ case exports.EntityFieldDataType.RELATIONSHIP:
3327
+ // UNIQUEIDENTIFIER fixed lengthLimit (300)
3328
+ return { lengthLimit: defaults.UNIQUEIDENTIFIER_LENGTH_LIMIT };
3329
+ case exports.EntityFieldDataType.CHOICE_SET_MULTIPLE:
3330
+ // CHOICE_SET_MULTIPLE fixed lengthLimit (4000)
3331
+ return { lengthLimit: defaults.CHOICE_SET_MULTIPLE_LENGTH_LIMIT };
3332
+ default:
3333
+ // UUID, CHOICE_SET_SINGLE, AUTO_NUMBER, DATETIME — (sqlType: { name })
3334
+ return {};
3335
+ }
3336
+ }
3116
3337
  validateName(name, context) {
3117
3338
  if (name.length < 3 || name.length > 100 || !/^[a-zA-Z]\w*$/.test(name)) {
3118
3339
  const suggestion = name.replace(/\W/g, '').replace(/^[0-9_]+/, '');