@uipath/data-fabric-tool 1.201.0-preview.115 → 1.201.0-preview.121

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.
@@ -6595,7 +6595,7 @@ var require_src6 = __commonJS((exports) => {
6595
6595
  var package_default = {
6596
6596
  name: "@uipath/data-fabric-tool",
6597
6597
  license: "MIT",
6598
- version: "1.201.0-preview.115",
6598
+ version: "1.201.0-preview.121",
6599
6599
  description: "Manage Data Fabric entities and records.",
6600
6600
  type: "module",
6601
6601
  main: "./dist/tool.js",
@@ -6618,7 +6618,7 @@ var package_default = {
6618
6618
  "@uipath/common": "workspace:*",
6619
6619
  "@uipath/auth": "workspace:*",
6620
6620
  "@uipath/filesystem": "workspace:*",
6621
- "@uipath/uipath-typescript": "^1.5.4",
6621
+ "@uipath/uipath-typescript": "^1.6.1",
6622
6622
  "@types/node": "^25.5.2",
6623
6623
  typescript: "^7.0.2"
6624
6624
  }
@@ -6681,17 +6681,18 @@ var TLS_ERROR_CODES = new Set([
6681
6681
  ]);
6682
6682
  var TLS_INSTRUCTIONS = "The server's TLS certificate could not be verified. Most often a " + "corporate proxy/firewall re-signs HTTPS with a root CA that Node does " + "not trust — set NODE_EXTRA_CA_CERTS to that CA's PEM file (and HTTPS_PROXY " + "if you connect through a proxy). If the certificate is instead expired or " + "its hostname does not match, fix the endpoint URL or the system clock. " + "Then retry.";
6683
6683
  var NETWORK_INSTRUCTIONS = "Could not reach the UiPath service. Check your network connection and " + "VPN, confirm any HTTP_PROXY/HTTPS_PROXY/NO_PROXY settings are correct, " + "then retry.";
6684
+ var LOCAL_PERMISSION_ERROR_CODES = new Set(["EACCES", "EPERM", "EROFS"]);
6685
+ var LOCAL_PERMISSION_MESSAGE_PATTERN = /\b(EACCES|EPERM|EROFS)\b/;
6686
+ function localPermissionInstructions(code, path) {
6687
+ const target = path !== undefined ? `'${path}'` : "a local file or resource";
6688
+ if (code === "EROFS") {
6689
+ return `The filesystem containing ${target} is read-only (EROFS), so the ` + "CLI could not write to it. This is a local environment problem, " + "not a UiPath service error — retrying will not help. Use a " + "writable location, or give this environment write access to the " + "path.";
6690
+ }
6691
+ const remedy = process.platform === "win32" ? "Re-run from an elevated terminal, close any program holding " + "the file open, or grant your user access to the path." : "Grant this user (or the sandbox the command runs in) access " + "to the path, or run the command outside the sandbox.";
6692
+ return `The operating system denied access to ${target} (${code}). This is ` + "a local permission problem, not a UiPath service error — retrying " + `without a permission change will not help. ${remedy}`;
6693
+ }
6684
6694
  function describeConnectivityError(error) {
6685
- const queue = [error];
6686
- const seen = new Set;
6687
- for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
6688
- const current = queue.shift();
6689
- if (current === null || typeof current !== "object")
6690
- continue;
6691
- if (seen.has(current))
6692
- continue;
6693
- seen.add(current);
6694
- const cur = current;
6695
+ for (const cur of walkErrorGraph(error)) {
6695
6696
  const code = typeof cur.code === "string" ? cur.code : undefined;
6696
6697
  const message = typeof cur.message === "string" ? cur.message : undefined;
6697
6698
  if (code && TLS_ERROR_CODES.has(code)) {
@@ -6710,6 +6711,49 @@ function describeConnectivityError(error) {
6710
6711
  instructions: NETWORK_INSTRUCTIONS
6711
6712
  };
6712
6713
  }
6714
+ }
6715
+ return;
6716
+ }
6717
+ function describePermissionError(error) {
6718
+ for (const cur of walkErrorGraph(error)) {
6719
+ const message = typeof cur.message === "string" ? cur.message : undefined;
6720
+ const code = matchLocalPermissionCode(cur.code, message);
6721
+ if (!code)
6722
+ continue;
6723
+ const path = localPermissionPath(cur.path, message);
6724
+ return {
6725
+ code,
6726
+ message: message ?? code,
6727
+ ...path !== undefined ? { path } : {},
6728
+ instructions: localPermissionInstructions(code, path)
6729
+ };
6730
+ }
6731
+ return;
6732
+ }
6733
+ function matchLocalPermissionCode(code, message) {
6734
+ if (typeof code === "string" && LOCAL_PERMISSION_ERROR_CODES.has(code)) {
6735
+ return code;
6736
+ }
6737
+ const match = message ? LOCAL_PERMISSION_MESSAGE_PATTERN.exec(message) : null;
6738
+ return match ? match[1] : undefined;
6739
+ }
6740
+ function localPermissionPath(path, message) {
6741
+ if (typeof path === "string")
6742
+ return path;
6743
+ return message ? /'([^']+)'/.exec(message)?.[1] : undefined;
6744
+ }
6745
+ function* walkErrorGraph(error) {
6746
+ const queue = [error];
6747
+ const seen = new Set;
6748
+ for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
6749
+ const current = queue.shift();
6750
+ if (current === null || typeof current !== "object")
6751
+ continue;
6752
+ if (seen.has(current))
6753
+ continue;
6754
+ seen.add(current);
6755
+ const cur = current;
6756
+ yield cur;
6713
6757
  if (cur.cause !== undefined)
6714
6758
  queue.push(cur.cause);
6715
6759
  if (Array.isArray(cur.errors))
@@ -6770,6 +6814,12 @@ function classifyError(status, error) {
6770
6814
  if (status !== undefined && status >= 500 && status < 600) {
6771
6815
  return { errorCode: "server_error", retry: "RetryLater" };
6772
6816
  }
6817
+ if (status === undefined && describePermissionError(error)) {
6818
+ return {
6819
+ errorCode: "local_permission_denied",
6820
+ retry: "RetryWillNotFix"
6821
+ };
6822
+ }
6773
6823
  const connectivity = describeConnectivityError(error);
6774
6824
  if (connectivity) {
6775
6825
  return {
@@ -6872,6 +6922,16 @@ async function extractErrorDetails(error, options) {
6872
6922
  message = `${message}: ${connectivity.message}`;
6873
6923
  }
6874
6924
  }
6925
+ const permission = status === undefined ? describePermissionError(error) : undefined;
6926
+ if (permission) {
6927
+ if (permission.message !== message && !message.includes(permission.message)) {
6928
+ message = `${message}: ${permission.message}`;
6929
+ }
6930
+ if (!message.includes(permission.instructions)) {
6931
+ const punctuated = message.endsWith(".") ? message : `${message}.`;
6932
+ message = `${punctuated} ${permission.instructions}`;
6933
+ }
6934
+ }
6875
6935
  let details = rawMessage;
6876
6936
  if (rawBody) {
6877
6937
  if (parsedBody) {
@@ -6911,6 +6971,9 @@ async function extractErrorDetails(error, options) {
6911
6971
  if (parsedBody?.traceId && typeof parsedBody.traceId === "string") {
6912
6972
  context.traceId = parsedBody.traceId;
6913
6973
  }
6974
+ if (permission?.path !== undefined) {
6975
+ context.path = permission.path;
6976
+ }
6914
6977
  if (status === 429) {
6915
6978
  const resp = response;
6916
6979
  const headersObj = resp?.headers;
@@ -8153,6 +8216,7 @@ var CLI_ERROR_CODES = [
8153
8216
  "invalid_argument",
8154
8217
  "authentication_required",
8155
8218
  "permission_denied",
8219
+ "local_permission_denied",
8156
8220
  "not_found",
8157
8221
  "rate_limited",
8158
8222
  "network_error",
@@ -8588,12 +8652,16 @@ function defaultErrorCodeForHttpStatus(status) {
8588
8652
  return "server_error";
8589
8653
  return;
8590
8654
  }
8655
+ var LOCAL_PERMISSION_TEXT_PATTERN = /(?:\b|\()(?:EACCES|EPERM|EROFS)(?::\s|\))/;
8591
8656
  function defaultErrorCodeForFailure(data) {
8592
8657
  if (data.Result === RESULTS.Failure) {
8593
8658
  const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage2(data.Message);
8594
8659
  const errorCode = defaultErrorCodeForHttpStatus(status);
8595
8660
  if (errorCode)
8596
8661
  return errorCode;
8662
+ if (status === undefined && (LOCAL_PERMISSION_TEXT_PATTERN.test(data.Message) || LOCAL_PERMISSION_TEXT_PATTERN.test(data.Instructions))) {
8663
+ return "local_permission_denied";
8664
+ }
8597
8665
  }
8598
8666
  return defaultErrorCodeForResult(data.Result);
8599
8667
  }
@@ -9112,9 +9180,6 @@ var ScreenLogger;
9112
9180
  })(ScreenLogger ||= {});
9113
9181
  // ../common/src/sdk-user-agent.ts
9114
9182
  var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
9115
- // ../common/src/tool-provider.ts
9116
- var factorySlot = singleton("PackagerFactoryProvider");
9117
- var moduleSlot = singleton("ToolModuleProvider");
9118
9183
  // ../common/src/stdin.ts
9119
9184
  async function readStdin() {
9120
9185
  if (process.stdin.isTTY) {
@@ -9132,6 +9197,8 @@ async function readStdin() {
9132
9197
  }
9133
9198
  // ../common/src/telemetry/ship-succeeded.ts
9134
9199
  var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
9200
+ // ../common/src/tool-provider.ts
9201
+ var factorySlot = singleton("PackagerFactoryProvider");
9135
9202
  // src/utils/output.ts
9136
9203
  function fail(message, instructions) {
9137
9204
  OutputFormatter.error({
@@ -9141,6 +9208,16 @@ function fail(message, instructions) {
9141
9208
  });
9142
9209
  processContext.exit(1);
9143
9210
  }
9211
+ function failInvalidArgument(message, instructions) {
9212
+ OutputFormatter.error({
9213
+ Result: RESULTS.Failure,
9214
+ Message: message,
9215
+ Instructions: instructions,
9216
+ ErrorCode: "invalid_argument",
9217
+ Retry: "RetryWillNotFix"
9218
+ });
9219
+ processContext.exit(1);
9220
+ }
9144
9221
  function requireDestructiveConfirmation(options, operation, reasonInstruction) {
9145
9222
  if (options.confirm === true && options.yes !== true) {
9146
9223
  warnDeprecatedOptionAlias("--confirm", "--yes");
@@ -9150,7 +9227,7 @@ function requireDestructiveConfirmation(options, operation, reasonInstruction) {
9150
9227
  }
9151
9228
  const reason = options.reason?.trim();
9152
9229
  if (reason === undefined || reason === "") {
9153
- fail("Reason required for destructive operation", reasonInstruction);
9230
+ failInvalidArgument("Reason required for destructive operation", reasonInstruction);
9154
9231
  return null;
9155
9232
  }
9156
9233
  return reason;
@@ -10396,6 +10473,9 @@ function normalizeTokenRefreshUnavailableFailure() {
10396
10473
  function errorMessage(error) {
10397
10474
  return error instanceof Error ? error.message : String(error);
10398
10475
  }
10476
+ // ../auth/src/tenantSelection.ts
10477
+ var IDENTIFIER_STATUSES = new Set([400, 403, 404]);
10478
+
10399
10479
  // ../auth/src/selectTenant.ts
10400
10480
  var TENANT_SELECTION_REQUIRED_CODE = "TENANT_SELECTION_REQUIRED";
10401
10481
  var INVALID_TENANT_CODE = "INVALID_TENANT";
@@ -14570,7 +14650,23 @@ var TASK_ENDPOINTS = {
14570
14650
  COMPLETE_GENERIC_TASK: `${ORCHESTRATOR_BASE}/tasks/GenericTasks/CompleteTask`,
14571
14651
  GET_TASK_FORM_BY_ID: `${ORCHESTRATOR_BASE}/forms/TaskForms/GetTaskFormById`,
14572
14652
  GET_GENERIC_TASK_BY_ID: `${ORCHESTRATOR_BASE}/tasks/GenericTasks/GetTaskDataById`,
14573
- GET_APP_TASK_BY_ID: `${ORCHESTRATOR_BASE}/tasks/AppTasks/GetAppTaskById`
14653
+ GET_GENERIC_TASK_BY_KEY: `${ORCHESTRATOR_BASE}/tasks/GenericTasks/GetTaskDataByKey`,
14654
+ GET_APP_TASK_BY_ID: `${ORCHESTRATOR_BASE}/tasks/AppTasks/GetAppTaskById`,
14655
+ SAVE_TASK_TAGS: `${ORCHESTRATOR_BASE}/tasks/GenericTasks/SaveTaskTags`,
14656
+ SAVE_TASK_DATA: `${ORCHESTRATOR_BASE}/tasks/GenericTasks/SaveTaskData`,
14657
+ SAVE_FORM_TASK_DATA: `${ORCHESTRATOR_BASE}/forms/TaskForms/SaveTaskData`,
14658
+ SAVE_APP_TASK_DATA: `${ORCHESTRATOR_BASE}/tasks/AppTasks/SaveAppTasksData`,
14659
+ EDIT_TASK_METADATA: `${ORCHESTRATOR_BASE}/odata/Tasks/UiPath.Server.Configuration.OData.EditTaskMetadata`
14660
+ };
14661
+ var TASK_CATALOG_ENDPOINTS = {
14662
+ GET_ALL: `${ORCHESTRATOR_BASE}/odata/TaskCatalogs`,
14663
+ GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/TaskCatalogs(${id})`,
14664
+ CREATE: `${ORCHESTRATOR_BASE}/odata/TaskCatalogs/UiPath.Server.Configuration.OData.CreateTaskCatalog`,
14665
+ UPDATE: (id) => `${ORCHESTRATOR_BASE}/odata/TaskCatalogs(${id})/UiPath.Server.Configuration.OData.UpdateTaskCatalog`
14666
+ };
14667
+ var TASK_NOTE_ENDPOINTS = {
14668
+ GET_BY_TASK_ID: (taskId) => `${ORCHESTRATOR_BASE}/odata/TaskNotes/UiPath.Server.Configuration.OData.GetByTaskId(taskId=${taskId})`,
14669
+ CREATE: `${ORCHESTRATOR_BASE}/odata/TaskNotes/UiPath.Server.Configuration.OData.CreateTaskNote`
14574
14670
  };
14575
14671
  var BUCKET_ENDPOINTS = {
14576
14672
  GET_BY_FOLDER: `${ORCHESTRATOR_BASE}/odata/Buckets`,
@@ -14597,7 +14693,11 @@ var JOB_ENDPOINTS = {
14597
14693
  GET_BY_KEY: (identifier) => `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.GetByKey(identifier=${identifier})`,
14598
14694
  STOP: `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.StopJobs`,
14599
14695
  RESUME: `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.ResumeJob`,
14600
- RESTART: `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.RestartJob`
14696
+ RESTART: `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.RestartJob`,
14697
+ ATTACHMENTS: {
14698
+ GET_BY_JOB_KEY: `${ORCHESTRATOR_BASE}/api/JobAttachments/GetByJobKey`,
14699
+ LINK: `${ORCHESTRATOR_BASE}/api/JobAttachments/Post`
14700
+ }
14601
14701
  };
14602
14702
  var ASSET_ENDPOINTS = {
14603
14703
  GET_BY_FOLDER: `${ORCHESTRATOR_BASE}/odata/Assets/UiPath.Server.Configuration.OData.GetFiltered`,
@@ -14605,7 +14705,8 @@ var ASSET_ENDPOINTS = {
14605
14705
  GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/Assets(${id})`
14606
14706
  };
14607
14707
  var ORCHESTRATOR_ATTACHMENT_ENDPOINTS = {
14608
- GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/Attachments(${id})`
14708
+ GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/Attachments(${id})`,
14709
+ CREATE: `${ORCHESTRATOR_BASE}/odata/Attachments`
14609
14710
  };
14610
14711
  var MAESTRO_ENDPOINTS = {
14611
14712
  PROCESSES: {
@@ -14668,6 +14769,7 @@ var DATA_FABRIC_ENDPOINTS = {
14668
14769
  DELETE: (entityId) => `${DATAFABRIC_BASE}/api/Entity/${entityId}`,
14669
14770
  UPDATE_METADATA: (entityId) => `${DATAFABRIC_BASE}/api/Entity/${entityId}/metadata`,
14670
14771
  QUERY_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/query`,
14772
+ QUERY_BY_NAME: (entityName) => `${DATAFABRIC_BASE}/api/EntityService/${entityName}/query`,
14671
14773
  BULK_UPLOAD_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/bulk-upload`,
14672
14774
  DOWNLOAD_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
14673
14775
  UPLOAD_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
@@ -14910,7 +15012,7 @@ class EmbeddedTokenManager {
14910
15012
  this.cancelRefresh?.();
14911
15013
  }
14912
15014
  }
14913
- var SDK_VERSION = "1.5.5";
15015
+ var SDK_VERSION = "1.6.1";
14914
15016
  var CLOUD_ROLE_NAME = "uipath-ts-sdk";
14915
15017
  var SDK_SERVICE_NAME = "UiPath.TypeScript.Sdk";
14916
15018
  var SDK_LOGGER_NAME = "uipath-ts-sdk-telemetry";
@@ -15189,11 +15291,9 @@ class TokenManager {
15189
15291
  return token;
15190
15292
  }
15191
15293
  }
15192
- var GUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
15193
15294
 
15194
15295
  class AuthService {
15195
15296
  constructor(config2, executionContext) {
15196
- this.skipAcrValues = false;
15197
15297
  const isCallback = AuthService.isInOAuthCallback();
15198
15298
  const storedContext = isCallback ? AuthService.getStoredOAuthContext() : null;
15199
15299
  if (!isCallback) {
@@ -15256,9 +15356,6 @@ class AuthService {
15256
15356
  getTokenManager() {
15257
15357
  return this.tokenManager;
15258
15358
  }
15259
- setMultiLogin() {
15260
- this.skipAcrValues = true;
15261
- }
15262
15359
  async authenticate(config2) {
15263
15360
  if (!isBrowser2) {
15264
15361
  return false;
@@ -15374,9 +15471,6 @@ class AuthService {
15374
15471
  }
15375
15472
  }
15376
15473
  getAuthorizationUrl(params) {
15377
- const orgName = this.config.orgName;
15378
- const isGuid = GUID_REGEX.test(orgName);
15379
- const acrValues = isGuid ? `tenant:${orgName}` : `tenantName:${orgName}`;
15380
15474
  const queryParams = new URLSearchParams({
15381
15475
  response_type: "code",
15382
15476
  client_id: params.clientId,
@@ -15386,8 +15480,7 @@ class AuthService {
15386
15480
  scope: params.scope + " offline_access",
15387
15481
  state: params.state || this.generateCodeVerifier().slice(0, 16)
15388
15482
  });
15389
- const authorizeUrl = `${this.config.baseUrl}/${IDENTITY_ENDPOINTS.AUTHORIZE}?${queryParams.toString()}`;
15390
- return this.skipAcrValues ? authorizeUrl : `${authorizeUrl}&acr_values=${acrValues}`;
15483
+ return `${this.config.baseUrl}/${IDENTITY_ENDPOINTS.AUTHORIZE}?${queryParams.toString()}`;
15391
15484
  }
15392
15485
  async _getAccessToken(params) {
15393
15486
  const body = new URLSearchParams({
@@ -15551,7 +15644,6 @@ var _UiPath_config;
15551
15644
  var _UiPath_authService;
15552
15645
  var _UiPath_initialized;
15553
15646
  var _UiPath_partialConfig;
15554
- var _UiPath_multiLogin;
15555
15647
  var _UiPath_metaFolderKey;
15556
15648
  var _UiPath_metaOrgId;
15557
15649
  var _UiPath_metaTenantId;
@@ -15564,7 +15656,6 @@ var UiPath$1 = class UiPath {
15564
15656
  _UiPath_authService.set(this, undefined);
15565
15657
  _UiPath_initialized.set(this, false);
15566
15658
  _UiPath_partialConfig.set(this, undefined);
15567
- _UiPath_multiLogin.set(this, false);
15568
15659
  _UiPath_metaFolderKey.set(this, undefined);
15569
15660
  _UiPath_metaOrgId.set(this, undefined);
15570
15661
  _UiPath_metaTenantId.set(this, undefined);
@@ -15606,10 +15697,6 @@ var UiPath$1 = class UiPath {
15606
15697
  throw new Error(`Failed to initialize UiPath SDK: ${errorMessage2}`);
15607
15698
  }
15608
15699
  }
15609
- setMultiLogin() {
15610
- __classPrivateFieldSet(this, _UiPath_multiLogin, true, "f");
15611
- __classPrivateFieldGet(this, _UiPath_authService, "f")?.setMultiLogin();
15612
- }
15613
15700
  isInitialized() {
15614
15701
  return __classPrivateFieldGet(this, _UiPath_initialized, "f");
15615
15702
  }
@@ -15656,7 +15743,7 @@ var UiPath$1 = class UiPath {
15656
15743
  __classPrivateFieldGet(this, _UiPath_authService, "f")?.updateToken(tokenInfo);
15657
15744
  }
15658
15745
  };
15659
- _UiPath_config = new WeakMap, _UiPath_authService = new WeakMap, _UiPath_initialized = new WeakMap, _UiPath_partialConfig = new WeakMap, _UiPath_multiLogin = new WeakMap, _UiPath_metaFolderKey = new WeakMap, _UiPath_metaOrgId = new WeakMap, _UiPath_metaTenantId = new WeakMap, _UiPath_instances = new WeakSet, _UiPath_initializeWithConfig = function _UiPath_initializeWithConfig2(config2) {
15746
+ _UiPath_config = new WeakMap, _UiPath_authService = new WeakMap, _UiPath_initialized = new WeakMap, _UiPath_partialConfig = new WeakMap, _UiPath_metaFolderKey = new WeakMap, _UiPath_metaOrgId = new WeakMap, _UiPath_metaTenantId = new WeakMap, _UiPath_instances = new WeakSet, _UiPath_initializeWithConfig = function _UiPath_initializeWithConfig2(config2) {
15660
15747
  validateConfig(config2);
15661
15748
  const hasSecretAuth = hasSecretConfig(config2);
15662
15749
  const hasOAuthAuth = hasOAuthConfig(config2);
@@ -15671,9 +15758,6 @@ _UiPath_config = new WeakMap, _UiPath_authService = new WeakMap, _UiPath_initial
15671
15758
  });
15672
15759
  const executionContext = new ExecutionContext;
15673
15760
  __classPrivateFieldSet(this, _UiPath_authService, new AuthService(internalConfig, executionContext), "f");
15674
- if (__classPrivateFieldGet(this, _UiPath_multiLogin, "f")) {
15675
- __classPrivateFieldGet(this, _UiPath_authService, "f").setMultiLogin();
15676
- }
15677
15761
  __classPrivateFieldSet(this, _UiPath_config, internalConfig, "f");
15678
15762
  SDKInternalsRegistry.set(this, {
15679
15763
  config: internalConfig,
@@ -15813,7 +15897,7 @@ class ErrorResponseParser {
15813
15897
  }
15814
15898
  async parse(response) {
15815
15899
  try {
15816
- const errorBody = await response.json();
15900
+ const errorBody = await response.clone().json();
15817
15901
  const strategy = this.strategies.find((s) => s.canParse(errorBody));
15818
15902
  return strategy.parse(errorBody, response);
15819
15903
  } catch {
@@ -15898,22 +15982,20 @@ class ApiClient {
15898
15982
  async getValidToken() {
15899
15983
  return this.tokenManager.getValidToken();
15900
15984
  }
15901
- async getDefaultHeaders() {
15985
+ async getDefaultHeaders(includeDefaultContentType) {
15902
15986
  const token = await this.getValidToken();
15903
- return {
15904
- Authorization: `Bearer ${token}`,
15905
- "Content-Type": CONTENT_TYPES.JSON,
15906
- ...this.clientConfig.headers
15907
- };
15987
+ const base = { Authorization: `Bearer ${token}` };
15988
+ if (includeDefaultContentType) {
15989
+ base["Content-Type"] = CONTENT_TYPES.JSON;
15990
+ }
15991
+ return { ...base, ...this.clientConfig.headers };
15908
15992
  }
15909
15993
  async request(method, path, options = {}) {
15910
15994
  const normalizedPath = path.startsWith("/") ? path.substring(1) : path;
15911
15995
  const url = new URL(`${this.config.orgName}/${this.config.tenantName}/${normalizedPath}`, this.config.baseUrl).toString();
15912
15996
  const isFormData = options.body instanceof FormData;
15913
- const defaultHeaders = await this.getDefaultHeaders();
15914
- if (isFormData) {
15915
- delete defaultHeaders["Content-Type"];
15916
- }
15997
+ const isBodyless = isFormData || method === "GET" || method === "HEAD";
15998
+ const defaultHeaders = await this.getDefaultHeaders(!isBodyless);
15917
15999
  const traceId = crypto.randomUUID().replace(/-/g, "");
15918
16000
  const spanId = crypto.randomUUID().replace(/-/g, "").slice(0, 16);
15919
16001
  const traceparentValue = `00-${traceId}-${spanId}-01`;
@@ -16830,6 +16912,7 @@ var DataDirectionType;
16830
16912
  var JoinType;
16831
16913
  (function(JoinType2) {
16832
16914
  JoinType2["LeftJoin"] = "LeftJoin";
16915
+ JoinType2["InnerJoin"] = "InnerJoin";
16833
16916
  })(JoinType || (JoinType = {}));
16834
16917
  function createParams(paramsObj = {}) {
16835
16918
  const params = {};
@@ -16871,7 +16954,8 @@ var EntityMap = {
16871
16954
  createTime: "createdTime",
16872
16955
  updateTime: "updatedTime",
16873
16956
  sqlType: "fieldDataType",
16874
- fieldDefinition: "fieldMetaData"
16957
+ fieldDefinition: "fieldMetaData",
16958
+ isInsightsEnabled: "isAnalyticsEnabled"
16875
16959
  };
16876
16960
  var EntitySchemaFieldTypeMap = {
16877
16961
  [EntityFieldDataType.UUID]: { sqlTypeName: SqlFieldType.UNIQUEIDENTIFIER, fieldDisplayType: FieldDisplayType.Basic },
@@ -16962,6 +17046,21 @@ var EntityFieldTypeMap = {
16962
17046
  [SqlFieldType.MULTILINE]: EntityFieldDataType.MULTILINE_TEXT,
16963
17047
  [SqlFieldType.MULTILINE_MAX]: EntityFieldDataType.MULTILINE_MAX
16964
17048
  };
17049
+ var JOIN_TYPE_WIRE = {
17050
+ [JoinType.LeftJoin]: "LEFT",
17051
+ [JoinType.InnerJoin]: "INNER"
17052
+ };
17053
+ var qualifyJoinField = (entityName, field) => field.includes(".") ? field : `${entityName}.${field}`;
17054
+ function toWireJoin(join, baseEntityName) {
17055
+ return {
17056
+ type: JOIN_TYPE_WIRE[join.joinType ?? JoinType.LeftJoin],
17057
+ entity: join.relatedEntityName,
17058
+ on: {
17059
+ left: qualifyJoinField(join.entityName ?? baseEntityName, join.joinFieldName),
17060
+ right: qualifyJoinField(join.relatedEntityName, join.relatedFieldName)
17061
+ }
17062
+ };
17063
+ }
16965
17064
 
16966
17065
  class EntityService extends BaseService {
16967
17066
  async getById(id, options) {
@@ -17068,11 +17167,22 @@ class EntityService extends BaseService {
17068
17167
  message: `A maximum of ${MAX_QUERY_JOINS} joins is supported per query (received ${options.joins.length})`
17069
17168
  });
17070
17169
  }
17170
+ if (options?.joins && options.joins.length > 0 && !options.selectedFields?.length && !options.aggregates?.length) {
17171
+ throw new ValidationError({
17172
+ message: 'Join queries require selectedFields or aggregates — reference fields as "<EntityName>.<FieldName>" (e.g. "Customer.name")'
17173
+ });
17174
+ }
17071
17175
  const { folderKey, expansionLevel, ...rest } = options ?? {};
17176
+ let getEndpoint = () => DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_ID(id);
17177
+ if (options?.joins && options.joins.length > 0) {
17178
+ const baseEntityName = await this.resolveEntityName(id, folderKey);
17179
+ rest.joins = options.joins.map((join) => toWireJoin(join, baseEntityName));
17180
+ getEndpoint = () => DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_NAME(baseEntityName);
17181
+ }
17072
17182
  const downstreamOptions = options === undefined ? undefined : rest;
17073
17183
  return PaginationHelpers.getAll({
17074
17184
  serviceAccess: this.createPaginationServiceAccess(),
17075
- getEndpoint: () => DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_ID(id),
17185
+ getEndpoint,
17076
17186
  method: HTTP_METHODS.POST,
17077
17187
  headers: createHeaders({ [FOLDER_KEY]: folderKey }),
17078
17188
  queryParams: createParams({ expansionLevel }),
@@ -17175,7 +17285,7 @@ class EntityService extends BaseService {
17175
17285
  const raw = entityResponse.data;
17176
17286
  let fields = (raw.fields ?? []).filter((f) => !f.isSystemField && !f.isPrimaryKey);
17177
17287
  if (options.removeFields?.length) {
17178
- const removeSet = new Set(options.removeFields.map((r) => r.fieldName));
17288
+ const removeSet = new Set(options.removeFields.map((r) => r.name));
17179
17289
  fields = fields.filter((f) => !removeSet.has(f.name));
17180
17290
  }
17181
17291
  if (options.updateFields?.length) {
@@ -17231,6 +17341,10 @@ class EntityService extends BaseService {
17231
17341
  }
17232
17342
  }, { headers: folderHeaders });
17233
17343
  }
17344
+ async resolveEntityName(id, folderKey) {
17345
+ const response = await this.get(DATA_FABRIC_ENDPOINTS.ENTITY.GET_BY_ID(id), { headers: createHeaders({ [FOLDER_KEY]: folderKey }) });
17346
+ return transformData(response.data, EntityMap).name;
17347
+ }
17234
17348
  applyFieldMappings(metadata) {
17235
17349
  this.mapFieldTypes(metadata);
17236
17350
  this.mapExternalFields(metadata);
@@ -17313,20 +17427,20 @@ class EntityService extends BaseService {
17313
17427
  }
17314
17428
  buildSchemaFieldPayload(field, refMeta) {
17315
17429
  const fieldType = field.type ?? EntityFieldDataType.STRING;
17316
- this.validateFieldConstraints(fieldType, field, field.fieldName);
17430
+ this.validateFieldConstraints(fieldType, field, field.name);
17317
17431
  const isRelationship = fieldType === EntityFieldDataType.RELATIONSHIP;
17318
17432
  const isFile = fieldType === EntityFieldDataType.FILE;
17319
17433
  if (isRelationship && (!field.referenceEntityId || !field.referenceFieldId)) {
17320
17434
  throw new ValidationError({
17321
- message: `Field '${field.fieldName}' of type ${fieldType} requires both referenceEntityId and referenceFieldId (UUIDs of the target entity and field).`
17435
+ message: `Field '${field.name}' of type ${fieldType} requires both referenceEntityId and referenceFieldId (UUIDs of the target entity and field).`
17322
17436
  });
17323
17437
  }
17324
17438
  const mapping = EntitySchemaFieldTypeMap[fieldType];
17325
17439
  const referenceEntityBody = refMeta?.referenceEntity ?? (field.referenceEntityId === undefined ? undefined : { id: field.referenceEntityId });
17326
17440
  const referenceChoiceSetBody = refMeta?.referenceChoiceSet;
17327
17441
  return {
17328
- name: field.fieldName,
17329
- displayName: field.displayName ?? field.fieldName,
17442
+ name: field.name,
17443
+ displayName: field.displayName ?? field.name,
17330
17444
  sqlType: {
17331
17445
  name: mapping.sqlTypeName,
17332
17446
  ...this.buildSqlTypeConstraints(fieldType, field)
@@ -18145,6 +18259,13 @@ function createCaseInstanceMethods(instanceData, service) {
18145
18259
  if (!instanceData.instanceId)
18146
18260
  throw new Error("Case instance ID is undefined");
18147
18261
  return service.getStagesSlaSummary({ caseInstanceId: instanceData.instanceId });
18262
+ },
18263
+ async getVariables(options) {
18264
+ if (!instanceData.instanceId)
18265
+ throw new Error("Case instance ID is undefined");
18266
+ if (!instanceData.folderKey)
18267
+ throw new Error("Case instance folder key is undefined");
18268
+ return service.getVariables(instanceData.instanceId, instanceData.folderKey, options);
18148
18269
  }
18149
18270
  };
18150
18271
  }
@@ -18281,6 +18402,100 @@ class BpmnHelpers {
18281
18402
  };
18282
18403
  }
18283
18404
  }
18405
+ var INPUT_OUTPUT_REGEX = /<uipath:inputOutput\s+([^/]+?)(?:\/(?:>)?|>[\s\S]*?<\/uipath:inputOutput>)/g;
18406
+ var BPMN_ELEMENT_REGEX = /<bpmn:\w+\s+([^>]+)/g;
18407
+ function getVariableSource(bpmnXml) {
18408
+ const elementNameMap = new Map;
18409
+ const elementMatches = bpmnXml.matchAll(BPMN_ELEMENT_REGEX);
18410
+ for (const match of elementMatches) {
18411
+ const attributes = match[1];
18412
+ const idMatch = attributes.match(/id="([^"]+)"/);
18413
+ const nameMatch = attributes.match(/name="([^"]+)"/);
18414
+ if (idMatch && nameMatch) {
18415
+ elementNameMap.set(idMatch[1], nameMatch[1]);
18416
+ }
18417
+ }
18418
+ return elementNameMap;
18419
+ }
18420
+ function parseBpmnVariables(bpmnXml) {
18421
+ const variableMap = new Map;
18422
+ const variableSourceMap = getVariableSource(bpmnXml);
18423
+ const inputOutputMatches = bpmnXml.matchAll(INPUT_OUTPUT_REGEX);
18424
+ for (const match of inputOutputMatches) {
18425
+ const attributes = match[1];
18426
+ const idMatch = attributes.match(/id="([^"]+)"/);
18427
+ const nameMatch = attributes.match(/name="([^"]+)"/);
18428
+ const typeMatch = attributes.match(/type="([^"]+)"/);
18429
+ const elementIdMatch = attributes.match(/elementId="([^"]+)"/);
18430
+ if (idMatch && nameMatch && typeMatch && elementIdMatch) {
18431
+ const elementId = elementIdMatch[1];
18432
+ const sourceName = variableSourceMap.get(elementId) || elementId;
18433
+ const metadata = {
18434
+ id: idMatch[1],
18435
+ name: nameMatch[1],
18436
+ type: typeMatch[1],
18437
+ elementId,
18438
+ source: sourceName
18439
+ };
18440
+ variableMap.set(metadata.id, metadata);
18441
+ }
18442
+ }
18443
+ return variableMap;
18444
+ }
18445
+ function transformGlobalVariables(globals, variableMetadata) {
18446
+ const enrichedGlobalVariables = [];
18447
+ if (globals && typeof globals === "object") {
18448
+ for (const [variableId, value] of Object.entries(globals)) {
18449
+ const metadata = variableMetadata.get(variableId);
18450
+ if (metadata) {
18451
+ enrichedGlobalVariables.push({
18452
+ id: metadata.id,
18453
+ name: metadata.name,
18454
+ type: metadata.type,
18455
+ elementId: metadata.elementId,
18456
+ source: metadata.source,
18457
+ value
18458
+ });
18459
+ }
18460
+ }
18461
+ }
18462
+ return enrichedGlobalVariables;
18463
+ }
18464
+ async function fetchInstanceVariables(httpGet, instanceId, folderKey, options) {
18465
+ const queryParams = options?.parentElementId ? { parentElementId: options.parentElementId } : undefined;
18466
+ const [bpmnResult, variablesResult] = await Promise.allSettled([
18467
+ httpGet(MAESTRO_ENDPOINTS.INSTANCES.GET_BPMN(instanceId), {
18468
+ headers: createHeaders({
18469
+ [FOLDER_KEY]: folderKey,
18470
+ Accept: CONTENT_TYPES.XML
18471
+ })
18472
+ }),
18473
+ httpGet(MAESTRO_ENDPOINTS.INSTANCES.GET_VARIABLES(instanceId), {
18474
+ headers: createHeaders({ [FOLDER_KEY]: folderKey }),
18475
+ params: queryParams
18476
+ })
18477
+ ]);
18478
+ if (variablesResult.status === "rejected") {
18479
+ throw variablesResult.reason;
18480
+ }
18481
+ const response = variablesResult.value;
18482
+ let variableMetadata = new Map;
18483
+ try {
18484
+ if (bpmnResult.status === "rejected") {
18485
+ throw bpmnResult.reason;
18486
+ }
18487
+ variableMetadata = parseBpmnVariables(bpmnResult.value.data);
18488
+ } catch (error) {
18489
+ console.warn(`Failed to fetch BPMN metadata for instance ${instanceId} :`, error);
18490
+ }
18491
+ const enrichedGlobalVariables = transformGlobalVariables(response.data.globals, variableMetadata);
18492
+ return {
18493
+ elements: response.data.elements,
18494
+ globalVariables: enrichedGlobalVariables,
18495
+ instanceId: response.data.instanceId,
18496
+ parentElementId: response.data.parentElementId
18497
+ };
18498
+ }
18284
18499
  var ProcessInstanceMap = {
18285
18500
  startedTimeUtc: "startedTime",
18286
18501
  completedTimeUtc: "completedTime",
@@ -18401,85 +18616,8 @@ class ProcessInstancesService extends BaseService {
18401
18616
  data: response.data
18402
18617
  };
18403
18618
  }
18404
- parseBpmnVariables(bpmnXml) {
18405
- const variableMap = new Map;
18406
- const variableSourceMap = this.getVariableSource(bpmnXml);
18407
- const inputOutputRegex = /<uipath:inputOutput\s+([^/]+?)(?:\/(?:>)?|>[\s\S]*?<\/uipath:inputOutput>)/g;
18408
- const inputOutputMatches = bpmnXml.matchAll(inputOutputRegex);
18409
- for (const match of inputOutputMatches) {
18410
- const attributes = match[1];
18411
- const idMatch = attributes.match(/id="([^"]+)"/);
18412
- const nameMatch = attributes.match(/name="([^"]+)"/);
18413
- const typeMatch = attributes.match(/type="([^"]+)"/);
18414
- const elementIdMatch = attributes.match(/elementId="([^"]+)"/);
18415
- if (idMatch && nameMatch && typeMatch && elementIdMatch) {
18416
- const elementId = elementIdMatch[1];
18417
- const sourceName = variableSourceMap.get(elementId) || elementId;
18418
- const metadata = {
18419
- id: idMatch[1],
18420
- name: nameMatch[1],
18421
- type: typeMatch[1],
18422
- elementId,
18423
- source: sourceName
18424
- };
18425
- variableMap.set(metadata.id, metadata);
18426
- }
18427
- }
18428
- return variableMap;
18429
- }
18430
- getVariableSource(bpmnXml) {
18431
- const elementNameMap = new Map;
18432
- const elementRegex = /<bpmn:\w+\s+([^>]*id="([^"]+)"[^>]*name="([^"]+)"[^>]*)/g;
18433
- const elementMatches = bpmnXml.matchAll(elementRegex);
18434
- for (const match of elementMatches) {
18435
- const elementId = match[2];
18436
- const elementName = match[3];
18437
- if (elementId && elementName) {
18438
- elementNameMap.set(elementId, elementName);
18439
- }
18440
- }
18441
- return elementNameMap;
18442
- }
18443
- transformGlobalVariables(globals, variableMetadata) {
18444
- const enrichedGlobalVariables = [];
18445
- if (globals && typeof globals === "object") {
18446
- for (const [variableId, value] of Object.entries(globals)) {
18447
- const metadata = variableMetadata.get(variableId);
18448
- if (metadata) {
18449
- enrichedGlobalVariables.push({
18450
- id: metadata.id,
18451
- name: metadata.name,
18452
- type: metadata.type,
18453
- elementId: metadata.elementId,
18454
- source: metadata.source,
18455
- value
18456
- });
18457
- }
18458
- }
18459
- }
18460
- return enrichedGlobalVariables;
18461
- }
18462
18619
  async getVariables(instanceId, folderKey, options) {
18463
- let variableMetadata = new Map;
18464
- try {
18465
- const bpmnXml = await this.getBpmn(instanceId, folderKey);
18466
- variableMetadata = this.parseBpmnVariables(bpmnXml);
18467
- } catch (error) {
18468
- console.warn(`Failed to fetch BPMN metadata for instance ${instanceId} :`, error);
18469
- }
18470
- const queryParams = options?.parentElementId ? { parentElementId: options.parentElementId } : undefined;
18471
- const response = await this.get(MAESTRO_ENDPOINTS.INSTANCES.GET_VARIABLES(instanceId), {
18472
- headers: createHeaders({ [FOLDER_KEY]: folderKey }),
18473
- params: queryParams
18474
- });
18475
- const enrichedGlobalVariables = this.transformGlobalVariables(response.data.globals, variableMetadata);
18476
- const variablesResponse = {
18477
- elements: response.data.elements,
18478
- globalVariables: enrichedGlobalVariables,
18479
- instanceId: response.data.instanceId,
18480
- parentElementId: response.data.parentElementId
18481
- };
18482
- return variablesResponse;
18620
+ return fetchInstanceVariables((path, opts) => this.get(path, opts ?? {}), instanceId, folderKey, options);
18483
18621
  }
18484
18622
  async getIncidents(instanceId, folderKey) {
18485
18623
  const rawResponse = await this.get(MAESTRO_ENDPOINTS.INCIDENTS.GET_BY_INSTANCE(instanceId), {
@@ -18801,15 +18939,141 @@ function createTaskMethods(taskData, service) {
18801
18939
  data: options.data,
18802
18940
  action: options.action
18803
18941
  }, folderId);
18942
+ },
18943
+ async saveData(data, options) {
18944
+ if (!taskData.id)
18945
+ throw new Error("Task ID is undefined");
18946
+ return service.saveData(taskData.id, data, resolveTaskFolder({ ...options, type: taskData.type }, taskData.folderId));
18947
+ },
18948
+ async saveTags(tags, options) {
18949
+ if (!taskData.id)
18950
+ throw new Error("Task ID is undefined");
18951
+ return service.saveTags(taskData.id, tags, resolveTaskFolder(options, taskData.folderId));
18952
+ },
18953
+ async editMetadata(options) {
18954
+ if (!taskData.id)
18955
+ throw new Error("Task ID is undefined");
18956
+ return service.editMetadata(taskData.id, resolveTaskFolder(options, taskData.folderId));
18957
+ },
18958
+ getComments(options) {
18959
+ if (!taskData.id)
18960
+ throw new Error("Task ID is undefined");
18961
+ return service.getComments(taskData.id, resolveTaskFolder(options, taskData.folderId));
18962
+ },
18963
+ async createComment(text, options) {
18964
+ if (!taskData.id)
18965
+ throw new Error("Task ID is undefined");
18966
+ return service.createComment(taskData.id, text, resolveTaskFolder(options, taskData.folderId));
18804
18967
  }
18805
18968
  };
18806
18969
  }
18970
+ function resolveTaskFolder(options, folderId) {
18971
+ if (options && (options.folderId !== undefined || options.folderKey !== undefined || options.folderPath !== undefined)) {
18972
+ return options;
18973
+ }
18974
+ return { ...options, folderId };
18975
+ }
18807
18976
  function createTaskWithMethods(taskData, service) {
18808
18977
  const methods = createTaskMethods(taskData, service);
18809
18978
  return Object.assign({}, taskData, methods);
18810
18979
  }
18980
+ function resolveFolderHeaders(input) {
18981
+ const { folderId, folderKey, folderPath, resourceType, fallbackFolderKey } = input;
18982
+ const trimmedKey = folderKey?.trim();
18983
+ const trimmedPath = folderPath?.trim();
18984
+ const headers = {};
18985
+ if (folderId !== undefined) {
18986
+ headers[FOLDER_ID] = folderId;
18987
+ }
18988
+ if (trimmedKey) {
18989
+ headers[FOLDER_KEY] = trimmedKey;
18990
+ }
18991
+ if (trimmedPath) {
18992
+ headers[FOLDER_PATH_ENCODED] = encodeFolderPathHeader(trimmedPath);
18993
+ }
18994
+ if (Object.keys(headers).length === 0) {
18995
+ if (!fallbackFolderKey) {
18996
+ throw new ValidationError({
18997
+ message: `${resourceType} requires folder context: pass \`folderId\`, \`folderKey\`, or \`folderPath\`, or initialize the SDK with a folder context.`
18998
+ });
18999
+ }
19000
+ headers[FOLDER_KEY] = fallbackFolderKey;
19001
+ }
19002
+ return createHeaders(headers);
19003
+ }
19004
+ function validateName(resourceType, name) {
19005
+ if (!name) {
19006
+ throw new ValidationError({
19007
+ message: `${resourceType} name is required and cannot be empty.`
19008
+ });
19009
+ }
19010
+ const trimmed = name.trim();
19011
+ if (!trimmed) {
19012
+ throw new ValidationError({
19013
+ message: `${resourceType} name is required and cannot be empty.`
19014
+ });
19015
+ }
19016
+ return trimmed;
19017
+ }
19018
+ var SINGLE_QUOTE_RE = /'/g;
19019
+
19020
+ class FolderScopedService extends BaseService {
19021
+ async _getByFolder(endpoint, folderId, options = {}, transformFn) {
19022
+ const headers = createHeaders({ [FOLDER_ID]: folderId });
19023
+ const keysToPrefix = Object.keys(options);
19024
+ const apiOptions = addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix);
19025
+ const response = await this.get(endpoint, {
19026
+ params: apiOptions,
19027
+ headers
19028
+ });
19029
+ if (transformFn) {
19030
+ return response.data?.value.map(transformFn);
19031
+ }
19032
+ return response.data?.value;
19033
+ }
19034
+ async getByNameLookup(resourceType, endpoint, name, options, transform2, responseFieldMap) {
19035
+ const validatedName = validateName(resourceType, name);
19036
+ const { folderId, folderKey, folderPath, ...queryOptions } = options;
19037
+ const headers = resolveFolderHeaders({
19038
+ folderId,
19039
+ folderKey,
19040
+ folderPath,
19041
+ resourceType: `${resourceType}.getByName`,
19042
+ fallbackFolderKey: this.config.folderKey
19043
+ });
19044
+ const apiFieldOptions = responseFieldMap ? transformOptions(queryOptions, responseFieldMap) : queryOptions;
19045
+ const apiOptions = {
19046
+ ...addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions)),
19047
+ $filter: `Name eq '${validatedName.replace(SINGLE_QUOTE_RE, "''")}'`,
19048
+ $top: "1"
19049
+ };
19050
+ const response = await this.get(endpoint, {
19051
+ headers,
19052
+ params: apiOptions
19053
+ });
19054
+ const items = response.data?.value;
19055
+ if (!items?.length) {
19056
+ const folderHint = describeFolderForError(folderId, folderKey, folderPath);
19057
+ throw new NotFoundError({
19058
+ message: `${resourceType} '${validatedName}' not found${folderHint}.`
19059
+ });
19060
+ }
19061
+ return transform2(items[0]);
19062
+ }
19063
+ }
19064
+ function describeFolderForError(folderId, folderKey, folderPath) {
19065
+ const path = folderPath?.trim();
19066
+ if (path)
19067
+ return ` in folder '${path}'`;
19068
+ const key = folderKey?.trim();
19069
+ if (key)
19070
+ return ` in folder (key: ${key})`;
19071
+ if (typeof folderId === "number")
19072
+ return ` in folder (id: ${folderId})`;
19073
+ return "";
19074
+ }
18811
19075
 
18812
- class TaskService extends BaseService {
19076
+ class TaskService extends FolderScopedService {
18813
19077
  constructor() {
18814
19078
  super(...arguments);
18815
19079
  this.processTaskParameters = (options, folderId) => {
@@ -18952,32 +19216,139 @@ class TaskService extends BaseService {
18952
19216
  data: options
18953
19217
  };
18954
19218
  }
18955
- getByTaskType(id, folderId, taskType, options = {}) {
18956
- const endpoint = TASK_TYPE_ENDPOINTS[taskType];
18957
- const extraParams = taskType === TaskType.Form ? { expandOnFormLayout: true, ...options } : options;
18958
- return this.getTaskByTypeEndpoint(id, folderId, endpoint, extraParams);
19219
+ async getDataById(id, options) {
19220
+ if (!id) {
19221
+ throw new ValidationError({ message: "id is required for getDataById" });
19222
+ }
19223
+ const headers = this.resolveFolder(options, "Tasks.getDataById");
19224
+ return this.fetchTaskData(TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID, { taskId: id }, headers);
18959
19225
  }
18960
- async getTaskByTypeEndpoint(id, folderId, endpoint, extraParams = {}) {
18961
- const headers = createHeaders({ [FOLDER_ID]: folderId });
18962
- const response = await this.get(endpoint, {
18963
- params: {
18964
- taskId: id,
18965
- ...extraParams
18966
- },
18967
- headers
18968
- });
18969
- const transformedTask = transformData(response.data, TaskMap);
18970
- return createTaskWithMethods(applyDataTransforms(transformedTask, { field: "status", valueMap: TaskStatusMap }), this);
19226
+ async getDataByKey(key, options) {
19227
+ if (!key) {
19228
+ throw new ValidationError({ message: "key is required for getDataByKey" });
19229
+ }
19230
+ const headers = this.resolveFolder(options, "Tasks.getDataByKey");
19231
+ return this.fetchTaskData(TASK_ENDPOINTS.GET_GENERIC_TASK_BY_KEY, { taskKey: key }, headers);
18971
19232
  }
18972
- addDefaultExpand(options) {
18973
- const processedOptions = { ...options };
18974
- processedOptions.expand = processedOptions.expand ? `${DEFAULT_TASK_EXPAND},${processedOptions.expand}` : DEFAULT_TASK_EXPAND;
18975
- return processedOptions;
19233
+ async fetchTaskData(endpoint, params, headers) {
19234
+ const response = await this.get(endpoint, { params, headers });
19235
+ const { data: userPayload, ...systemFields } = response.data;
19236
+ const transformed = transformData(systemFields, TaskMap);
19237
+ const withStatus = applyDataTransforms(transformed, { field: "status", valueMap: TaskStatusMap });
19238
+ return { ...withStatus, data: userPayload ?? null };
18976
19239
  }
18977
- }
18978
- __decorate([
18979
- track("Tasks.Create")
18980
- ], TaskService.prototype, "create", null);
19240
+ async saveData(taskId, data, options) {
19241
+ if (!taskId) {
19242
+ throw new ValidationError({ message: "taskId is required for saveData" });
19243
+ }
19244
+ const headers = this.resolveFolder(options, "Tasks.saveData");
19245
+ let type = options?.type;
19246
+ if (!type) {
19247
+ const task = await this.fetchTaskData(TASK_ENDPOINTS.GET_GENERIC_TASK_BY_ID, { taskId }, headers);
19248
+ type = task.type;
19249
+ }
19250
+ let endpoint;
19251
+ switch (type) {
19252
+ case TaskType.Form:
19253
+ endpoint = TASK_ENDPOINTS.SAVE_FORM_TASK_DATA;
19254
+ break;
19255
+ case TaskType.App:
19256
+ endpoint = TASK_ENDPOINTS.SAVE_APP_TASK_DATA;
19257
+ break;
19258
+ default:
19259
+ endpoint = TASK_ENDPOINTS.SAVE_TASK_DATA;
19260
+ break;
19261
+ }
19262
+ await this.put(endpoint, { TaskId: taskId, Data: data }, { headers });
19263
+ }
19264
+ async saveTags(taskId, tags, options) {
19265
+ if (!taskId) {
19266
+ throw new ValidationError({ message: "taskId is required for saveTags" });
19267
+ }
19268
+ const headers = this.resolveFolder(options, "Tasks.saveTags");
19269
+ const body = { TaskId: taskId, Tags: tags.map((tag) => camelToPascalCaseKeys(tag)) };
19270
+ await this.put(TASK_ENDPOINTS.SAVE_TASK_TAGS, body, { headers });
19271
+ }
19272
+ async editMetadata(taskId, options) {
19273
+ if (!taskId) {
19274
+ throw new ValidationError({ message: "taskId is required for editMetadata" });
19275
+ }
19276
+ const { folderId, folderKey, folderPath, expand: _expand, select: _select, unlinkTaskCatalog, ...metadata } = options ?? {};
19277
+ const headers = resolveFolderHeaders({ folderId, folderKey, folderPath, resourceType: "Tasks.editMetadata", fallbackFolderKey: this.config.folderKey });
19278
+ const body = { taskId, ...metadata, ...unlinkTaskCatalog !== undefined ? { unsetTaskCatalog: unlinkTaskCatalog } : {} };
19279
+ await this.post(TASK_ENDPOINTS.EDIT_TASK_METADATA, camelToPascalCaseKeys(body), { headers });
19280
+ }
19281
+ async getComments(taskId, options) {
19282
+ if (!taskId) {
19283
+ throw new ValidationError({ message: "taskId is required for getComments" });
19284
+ }
19285
+ const { folderId, folderKey, folderPath, ...queryOptions } = options ?? {};
19286
+ const headers = resolveFolderHeaders({ folderId, folderKey, folderPath, resourceType: "Tasks.getComments", fallbackFolderKey: this.config.folderKey });
19287
+ const transformComment = (comment) => transformData(pascalToCamelCaseKeys(comment), TaskMap);
19288
+ const apiOptions = transformOptions(queryOptions, TaskMap);
19289
+ return PaginationHelpers.getAll({
19290
+ serviceAccess: this.createPaginationServiceAccess(),
19291
+ getEndpoint: () => TASK_NOTE_ENDPOINTS.GET_BY_TASK_ID(taskId),
19292
+ headers,
19293
+ transformFn: transformComment,
19294
+ pagination: {
19295
+ paginationType: PaginationType.OFFSET,
19296
+ itemsField: ODATA_PAGINATION.ITEMS_FIELD,
19297
+ totalCountField: ODATA_PAGINATION.TOTAL_COUNT_FIELD,
19298
+ paginationParams: {
19299
+ pageSizeParam: ODATA_OFFSET_PARAMS.PAGE_SIZE_PARAM,
19300
+ offsetParam: ODATA_OFFSET_PARAMS.OFFSET_PARAM,
19301
+ countParam: ODATA_OFFSET_PARAMS.COUNT_PARAM
19302
+ }
19303
+ }
19304
+ }, apiOptions);
19305
+ }
19306
+ async createComment(taskId, text, options) {
19307
+ if (!taskId) {
19308
+ throw new ValidationError({ message: "taskId is required for createComment" });
19309
+ }
19310
+ if (!text) {
19311
+ throw new ValidationError({ message: "text is required for createComment" });
19312
+ }
19313
+ const headers = this.resolveFolder(options, "Tasks.createComment");
19314
+ const response = await this.post(TASK_NOTE_ENDPOINTS.CREATE, camelToPascalCaseKeys({ taskId, text }), { headers });
19315
+ return transformData(pascalToCamelCaseKeys(response.data), TaskMap);
19316
+ }
19317
+ resolveFolder(options, resourceType) {
19318
+ return resolveFolderHeaders({
19319
+ folderId: options?.folderId,
19320
+ folderKey: options?.folderKey,
19321
+ folderPath: options?.folderPath,
19322
+ resourceType,
19323
+ fallbackFolderKey: this.config.folderKey
19324
+ });
19325
+ }
19326
+ getByTaskType(id, folderId, taskType, options = {}) {
19327
+ const endpoint = TASK_TYPE_ENDPOINTS[taskType];
19328
+ const extraParams = taskType === TaskType.Form ? { expandOnFormLayout: true, ...options } : options;
19329
+ return this.getTaskByTypeEndpoint(id, folderId, endpoint, extraParams);
19330
+ }
19331
+ async getTaskByTypeEndpoint(id, folderId, endpoint, extraParams = {}) {
19332
+ const headers = createHeaders({ [FOLDER_ID]: folderId });
19333
+ const response = await this.get(endpoint, {
19334
+ params: {
19335
+ taskId: id,
19336
+ ...extraParams
19337
+ },
19338
+ headers
19339
+ });
19340
+ const transformedTask = transformData(response.data, TaskMap);
19341
+ return createTaskWithMethods(applyDataTransforms(transformedTask, { field: "status", valueMap: TaskStatusMap }), this);
19342
+ }
19343
+ addDefaultExpand(options) {
19344
+ const processedOptions = { ...options };
19345
+ processedOptions.expand = processedOptions.expand ? `${DEFAULT_TASK_EXPAND},${processedOptions.expand}` : DEFAULT_TASK_EXPAND;
19346
+ return processedOptions;
19347
+ }
19348
+ }
19349
+ __decorate([
19350
+ track("Tasks.Create")
19351
+ ], TaskService.prototype, "create", null);
18981
19352
  __decorate([
18982
19353
  track("Tasks.GetUsers")
18983
19354
  ], TaskService.prototype, "getUsers", null);
@@ -18999,6 +19370,27 @@ __decorate([
18999
19370
  __decorate([
19000
19371
  track("Tasks.Complete")
19001
19372
  ], TaskService.prototype, "complete", null);
19373
+ __decorate([
19374
+ track("Tasks.GetDataById")
19375
+ ], TaskService.prototype, "getDataById", null);
19376
+ __decorate([
19377
+ track("Tasks.GetDataByKey")
19378
+ ], TaskService.prototype, "getDataByKey", null);
19379
+ __decorate([
19380
+ track("Tasks.SaveData")
19381
+ ], TaskService.prototype, "saveData", null);
19382
+ __decorate([
19383
+ track("Tasks.SaveTags")
19384
+ ], TaskService.prototype, "saveTags", null);
19385
+ __decorate([
19386
+ track("Tasks.EditMetadata")
19387
+ ], TaskService.prototype, "editMetadata", null);
19388
+ __decorate([
19389
+ track("Tasks.GetComments")
19390
+ ], TaskService.prototype, "getComments", null);
19391
+ __decorate([
19392
+ track("Tasks.CreateComment")
19393
+ ], TaskService.prototype, "createComment", null);
19002
19394
 
19003
19395
  class CaseInstancesService extends BaseService {
19004
19396
  constructor(instance) {
@@ -19151,6 +19543,9 @@ class CaseInstancesService extends BaseService {
19151
19543
  }
19152
19544
  return transformedResponse;
19153
19545
  }
19546
+ async getVariables(instanceId, folderKey, options) {
19547
+ return fetchInstanceVariables((path, opts) => this.get(path, opts ?? {}), instanceId, folderKey, options);
19548
+ }
19154
19549
  async getStages(caseInstanceId, folderKey) {
19155
19550
  const [executionHistoryResponse, caseJsonResponse] = await Promise.allSettled([
19156
19551
  this.getExecutionHistory(caseInstanceId, folderKey),
@@ -19303,6 +19698,9 @@ __decorate([
19303
19698
  __decorate([
19304
19699
  track("CaseInstances.GetExecutionHistory")
19305
19700
  ], CaseInstancesService.prototype, "getExecutionHistory", null);
19701
+ __decorate([
19702
+ track("CaseInstances.GetVariables")
19703
+ ], CaseInstancesService.prototype, "getVariables", null);
19306
19704
  __decorate([
19307
19705
  track("CaseInstances.GetStages")
19308
19706
  ], CaseInstancesService.prototype, "getStages", null);
@@ -19315,101 +19713,6 @@ __decorate([
19315
19713
  __decorate([
19316
19714
  track("CaseInstances.GetStagesSlaSummary")
19317
19715
  ], CaseInstancesService.prototype, "getStagesSlaSummary", null);
19318
- function validateName(resourceType, name) {
19319
- if (!name) {
19320
- throw new ValidationError({
19321
- message: `${resourceType} name is required and cannot be empty.`
19322
- });
19323
- }
19324
- const trimmed = name.trim();
19325
- if (!trimmed) {
19326
- throw new ValidationError({
19327
- message: `${resourceType} name is required and cannot be empty.`
19328
- });
19329
- }
19330
- return trimmed;
19331
- }
19332
- function resolveFolderHeaders(input) {
19333
- const { folderId, folderKey, folderPath, resourceType, fallbackFolderKey } = input;
19334
- const trimmedKey = folderKey?.trim();
19335
- const trimmedPath = folderPath?.trim();
19336
- const headers = {};
19337
- if (folderId !== undefined) {
19338
- headers[FOLDER_ID] = folderId;
19339
- }
19340
- if (trimmedKey) {
19341
- headers[FOLDER_KEY] = trimmedKey;
19342
- }
19343
- if (trimmedPath) {
19344
- headers[FOLDER_PATH_ENCODED] = encodeFolderPathHeader(trimmedPath);
19345
- }
19346
- if (Object.keys(headers).length === 0) {
19347
- if (!fallbackFolderKey) {
19348
- throw new ValidationError({
19349
- message: `${resourceType} requires folder context: pass \`folderId\`, \`folderKey\`, or \`folderPath\`, or initialize the SDK with a folder context.`
19350
- });
19351
- }
19352
- headers[FOLDER_KEY] = fallbackFolderKey;
19353
- }
19354
- return createHeaders(headers);
19355
- }
19356
- var SINGLE_QUOTE_RE = /'/g;
19357
-
19358
- class FolderScopedService extends BaseService {
19359
- async _getByFolder(endpoint, folderId, options = {}, transformFn) {
19360
- const headers = createHeaders({ [FOLDER_ID]: folderId });
19361
- const keysToPrefix = Object.keys(options);
19362
- const apiOptions = addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix);
19363
- const response = await this.get(endpoint, {
19364
- params: apiOptions,
19365
- headers
19366
- });
19367
- if (transformFn) {
19368
- return response.data?.value.map(transformFn);
19369
- }
19370
- return response.data?.value;
19371
- }
19372
- async getByNameLookup(resourceType, endpoint, name, options, transform2, responseFieldMap) {
19373
- const validatedName = validateName(resourceType, name);
19374
- const { folderId, folderKey, folderPath, ...queryOptions } = options;
19375
- const headers = resolveFolderHeaders({
19376
- folderId,
19377
- folderKey,
19378
- folderPath,
19379
- resourceType: `${resourceType}.getByName`,
19380
- fallbackFolderKey: this.config.folderKey
19381
- });
19382
- const apiFieldOptions = responseFieldMap ? transformOptions(queryOptions, responseFieldMap) : queryOptions;
19383
- const apiOptions = {
19384
- ...addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions)),
19385
- $filter: `Name eq '${validatedName.replace(SINGLE_QUOTE_RE, "''")}'`,
19386
- $top: "1"
19387
- };
19388
- const response = await this.get(endpoint, {
19389
- headers,
19390
- params: apiOptions
19391
- });
19392
- const items = response.data?.value;
19393
- if (!items?.length) {
19394
- const folderHint = describeFolderForError(folderId, folderKey, folderPath);
19395
- throw new NotFoundError({
19396
- message: `${resourceType} '${validatedName}' not found${folderHint}.`
19397
- });
19398
- }
19399
- return transform2(items[0]);
19400
- }
19401
- }
19402
- function describeFolderForError(folderId, folderKey, folderPath) {
19403
- const path = folderPath?.trim();
19404
- if (path)
19405
- return ` in folder '${path}'`;
19406
- const key = folderKey?.trim();
19407
- if (key)
19408
- return ` in folder (key: ${key})`;
19409
- if (typeof folderId === "number")
19410
- return ` in folder (id: ${folderId})`;
19411
- return "";
19412
- }
19413
19716
  var AssetValueScope;
19414
19717
  (function(AssetValueScope2) {
19415
19718
  AssetValueScope2["Global"] = "Global";
@@ -19856,6 +20159,20 @@ function createJobMethods(jobData, service) {
19856
20159
  if (!jobData.folderId)
19857
20160
  throw new Error("Job folderId is undefined");
19858
20161
  return service.restart(jobData.key, jobData.folderId);
20162
+ },
20163
+ async getAttachments() {
20164
+ if (!jobData.key)
20165
+ throw new Error("Job key is undefined");
20166
+ if (!jobData.folderId)
20167
+ throw new Error("Job folderId is undefined");
20168
+ return service.getAttachments(jobData.key, jobData.folderId);
20169
+ },
20170
+ async linkAttachment(attachmentId, options) {
20171
+ if (!jobData.key)
20172
+ throw new Error("Job key is undefined");
20173
+ if (!jobData.folderId)
20174
+ throw new Error("Job folderId is undefined");
20175
+ return service.linkAttachment(attachmentId, jobData.key, jobData.folderId, options);
19859
20176
  }
19860
20177
  };
19861
20178
  }
@@ -19893,10 +20210,51 @@ class AttachmentService extends BaseService {
19893
20210
  camelCased.blobFileAccess = transformData(camelCased.blobFileAccess, BucketMap);
19894
20211
  return transformData(camelCased, AttachmentsMap);
19895
20212
  }
20213
+ async create(name, content, options) {
20214
+ if (!name) {
20215
+ throw new ValidationError({ message: "name is required for create" });
20216
+ }
20217
+ if (!content) {
20218
+ throw new ValidationError({ message: "content is required for create" });
20219
+ }
20220
+ const response = await this.post(ORCHESTRATOR_ATTACHMENT_ENDPOINTS.CREATE, camelToPascalCaseKeys({
20221
+ name,
20222
+ jobKey: options?.jobKey,
20223
+ attachmentCategory: options?.category
20224
+ }), { headers: createHeaders({ [FOLDER_ID]: options?.folderId }) });
20225
+ const camelCased = pascalToCamelCaseKeys(response.data);
20226
+ camelCased.blobFileAccess = transformData(camelCased.blobFileAccess, BucketMap);
20227
+ const attachment = transformData(camelCased, AttachmentsMap);
20228
+ await this.uploadContent(attachment.blobFileAccess, content);
20229
+ const { blobFileAccess: _blobFileAccess, "@odata.context": _odataContext, ...created } = attachment;
20230
+ return created;
20231
+ }
20232
+ async uploadContent(blobFileAccess, content) {
20233
+ if (!blobFileAccess?.uri) {
20234
+ throw new ServerError({ message: "Attachment upload URI missing from the create response" });
20235
+ }
20236
+ const rawHeaders = blobFileAccess.headers;
20237
+ const requestHeaders = rawHeaders && "keys" in rawHeaders && "values" in rawHeaders ? arrayDictionaryToRecord(rawHeaders) : { ...rawHeaders };
20238
+ if (blobFileAccess.requiresAuth) {
20239
+ requestHeaders["Authorization"] = `Bearer ${await this.getValidAuthToken()}`;
20240
+ }
20241
+ const response = await fetch(blobFileAccess.uri, {
20242
+ method: "PUT",
20243
+ body: content,
20244
+ headers: createHeaders(requestHeaders)
20245
+ });
20246
+ if (!response.ok) {
20247
+ const errorInfo = await errorResponseParser.parse(response);
20248
+ throw ErrorFactory.createFromHttpStatus(response.status, errorInfo);
20249
+ }
20250
+ }
19896
20251
  }
19897
20252
  __decorate([
19898
20253
  track("Attachments.GetById")
19899
20254
  ], AttachmentService.prototype, "getById", null);
20255
+ __decorate([
20256
+ track("Attachments.Create")
20257
+ ], AttachmentService.prototype, "create", null);
19900
20258
  var PackageType;
19901
20259
  (function(PackageType2) {
19902
20260
  PackageType2["Undefined"] = "Undefined";
@@ -20141,6 +20499,38 @@ class JobService extends FolderScopedService {
20141
20499
  const rawJob = transformData(pascalToCamelCaseKeys(response.data), JobMap);
20142
20500
  return createJobWithMethods(rawJob, this);
20143
20501
  }
20502
+ async getAttachments(jobKey, folderId) {
20503
+ if (!jobKey) {
20504
+ throw new ValidationError({ message: "jobKey is required for getAttachments" });
20505
+ }
20506
+ if (!folderId) {
20507
+ throw new ValidationError({ message: "folderId is required for getAttachments" });
20508
+ }
20509
+ const response = await this.get(JOB_ENDPOINTS.ATTACHMENTS.GET_BY_JOB_KEY, {
20510
+ params: { jobKey },
20511
+ headers: createHeaders({ [FOLDER_ID]: folderId })
20512
+ });
20513
+ return transformData(response.data, JobMap);
20514
+ }
20515
+ async linkAttachment(attachmentId, jobKey, folderId, options) {
20516
+ if (!attachmentId) {
20517
+ throw new ValidationError({ message: "attachmentId is required for linkAttachment" });
20518
+ }
20519
+ if (!jobKey) {
20520
+ throw new ValidationError({ message: "jobKey is required for linkAttachment" });
20521
+ }
20522
+ if (!folderId) {
20523
+ throw new ValidationError({ message: "folderId is required for linkAttachment" });
20524
+ }
20525
+ const response = await this.post(JOB_ENDPOINTS.ATTACHMENTS.LINK, {
20526
+ attachmentId,
20527
+ jobKey,
20528
+ category: options?.category
20529
+ }, {
20530
+ headers: createHeaders({ [FOLDER_ID]: folderId })
20531
+ });
20532
+ return transformData(response.data, JobMap);
20533
+ }
20144
20534
  async downloadOutputFile(outputFileKey) {
20145
20535
  const attachment = await this.attachmentService.getById(outputFileKey);
20146
20536
  const blobAccess = attachment.blobFileAccess;
@@ -20216,6 +20606,12 @@ __decorate([
20216
20606
  __decorate([
20217
20607
  track("Jobs.Restart")
20218
20608
  ], JobService.prototype, "restart", null);
20609
+ __decorate([
20610
+ track("Jobs.GetAttachments")
20611
+ ], JobService.prototype, "getAttachments", null);
20612
+ __decorate([
20613
+ track("Jobs.LinkAttachment")
20614
+ ], JobService.prototype, "linkAttachment", null);
20219
20615
  var JobSubState;
20220
20616
  (function(JobSubState2) {
20221
20617
  JobSubState2["WithFaults"] = "WITH_FAULTS";
@@ -20389,6 +20785,112 @@ __decorate([
20389
20785
  __decorate([
20390
20786
  track("Queues.GetById")
20391
20787
  ], QueueService.prototype, "getById", null);
20788
+ var TaskCatalogMap = {
20789
+ creationTime: "createdTime",
20790
+ lastModificationTime: "lastModifiedTime"
20791
+ };
20792
+ var TaskCatalogRetentionAction;
20793
+ (function(TaskCatalogRetentionAction2) {
20794
+ TaskCatalogRetentionAction2["Delete"] = "Delete";
20795
+ TaskCatalogRetentionAction2["Archive"] = "Archive";
20796
+ TaskCatalogRetentionAction2["None"] = "None";
20797
+ })(TaskCatalogRetentionAction || (TaskCatalogRetentionAction = {}));
20798
+
20799
+ class TaskCatalogService extends FolderScopedService {
20800
+ async getAll(options) {
20801
+ const { folderId, folderKey, folderPath, ...queryOptions } = options ?? {};
20802
+ const headers = resolveFolderHeaders({ folderId, folderKey, folderPath, resourceType: "TaskCatalogs.getAll", fallbackFolderKey: this.config.folderKey });
20803
+ const transformCatalog = (catalog) => transformData(pascalToCamelCaseKeys(catalog), TaskCatalogMap);
20804
+ const apiOptions = transformOptions(queryOptions, TaskCatalogMap);
20805
+ return PaginationHelpers.getAll({
20806
+ serviceAccess: this.createPaginationServiceAccess(),
20807
+ getEndpoint: () => TASK_CATALOG_ENDPOINTS.GET_ALL,
20808
+ headers,
20809
+ transformFn: transformCatalog,
20810
+ pagination: {
20811
+ paginationType: PaginationType.OFFSET,
20812
+ itemsField: ODATA_PAGINATION.ITEMS_FIELD,
20813
+ totalCountField: ODATA_PAGINATION.TOTAL_COUNT_FIELD,
20814
+ paginationParams: {
20815
+ pageSizeParam: ODATA_OFFSET_PARAMS.PAGE_SIZE_PARAM,
20816
+ offsetParam: ODATA_OFFSET_PARAMS.OFFSET_PARAM,
20817
+ countParam: ODATA_OFFSET_PARAMS.COUNT_PARAM
20818
+ }
20819
+ }
20820
+ }, apiOptions);
20821
+ }
20822
+ async getById(id, options = {}) {
20823
+ return this.fetchById(id, options);
20824
+ }
20825
+ async fetchById(id, options = {}) {
20826
+ const { folderId, folderKey, folderPath, ...queryOptions } = options;
20827
+ const headers = resolveFolderHeaders({ folderId, folderKey, folderPath, resourceType: "TaskCatalogs.getById", fallbackFolderKey: this.config.folderKey });
20828
+ const apiFieldOptions = transformOptions(queryOptions, TaskCatalogMap);
20829
+ const apiOptions = addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions));
20830
+ const response = await this.get(TASK_CATALOG_ENDPOINTS.GET_BY_ID(id), { headers, params: apiOptions });
20831
+ return transformData(pascalToCamelCaseKeys(response.data), TaskCatalogMap);
20832
+ }
20833
+ async getByName(name, options = {}) {
20834
+ return this.getByNameLookup("TaskCatalog", TASK_CATALOG_ENDPOINTS.GET_ALL, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), TaskCatalogMap), TaskCatalogMap);
20835
+ }
20836
+ async create(name, options = {}) {
20837
+ if (!name) {
20838
+ throw new ValidationError({ message: "name is required for create" });
20839
+ }
20840
+ const { folderId, folderKey, folderPath, expand: _expand, select: _select, ...fields } = options;
20841
+ const headers = resolveFolderHeaders({ folderId, folderKey, folderPath, resourceType: "TaskCatalogs.create", fallbackFolderKey: this.config.folderKey });
20842
+ const response = await this.post(TASK_CATALOG_ENDPOINTS.CREATE, camelToPascalCaseKeys({ name, ...fields }), { headers });
20843
+ return transformData(pascalToCamelCaseKeys(response.data), TaskCatalogMap);
20844
+ }
20845
+ async updateById(id, options = {}) {
20846
+ if (!id) {
20847
+ throw new ValidationError({ message: "id is required for updateById" });
20848
+ }
20849
+ const { folderId, folderKey, folderPath } = options;
20850
+ const current = await this.fetchById(id, { folderId, folderKey, folderPath });
20851
+ return this.update(current, options);
20852
+ }
20853
+ async updateByName(name, options = {}) {
20854
+ if (!name) {
20855
+ throw new ValidationError({ message: "name is required for updateByName" });
20856
+ }
20857
+ const { folderId, folderKey, folderPath } = options;
20858
+ const current = await this.getByNameLookup("TaskCatalog", TASK_CATALOG_ENDPOINTS.GET_ALL, name, { folderId, folderKey, folderPath }, (raw) => transformData(pascalToCamelCaseKeys(raw), TaskCatalogMap), TaskCatalogMap);
20859
+ return this.update(current, options);
20860
+ }
20861
+ async update(current, options) {
20862
+ const { folderId, folderKey, folderPath } = options;
20863
+ const headers = resolveFolderHeaders({ folderId, folderKey, folderPath, resourceType: "TaskCatalogs.update", fallbackFolderKey: this.config.folderKey });
20864
+ const body = camelToPascalCaseKeys({
20865
+ name: options.name ?? current.name,
20866
+ description: options.description ?? current.description,
20867
+ encrypted: current.encrypted,
20868
+ retentionAction: options.retentionAction ?? (current.retentionAction === TaskCatalogRetentionAction.None ? null : current.retentionAction),
20869
+ retentionPeriod: options.retentionPeriod ?? current.retentionPeriod,
20870
+ retentionBucketId: options.retentionBucketId ?? current.retentionBucketId,
20871
+ ...options.tags !== undefined ? { tags: options.tags } : {}
20872
+ });
20873
+ await this.post(TASK_CATALOG_ENDPOINTS.UPDATE(current.id), body, { headers });
20874
+ }
20875
+ }
20876
+ __decorate([
20877
+ track("TaskCatalogs.GetAll")
20878
+ ], TaskCatalogService.prototype, "getAll", null);
20879
+ __decorate([
20880
+ track("TaskCatalogs.GetById")
20881
+ ], TaskCatalogService.prototype, "getById", null);
20882
+ __decorate([
20883
+ track("TaskCatalogs.GetByName")
20884
+ ], TaskCatalogService.prototype, "getByName", null);
20885
+ __decorate([
20886
+ track("TaskCatalogs.Create")
20887
+ ], TaskCatalogService.prototype, "create", null);
20888
+ __decorate([
20889
+ track("TaskCatalogs.UpdateById")
20890
+ ], TaskCatalogService.prototype, "updateById", null);
20891
+ __decorate([
20892
+ track("TaskCatalogs.UpdateByName")
20893
+ ], TaskCatalogService.prototype, "updateByName", null);
20392
20894
 
20393
20895
  class UiPath2 extends UiPath$1 {
20394
20896
  constructor() {
@@ -20437,6 +20939,14 @@ class UiPath2 extends UiPath$1 {
20437
20939
  return this.getService(AssetService);
20438
20940
  }
20439
20941
  }
20942
+ var FunctionHttpMethod;
20943
+ (function(FunctionHttpMethod2) {
20944
+ FunctionHttpMethod2["Get"] = "Get";
20945
+ FunctionHttpMethod2["Post"] = "Post";
20946
+ FunctionHttpMethod2["Put"] = "Put";
20947
+ FunctionHttpMethod2["Patch"] = "Patch";
20948
+ FunctionHttpMethod2["Delete"] = "Delete";
20949
+ })(FunctionHttpMethod || (FunctionHttpMethod = {}));
20440
20950
  var CommonFieldMap = {
20441
20951
  createdAt: "createdTime",
20442
20952
  updatedAt: "updatedTime"
@@ -20767,6 +21277,17 @@ var PolicyEvaluationResult;
20767
21277
  PolicyEvaluationResult2["SimulatedAllow"] = "SimulatedAllow";
20768
21278
  PolicyEvaluationResult2["SimulatedDeny"] = "SimulatedDeny";
20769
21279
  })(PolicyEvaluationResult || (PolicyEvaluationResult = {}));
21280
+ var PlatformSettingKey;
21281
+ (function(PlatformSettingKey2) {
21282
+ PlatformSettingKey2["UserLanguage"] = "UserLanguage.Language";
21283
+ PlatformSettingKey2["UserLanguageDate"] = "UserLanguage.Date";
21284
+ PlatformSettingKey2["UserTheme"] = "UserTheme.Theme";
21285
+ PlatformSettingKey2["UserAccessibility"] = "UserAccessibility.Accessibility";
21286
+ PlatformSettingKey2["UserAlert"] = "UserAlert.AlertDuration";
21287
+ PlatformSettingKey2["UserCaseAppOrder"] = "UserCase.AppOrderByTenant";
21288
+ PlatformSettingKey2["UserCasePinnedInstancesByTenant"] = "UserCase.PinnedInstancesByTenant";
21289
+ PlatformSettingKey2["UserCaseInstancesTableFiltersByTenant"] = "UserCase.InstancesTableFiltersByTenant";
21290
+ })(PlatformSettingKey || (PlatformSettingKey = {}));
20770
21291
  var SpanStatus;
20771
21292
  (function(SpanStatus2) {
20772
21293
  SpanStatus2["Unset"] = "Unset";
@@ -21124,7 +21645,7 @@ function findInvalidFieldName(fields) {
21124
21645
  for (const f of fields) {
21125
21646
  if (typeof f !== "object" || f === null)
21126
21647
  continue;
21127
- const fieldName = f.fieldName;
21648
+ const fieldName = f.name;
21128
21649
  if (typeof fieldName !== "string")
21129
21650
  continue;
21130
21651
  const err = validateName2(fieldName, "field");
@@ -21174,27 +21695,27 @@ function findInvalidFieldMetadata(fields, entityName) {
21174
21695
  if (typeof f !== "object" || f === null)
21175
21696
  continue;
21176
21697
  const rec = f;
21177
- const fieldName = typeof rec.fieldName === "string" ? rec.fieldName : "<field>";
21698
+ const fieldName = typeof rec.name === "string" ? rec.name : "<field>";
21178
21699
  const metadataErr = validateMetadataLengths(rec, `Field '${fieldName}'`);
21179
21700
  if (metadataErr)
21180
21701
  return metadataErr;
21181
- if (typeof rec.fieldName !== "string")
21702
+ if (typeof rec.name !== "string")
21182
21703
  continue;
21183
- const normalizedName = rec.fieldName.toLowerCase();
21704
+ const normalizedName = rec.name.toLowerCase();
21184
21705
  if (names.has(normalizedName)) {
21185
21706
  return {
21186
- message: `Duplicate field name '${rec.fieldName}' (case-insensitive)`,
21707
+ message: `Duplicate field name '${rec.name}' (case-insensitive)`,
21187
21708
  instructions: "Every field in one create/addFields batch must have a unique name, ignoring case."
21188
21709
  };
21189
21710
  }
21190
21711
  names.add(normalizedName);
21191
21712
  if (entityName !== undefined && normalizedName === entityName.toLowerCase()) {
21192
21713
  return {
21193
- message: `Field name '${rec.fieldName}' cannot match entity name '${entityName}'`,
21714
+ message: `Field name '${rec.name}' cannot match entity name '${entityName}'`,
21194
21715
  instructions: "Entity and field names are compared case-insensitively. Pick a different field name."
21195
21716
  };
21196
21717
  }
21197
- const effectiveDisplayName = typeof rec.displayName === "string" && rec.displayName.length > 0 ? rec.displayName : rec.fieldName;
21718
+ const effectiveDisplayName = typeof rec.displayName === "string" && rec.displayName.length > 0 ? rec.displayName : rec.name;
21198
21719
  const normalizedDisplayName = effectiveDisplayName.toLowerCase();
21199
21720
  if (displayNames.has(normalizedDisplayName)) {
21200
21721
  return {
@@ -21224,7 +21745,7 @@ function findUiBrokenFieldType(fields) {
21224
21745
  if (typeof type !== "string")
21225
21746
  continue;
21226
21747
  if (UI_BROKEN_FIELD_TYPES.has(type)) {
21227
- const fieldName = typeof rec.fieldName === "string" ? rec.fieldName : "<field>";
21748
+ const fieldName = typeof rec.name === "string" ? rec.name : "<field>";
21228
21749
  const substitute = UI_BROKEN_SUBSTITUTIONS[type];
21229
21750
  return {
21230
21751
  message: `Field '${fieldName}' uses type '${type}' which the Data Fabric UI cannot render`,
@@ -21241,7 +21762,7 @@ function findReferenceFolderKeyOnChoiceSet(fields) {
21241
21762
  const rec = f;
21242
21763
  const type = rec.type;
21243
21764
  if ((type === "CHOICE_SET_SINGLE" || type === "CHOICE_SET_MULTIPLE") && rec.referenceFolderKey !== undefined) {
21244
- const fieldName = typeof rec.fieldName === "string" ? rec.fieldName : "<field>";
21765
+ const fieldName = typeof rec.name === "string" ? rec.name : "<field>";
21245
21766
  return {
21246
21767
  message: `CHOICE_SET_* field '${fieldName}' must not pass 'referenceFolderKey'`,
21247
21768
  instructions: "The server resolves a choice set's folder from 'choiceSetId' alone. Passing 'referenceFolderKey' here is rejected by the platform with a misleading cross-scope error. Drop 'referenceFolderKey' from CHOICE_SET_SINGLE / CHOICE_SET_MULTIPLE field definitions."
@@ -21266,7 +21787,7 @@ function findReferenceFieldsOnFile(fields) {
21266
21787
  const invalidKeys = FILE_REFERENCE_KEYS.filter((key) => rec[key] !== undefined);
21267
21788
  if (invalidKeys.length === 0)
21268
21789
  continue;
21269
- const fieldName = typeof rec.fieldName === "string" ? rec.fieldName : "<field>";
21790
+ const fieldName = typeof rec.name === "string" ? rec.name : "<field>";
21270
21791
  return {
21271
21792
  message: `FILE field '${fieldName}' must not pass reference fields`,
21272
21793
  instructions: `FILE fields are auto-wired by the platform. Drop ${invalidKeys.map((key) => `'${key}'`).join(", ")} from the field definition.`
@@ -21282,7 +21803,7 @@ function findMissingComplexFieldExtras(fields) {
21282
21803
  const type = rec.type;
21283
21804
  if (typeof type !== "string")
21284
21805
  continue;
21285
- const fieldName = typeof rec.fieldName === "string" ? rec.fieldName : "<field>";
21806
+ const fieldName = typeof rec.name === "string" ? rec.name : "<field>";
21286
21807
  if (type === "CHOICE_SET_SINGLE" || type === "CHOICE_SET_MULTIPLE") {
21287
21808
  if (typeof rec.choiceSetId !== "string" || rec.choiceSetId.trim() === "") {
21288
21809
  return {
@@ -21323,7 +21844,7 @@ function findInvalidFieldConstraints(fields) {
21323
21844
  const type = rec.type;
21324
21845
  if (typeof type !== "string")
21325
21846
  continue;
21326
- const fieldName = typeof rec.fieldName === "string" ? rec.fieldName : "<field>";
21847
+ const fieldName = typeof rec.name === "string" ? rec.name : "<field>";
21327
21848
  if (rec.lengthLimit !== undefined) {
21328
21849
  if (!isNumber(rec.lengthLimit) || !Number.isInteger(rec.lengthLimit)) {
21329
21850
  return {
@@ -22173,7 +22694,7 @@ var registerChoiceSetValuesCommand = (program2) => {
22173
22694
  };
22174
22695
 
22175
22696
  // src/commands/directory.ts
22176
- var PRINCIPAL_TYPES = ["User", "Group", "Application"];
22697
+ var PRINCIPAL_TYPES = Object.values(DataFabricDirectoryEntityTypeName);
22177
22698
  var DIRECTORY_LIST_EXAMPLES = [
22178
22699
  {
22179
22700
  Description: "List Data Fabric directory principals and their assigned roles.",
@@ -22230,7 +22751,7 @@ var DIRECTORY_REVOKE_ROLES_EXAMPLES = [
22230
22751
  ];
22231
22752
  var parsePrincipalType = (value) => {
22232
22753
  const match = PRINCIPAL_TYPES.find((t) => t.toLowerCase() === value.toLowerCase());
22233
- return match !== undefined ? match : null;
22754
+ return match ?? null;
22234
22755
  };
22235
22756
  var parseRoleIds = (value) => value.split(",").map((id) => id.trim()).filter((id) => id !== "");
22236
22757
  var parseIntegerOption = (value) => {
@@ -22255,7 +22776,8 @@ var registerDirectoryCommand = (program2) => {
22255
22776
  const sdk = await connectOrFail(options.tenant);
22256
22777
  if (!sdk)
22257
22778
  return;
22258
- const [listError, result] = await catchError2(sdk.entities.directory.list({ skip, top }));
22779
+ const listOptions = { skip, top };
22780
+ const [listError, result] = await catchError2(sdk.entities.directory.list(listOptions));
22259
22781
  if (listError) {
22260
22782
  return fail("Error listing directory principals", await extractErrorMessage(listError));
22261
22783
  }
@@ -22277,14 +22799,15 @@ var registerDirectoryCommand = (program2) => {
22277
22799
  const sdk = await connectOrFail(options.tenant);
22278
22800
  if (!sdk)
22279
22801
  return;
22280
- const [assignError, result] = await catchError2(sdk.entities.directory.assignRoles(principalIds, principalType, roleIds, {
22802
+ const assignOptions = {
22281
22803
  ...options.replace === true && {
22282
22804
  preserveExisting: false
22283
22805
  },
22284
22806
  ...options.uiAccess === false && {
22285
22807
  uiEnabled: false
22286
22808
  }
22287
- }));
22809
+ };
22810
+ const [assignError, result] = await catchError2(sdk.entities.directory.assignRoles(principalIds, principalType, roleIds, assignOptions));
22288
22811
  if (assignError) {
22289
22812
  return fail("Error assigning roles", await extractErrorMessage(assignError));
22290
22813
  }
@@ -22395,30 +22918,29 @@ var ENTITIES_GET_EXAMPLES = [
22395
22918
  Output: {
22396
22919
  Code: "EntitySchema",
22397
22920
  Data: {
22398
- id: "a1b2c3d4-0000-0000-0000-000000000001",
22399
- name: "Invoice",
22400
- displayName: "Invoice",
22401
- entityType: "Standard",
22402
- description: "Invoice records",
22403
- isRbacEnabled: false,
22404
- fields: [
22921
+ Id: "a1b2c3d4-0000-0000-0000-000000000001",
22922
+ Name: "Invoice",
22923
+ DisplayName: "Invoice",
22924
+ EntityType: "Standard",
22925
+ Description: "Invoice records",
22926
+ IsRbacEnabled: false,
22927
+ Fields: [
22405
22928
  {
22406
- id: "f1000000-0000-0000-0000-000000000002",
22407
- name: "amount",
22408
- displayName: "Amount",
22409
- fieldDataType: { name: "DECIMAL" },
22410
- sqlType: {
22411
- name: "DECIMAL",
22412
- decimalPrecision: 2,
22413
- minValue: 0,
22414
- maxValue: 999999
22929
+ Id: "f1000000-0000-0000-0000-000000000002",
22930
+ Name: "amount",
22931
+ DisplayName: "Amount",
22932
+ FieldDataType: {
22933
+ Name: "DECIMAL",
22934
+ DecimalPrecision: 2,
22935
+ MinValue: 0,
22936
+ MaxValue: 999999
22415
22937
  },
22416
- isRequired: true,
22417
- isUnique: false,
22418
- isEncrypted: false,
22419
- isRbacEnabled: false,
22420
- isPrimaryKey: false,
22421
- isSystemField: false
22938
+ IsRequired: true,
22939
+ IsUnique: false,
22940
+ IsEncrypted: false,
22941
+ IsRbacEnabled: false,
22942
+ IsPrimaryKey: false,
22943
+ IsSystemField: false
22422
22944
  }
22423
22945
  ]
22424
22946
  }
@@ -22432,7 +22954,7 @@ var ENTITIES_DELETE_EXAMPLES = [
22432
22954
  Output: {
22433
22955
  Code: "EntityDeleted",
22434
22956
  Data: {
22435
- ID: "a1b2c3d4-0000-0000-0000-000000000001",
22957
+ Id: "a1b2c3d4-0000-0000-0000-000000000001",
22436
22958
  Reason: "test entity cleanup"
22437
22959
  }
22438
22960
  }
@@ -22440,19 +22962,49 @@ var ENTITIES_DELETE_EXAMPLES = [
22440
22962
  ];
22441
22963
  var ENTITIES_CREATE_EXAMPLES = [
22442
22964
  {
22443
- Description: "Create an entity with choice-set, relationship, file, and large-text fields. " + "CHOICE_SET_SINGLE/CHOICE_SET_MULTIPLE require 'choiceSetId' (from 'df choice-sets list'). " + "RELATIONSHIP requires 'referenceEntityId' (UUID of the target entity, from 'df entities list') and 'referenceFieldId' (UUID of the field on the target entity, from 'df entities get <target-id>'). " + "Note: a RELATIONSHIP column on a record always stores the target record's UUID 'Id' (regardless of which 'referenceFieldId' configured the join) — see 'df records insert' for how to write the value. " + "FILE fields take only 'fieldName' and 'type' — the server auto-wires the internal attachment reference; populate them later with 'uip df files upload <entity-id> <record-id> <field-name> --file <path>'. " + "MULTILINE_MAX holds very large text ('lengthLimit' = UTF-16 byte budget, 1-131072; default max ~65,536 chars). Not filterable/sortable; 'records list'/'query' return a size marker — full content via 'records get'. Tenant-gated by the 'MultilineMax' feature flag.",
22444
- Command: `uip df entities create Expense --body '{"displayName":"Expense","fields":[{"fieldName":"category","type":"CHOICE_SET_SINGLE","choiceSetId":"c1d2e3f4-0000-0000-0000-000000000001","isRequired":true},{"fieldName":"tags","type":"CHOICE_SET_MULTIPLE","choiceSetId":"c1d2e3f4-0000-0000-0000-000000000002"},{"fieldName":"submitter","type":"RELATIONSHIP","referenceEntityId":"a1b2c3d4-0000-0000-0000-000000000010","referenceFieldId":"f1000000-0000-0000-0000-000000000100","isRequired":true},{"fieldName":"receipt","type":"FILE"},{"fieldName":"notes","type":"MULTILINE_MAX"}]}'`,
22965
+ Description: "Create an entity with choice-set, relationship, file, and large-text fields. " + "CHOICE_SET_SINGLE/CHOICE_SET_MULTIPLE require 'choiceSetId' (from 'df choice-sets list'). " + "RELATIONSHIP requires 'referenceEntityId' (UUID of the target entity, from 'df entities list') and 'referenceFieldId' (UUID of the field on the target entity, from 'df entities get <target-id>'). " + "Note: a RELATIONSHIP column on a record always stores the target record's UUID 'Id' (regardless of which 'referenceFieldId' configured the join) — see 'df records insert' for how to write the value. " + "FILE fields take only 'name' and 'type' — the server auto-wires the internal attachment reference; populate them later with 'uip df files upload <entity-id> <record-id> <field-name> --file <path>'. " + "MULTILINE_MAX holds very large text ('lengthLimit' = UTF-16 byte budget, 1-131072; default max ~65,536 chars). Not filterable/sortable; 'records list'/'query' return a size marker — full content via 'records get'. Tenant-gated by the 'MultilineMax' feature flag.",
22966
+ Command: `uip df entities create Expense --body '{"displayName":"Expense","fields":[{"name":"category","type":"CHOICE_SET_SINGLE","choiceSetId":"c1d2e3f4-0000-0000-0000-000000000001","isRequired":true},{"name":"tags","type":"CHOICE_SET_MULTIPLE","choiceSetId":"c1d2e3f4-0000-0000-0000-000000000002"},{"name":"submitter","type":"RELATIONSHIP","referenceEntityId":"a1b2c3d4-0000-0000-0000-000000000010","referenceFieldId":"f1000000-0000-0000-0000-000000000100","isRequired":true},{"name":"receipt","type":"FILE"},{"name":"notes","type":"MULTILINE_MAX"}]}'`,
22445
22967
  Output: {
22446
22968
  Code: "EntityCreated",
22447
- Data: { ID: "a1b2c3d4-0000-0000-0000-000000000004" }
22969
+ Data: { Id: "a1b2c3d4-0000-0000-0000-000000000004" }
22448
22970
  }
22449
22971
  },
22450
22972
  {
22451
22973
  Description: "Create a folder-scoped entity with cross-folder references. " + "Pass '--folder-key' to place the new entity in a folder. " + "Per-field 'referenceFolderKey' points a RELATIONSHIP field at a target that lives in a different folder (or at the tenant level when omitted). " + "CHOICE_SET_* fields resolve scope from 'choiceSetId' and must not pass 'referenceFolderKey'. " + "Get target entity/field IDs from 'df entities list --folder-key <key>' and 'df entities get <id> --folder-key <key>'; get choice-set IDs from 'df choice-sets list --folder-key <key>' (omit '--folder-key' for tenant-level choice sets).",
22452
- Command: `uip df entities create OrderLine --folder-key f1000000-0000-0000-0000-000000000050 --body '{"displayName":"Order Line","fields":[{"fieldName":"purchaseOrder","type":"RELATIONSHIP","referenceEntityId":"a1b2c3d4-0000-0000-0000-000000000010","referenceFieldId":"f1000000-0000-0000-0000-000000000100","referenceFolderKey":"f1000000-0000-0000-0000-000000000060","isRequired":true},{"fieldName":"userType","type":"CHOICE_SET_SINGLE","choiceSetId":"c1d2e3f4-0000-0000-0000-000000000077"}]}'`,
22974
+ Command: `uip df entities create OrderLine --folder-key f1000000-0000-0000-0000-000000000050 --body '{"displayName":"Order Line","fields":[{"name":"purchaseOrder","type":"RELATIONSHIP","referenceEntityId":"a1b2c3d4-0000-0000-0000-000000000010","referenceFieldId":"f1000000-0000-0000-0000-000000000100","referenceFolderKey":"f1000000-0000-0000-0000-000000000060","isRequired":true},{"name":"userType","type":"CHOICE_SET_SINGLE","choiceSetId":"c1d2e3f4-0000-0000-0000-000000000077"}]}'`,
22453
22975
  Output: {
22454
22976
  Code: "EntityCreated",
22455
- Data: { ID: "a1b2c3d4-0000-0000-0000-000000000005" }
22977
+ Data: { Id: "a1b2c3d4-0000-0000-0000-000000000005" }
22978
+ }
22979
+ }
22980
+ ];
22981
+ var ENTITIES_UPDATE_EXAMPLES = [
22982
+ {
22983
+ Description: "Add a field. addFields uses the flat write shape: name + type, plus optional lengthLimit, minValue, maxValue, decimalPrecision, displayName, description, isRequired, isUnique, choiceSetId, referenceEntityId, referenceFieldId, and referenceFolderKey. A field object copied from 'df entities get' is accepted in addFields and normalized, but do not replay a full 'entities get' entity object as the update body.",
22984
+ Command: `uip df entities update a1b2c3d4-0000-0000-0000-000000000001 --body '{"addFields":[{"name":"note","type":"STRING","lengthLimit":200}]}'`,
22985
+ Output: {
22986
+ Code: "EntityUpdated",
22987
+ Data: { Id: "a1b2c3d4-0000-0000-0000-000000000001" }
22988
+ }
22989
+ },
22990
+ {
22991
+ Description: "Update field metadata. updateFields uses field IDs from 'df entities get <entity-id>' and accepts metadata such as displayName, description, isRequired, isRbacEnabled, isEncrypted, isHiddenField, defaultValue, and constraints. Do not paste a full copied field object here; pass 'id' plus only the flat write-shape properties being changed. It cannot change a field's type or isUnique setting.",
22992
+ Command: `uip df entities update a1b2c3d4-0000-0000-0000-000000000001 --body '{"updateFields":[{"id":"f1000000-0000-0000-0000-000000000002","displayName":"Amount (USD)","isRequired":true}]}'`,
22993
+ Output: {
22994
+ Code: "EntityUpdated",
22995
+ Data: { Id: "a1b2c3d4-0000-0000-0000-000000000001" }
22996
+ }
22997
+ },
22998
+ {
22999
+ Description: "Remove fields. removeFields uses field names, not field IDs, and requires --yes with --reason because the field values are deleted.",
23000
+ Command: `uip df entities update a1b2c3d4-0000-0000-0000-000000000001 --body '{"removeFields":[{"name":"oldColumn"}]}' --yes --reason "quarterly cleanup"`,
23001
+ Output: {
23002
+ Code: "EntityUpdated",
23003
+ Data: {
23004
+ Id: "a1b2c3d4-0000-0000-0000-000000000001",
23005
+ RemovedFields: ["oldColumn"],
23006
+ Reason: "quarterly cleanup"
23007
+ }
22456
23008
  }
22457
23009
  }
22458
23010
  ];
@@ -22460,6 +23012,8 @@ var VALID_FIELD_TYPES = new Set(Object.values(EntityFieldDataType));
22460
23012
  var VALID_FIELD_TYPES_LIST = [...VALID_FIELD_TYPES].join(", ");
22461
23013
  function hasInvalidFieldType(fields) {
22462
23014
  return fields.some((f) => {
23015
+ if (typeof f !== "object" || f === null)
23016
+ return false;
22463
23017
  const field = f;
22464
23018
  return field.type !== undefined && !VALID_FIELD_TYPES.has(field.type);
22465
23019
  });
@@ -22470,7 +23024,8 @@ var KNOWN_UPDATE_KEYS = [
22470
23024
  "updateFields",
22471
23025
  "displayName",
22472
23026
  "description",
22473
- "isRbacEnabled"
23027
+ "isRbacEnabled",
23028
+ "isAnalyticsEnabled"
22474
23029
  ];
22475
23030
  function pickKnownUpdateKeys(input) {
22476
23031
  const out = {};
@@ -22480,6 +23035,109 @@ function pickKnownUpdateKeys(input) {
22480
23035
  }
22481
23036
  return out;
22482
23037
  }
23038
+ var ADD_FIELDS_ARRAY_INSTRUCTIONS = 'Example: {"addFields":[{"name":"title","type":"STRING"}]}';
23039
+ var UPDATE_FIELDS_ARRAY_INSTRUCTIONS = 'Example: {"updateFields":[{"id":"<fieldId>","displayName":"New Name"}]}';
23040
+ var REMOVE_FIELDS_ARRAY_INSTRUCTIONS = 'Example: {"removeFields":[{"name":"oldField"}]}';
23041
+ var ADD_FIELDS_FIELD_NAME_INSTRUCTIONS = 'Use the flat write shape, for example {"name":"title","type":"STRING"}. A field copied from "df entities get" is also accepted inside addFields and normalized.';
23042
+ var UPDATE_FIELDS_ID_INSTRUCTIONS = 'Use "df entities get <entityId>" to find field IDs. Example: {"id":"<fieldId>","displayName":"Total Amount","isRequired":true}';
23043
+ var REMOVE_FIELDS_FIELD_NAME_INSTRUCTIONS = 'Example: {"removeFields":[{"name":"oldField"}]}';
23044
+ function isObjectRecord(value) {
23045
+ return typeof value === "object" && value !== null && !Array.isArray(value);
23046
+ }
23047
+ function readKey(record, camelKey, pascalKey) {
23048
+ return record[camelKey] ?? record[pascalKey];
23049
+ }
23050
+ function readObjectKey(record, camelKey, pascalKey) {
23051
+ const value = readKey(record, camelKey, pascalKey);
23052
+ return isObjectRecord(value) ? value : undefined;
23053
+ }
23054
+ function setIfDefined(target, key, value) {
23055
+ if (value !== undefined)
23056
+ target[key] = value;
23057
+ }
23058
+ function readId(value) {
23059
+ if (!isObjectRecord(value))
23060
+ return;
23061
+ return value.id ?? value.Id ?? value.ID;
23062
+ }
23063
+ function readFieldTypeMetadata(field) {
23064
+ return readObjectKey(field, "fieldDataType", "FieldDataType");
23065
+ }
23066
+ function readConstraint(field, fieldTypeMetadata, camelKey, pascalKey) {
23067
+ return readKey(field, camelKey, pascalKey) ?? (fieldTypeMetadata === undefined ? undefined : readKey(fieldTypeMetadata, camelKey, pascalKey));
23068
+ }
23069
+ function normalizeAddFieldShape(field) {
23070
+ if (!isObjectRecord(field))
23071
+ return field;
23072
+ if (field.name !== undefined || field.type !== undefined)
23073
+ return field;
23074
+ const readName = readKey(field, "name", "Name");
23075
+ const fieldTypeMetadata = readFieldTypeMetadata(field);
23076
+ if (typeof readName !== "string" || fieldTypeMetadata === undefined) {
23077
+ return field;
23078
+ }
23079
+ const normalized = { name: readName };
23080
+ setIfDefined(normalized, "type", readKey(fieldTypeMetadata, "name", "Name"));
23081
+ for (const [writeKey, pascalKey] of [
23082
+ ["displayName", "DisplayName"],
23083
+ ["description", "Description"],
23084
+ ["isRequired", "IsRequired"],
23085
+ ["isUnique", "IsUnique"],
23086
+ ["isRbacEnabled", "IsRbacEnabled"],
23087
+ ["isEncrypted", "IsEncrypted"],
23088
+ ["isHiddenField", "IsHiddenField"],
23089
+ ["defaultValue", "DefaultValue"]
23090
+ ]) {
23091
+ setIfDefined(normalized, writeKey, readKey(field, writeKey, pascalKey));
23092
+ }
23093
+ for (const [writeKey, pascalKey] of [
23094
+ ["lengthLimit", "LengthLimit"],
23095
+ ["maxValue", "MaxValue"],
23096
+ ["minValue", "MinValue"],
23097
+ ["decimalPrecision", "DecimalPrecision"]
23098
+ ]) {
23099
+ setIfDefined(normalized, writeKey, readConstraint(field, fieldTypeMetadata, writeKey, pascalKey));
23100
+ }
23101
+ setIfDefined(normalized, "choiceSetId", readKey(field, "choiceSetId", "ChoiceSetId") ?? readId(readKey(field, "referenceChoiceSet", "ReferenceChoiceSet")));
23102
+ setIfDefined(normalized, "referenceEntityId", readKey(field, "referenceEntityId", "ReferenceEntityId") ?? readId(readKey(field, "referenceEntity", "ReferenceEntity")));
23103
+ setIfDefined(normalized, "referenceFieldId", readKey(field, "referenceFieldId", "ReferenceFieldId") ?? readId(readKey(field, "referenceField", "ReferenceField")));
23104
+ setIfDefined(normalized, "referenceFolderKey", readKey(field, "referenceFolderKey", "ReferenceFolderKey"));
23105
+ return normalized;
23106
+ }
23107
+ function normalizeAddFields(addFields) {
23108
+ return addFields.map((field) => normalizeAddFieldShape(field));
23109
+ }
23110
+ function hasMissingStringField(fields, key) {
23111
+ return fields.some((field) => {
23112
+ if (!isObjectRecord(field))
23113
+ return true;
23114
+ const value = field[key];
23115
+ return typeof value !== "string" || value.trim() === "";
23116
+ });
23117
+ }
23118
+ function getUpdateArray(input, key, instructions, issues) {
23119
+ const value = input[key];
23120
+ if (value === undefined)
23121
+ return;
23122
+ if (Array.isArray(value))
23123
+ return value;
23124
+ issues.push({
23125
+ message: `'${key}' must be an array`,
23126
+ instructions
23127
+ });
23128
+ return;
23129
+ }
23130
+ function combineValidationIssues(issues) {
23131
+ if (issues.length === 0)
23132
+ return null;
23133
+ if (issues.length === 1)
23134
+ return issues[0];
23135
+ return {
23136
+ message: `Update body validation failed: ${issues.map((issue2) => issue2.message).join("; ")}`,
23137
+ instructions: issues.map((issue2, index) => `${index + 1}. ${issue2.instructions}`).join(`
23138
+ `)
23139
+ };
23140
+ }
22483
23141
  function validateFieldsPayload(fields, entityName, isNewEntity = false) {
22484
23142
  return runChecks([
22485
23143
  () => findInvalidFieldName(fields),
@@ -22544,21 +23202,22 @@ var registerEntitiesCommand = (program2) => {
22544
23202
  Data: e
22545
23203
  });
22546
23204
  });
22547
- entities.command("create").description("Create a new Data Fabric entity").argument("<name>", "Entity name (must start with a letter; letters, numbers, and underscores only)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-f, --file <path>", "Path to JSON file with entity definition (fields array required; displayName, description, isRbacEnabled optional)").option("--body <json>", "Inline JSON entity definition").option("--folder-key <key>", "Folder key (GUID) of the target folder (for folder-scoped entities)").examples(ENTITIES_CREATE_EXAMPLES).trackedAction(processContext, async (name, options) => {
23205
+ entities.command("create").description("Create a new Data Fabric entity").argument("<name>", "Entity name (must start with a letter; letters, numbers, and underscores only)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-f, --file <path>", "Path to JSON file with entity definition (fields array required; displayName, description, isRbacEnabled, isAnalyticsEnabled optional). A field object copied from 'df entities get' is also accepted and normalized to the write shape.").option("--body <json>", "Inline JSON entity definition. A field object copied from 'df entities get' is also accepted and normalized to the write shape.").option("--folder-key <key>", "Folder key (GUID) of the target folder (for folder-scoped entities)").examples(ENTITIES_CREATE_EXAMPLES).trackedAction(processContext, async (name, options) => {
22548
23206
  const [parseError, parsed] = await catchError2(readJsonInput(options.file, options.body, "Provide entity definition via --file or --body."));
22549
23207
  if (parseError) {
22550
23208
  return fail("Error parsing entity definition", parseError.message);
22551
23209
  }
22552
23210
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
22553
- return fail("Entity definition must be a JSON object", "Provide a JSON object with a 'fields' array and optional displayName, description, isRbacEnabled.");
23211
+ return fail("Entity definition must be a JSON object", "Provide a JSON object with a 'fields' array and optional displayName, description, isRbacEnabled, isAnalyticsEnabled.");
22554
23212
  }
22555
23213
  const definition = parsed;
22556
23214
  if (!Array.isArray(definition.fields)) {
22557
23215
  return fail("Entity definition must include a 'fields' array", "Provide a JSON object with a 'fields' array containing field definitions.");
22558
23216
  }
22559
- const hasInvalidField = definition.fields.some((f) => typeof f !== "object" || f === null || typeof f.fieldName !== "string");
23217
+ definition.fields = normalizeAddFields(definition.fields);
23218
+ const hasInvalidField = definition.fields.some((f) => typeof f !== "object" || f === null || typeof f.name !== "string");
22560
23219
  if (hasInvalidField) {
22561
- return fail("Each field must include a 'fieldName' string", 'Example: {"fieldName":"title","type":"STRING"}');
23220
+ return fail("Each field must include a 'name' string", 'Example: {"name":"title","type":"STRING"}');
22562
23221
  }
22563
23222
  if (hasInvalidFieldType(definition.fields)) {
22564
23223
  return fail("Invalid field type in fields", `Valid types: ${VALID_FIELD_TYPES_LIST}`);
@@ -22583,6 +23242,9 @@ var registerEntitiesCommand = (program2) => {
22583
23242
  ...definition.isRbacEnabled !== undefined && {
22584
23243
  isRbacEnabled: definition.isRbacEnabled
22585
23244
  },
23245
+ ...definition.isAnalyticsEnabled !== undefined && {
23246
+ isAnalyticsEnabled: definition.isAnalyticsEnabled
23247
+ },
22586
23248
  ...options.folderKey !== undefined && {
22587
23249
  folderKey: options.folderKey
22588
23250
  }
@@ -22598,88 +23260,111 @@ var registerEntitiesCommand = (program2) => {
22598
23260
  Data: { ID: entityId }
22599
23261
  });
22600
23262
  });
22601
- entities.command("update").description("Update schema or metadata of a Data Fabric entity").argument("<id>", "Entity ID").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-f, --file <path>", "Path to JSON file with update options (addFields, updateFields, removeFields, displayName, description, isRbacEnabled)").option("--body <json>", "Inline JSON update options (use `-` to read from stdin)").option("-y, --yes", "Required when 'removeFields' is non-empty — acknowledges the field deletion is irreversible").addOption(new Option("--confirm", "Deprecated alias for --yes").hideHelp()).option("--reason <reason>", "Required when 'removeFields' is non-empty — echoed back in the response so the caller can log it").option("--folder-key <key>", "Folder key (GUID) of the folder containing the entity (for folder-scoped entities)").trackedAction(processContext, async (id, options) => {
23263
+ entities.command("update").description("Update schema or metadata of a Data Fabric entity").argument("<id>", "Entity ID").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-f, --file <path>", "Path to JSON file with update options. Field shapes: addFields [{name,type,...}], updateFields [{id,...}], removeFields [{name}]. Do not paste a full copied field object into updateFields; pass id plus only changed flat properties. Also accepts the entity metadata keys displayName, description, isRbacEnabled and isAnalyticsEnabled.").option("--body <json>", "Inline JSON update options (use `-` to read from stdin). Field shapes: addFields [{name,type,...}], updateFields [{id,...}], removeFields [{name}]. Do not paste a full copied field object into updateFields; pass id plus only changed flat properties. Also accepts the entity metadata keys displayName, description, isRbacEnabled and isAnalyticsEnabled.").option("-y, --yes", "Required when 'removeFields' is non-empty — acknowledges the field deletion is irreversible").addOption(new Option("--confirm", "Deprecated alias for --yes").hideHelp()).option("--reason <reason>", "Required when 'removeFields' is non-empty — echoed back in the response so the caller can log it").option("--folder-key <key>", "Folder key (GUID) of the folder containing the entity (for folder-scoped entities)").examples(ENTITIES_UPDATE_EXAMPLES).trackedAction(processContext, async (id, options) => {
22602
23264
  const [parseError, parsed] = await catchError2(readJsonInput(options.file, options.body, "Provide update options via --file or --body."));
22603
23265
  if (parseError) {
22604
- return fail("Error parsing update options", parseError.message);
23266
+ return failInvalidArgument("Error parsing update options", parseError.message);
22605
23267
  }
22606
23268
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
22607
- return fail("Update options must be a JSON object", "Provide a JSON object with addFields, updateFields, removeFields, displayName, description, or isRbacEnabled.");
23269
+ return failInvalidArgument("Update options must be a JSON object", "Provide a JSON object with addFields, updateFields, removeFields, displayName, description, isRbacEnabled, or isAnalyticsEnabled.");
22608
23270
  }
22609
23271
  const input = parsed;
23272
+ if (Array.isArray(input.addFields)) {
23273
+ input.addFields = normalizeAddFields(input.addFields);
23274
+ }
23275
+ const validationIssues = [];
23276
+ if (input.name !== undefined) {
23277
+ validationIssues.push({
23278
+ message: "Entity name cannot be changed after creation",
23279
+ instructions: "Remove 'name' from the update body. The entity name is immutable — only 'displayName' and 'description' can be changed. To use a different name, create a new entity."
23280
+ });
23281
+ }
23282
+ const hasMetadataUpdate = [
23283
+ "description",
23284
+ "isRbacEnabled",
23285
+ "isAnalyticsEnabled"
23286
+ ].some((key) => input[key] !== undefined);
23287
+ if (hasMetadataUpdate && input.displayName === undefined) {
23288
+ validationIssues.push({
23289
+ message: "'displayName' is required when updating entity metadata",
23290
+ instructions: `Include the current displayName in the body alongside description/isRbacEnabled/isAnalyticsEnabled — get it with 'df entities get <entityId>'. Example: {"displayName":"<current-display-name>","description":"<new-description>"}.`
23291
+ });
23292
+ }
22610
23293
  const metadataErr = validateSchemaMetadata(input, "Entity");
22611
23294
  if (metadataErr)
22612
- return fail(metadataErr.message, metadataErr.instructions);
22613
- if (input.addFields !== undefined && !Array.isArray(input.addFields)) {
22614
- return fail("'addFields' must be an array", 'Example: {"addFields":[{"fieldName":"title","type":"STRING"}]}');
23295
+ validationIssues.push(metadataErr);
23296
+ const addFields = getUpdateArray(input, "addFields", ADD_FIELDS_ARRAY_INSTRUCTIONS, validationIssues);
23297
+ const updateFields = getUpdateArray(input, "updateFields", UPDATE_FIELDS_ARRAY_INSTRUCTIONS, validationIssues);
23298
+ const removeFields = getUpdateArray(input, "removeFields", REMOVE_FIELDS_ARRAY_INSTRUCTIONS, validationIssues);
23299
+ let addFieldNames = [];
23300
+ if (addFields !== undefined) {
23301
+ const hasInvalidAddFieldsShape = hasMissingStringField(addFields, "name");
23302
+ if (hasInvalidAddFieldsShape) {
23303
+ validationIssues.push({
23304
+ message: "Each field in addFields must include a non-empty 'name' string",
23305
+ instructions: ADD_FIELDS_FIELD_NAME_INSTRUCTIONS
23306
+ });
23307
+ } else {
23308
+ addFieldNames = addFields.map((field) => field.name);
23309
+ if (hasInvalidFieldType(addFields)) {
23310
+ validationIssues.push({
23311
+ message: "Invalid field type in addFields",
23312
+ instructions: `Valid types: ${VALID_FIELD_TYPES_LIST}`
23313
+ });
23314
+ }
23315
+ const addErr = validateFieldsPayload(addFields);
23316
+ if (addErr)
23317
+ validationIssues.push(addErr);
23318
+ }
22615
23319
  }
22616
- if (input.updateFields !== undefined && !Array.isArray(input.updateFields)) {
22617
- return fail("'updateFields' must be an array", 'Example: {"updateFields":[{"id":"<fieldId>","displayName":"New Name"}]}');
23320
+ let removedFieldNames = [];
23321
+ if (removeFields !== undefined) {
23322
+ if (hasMissingStringField(removeFields, "name")) {
23323
+ validationIssues.push({
23324
+ message: "Each field in removeFields must include a non-empty 'name' string",
23325
+ instructions: REMOVE_FIELDS_FIELD_NAME_INSTRUCTIONS
23326
+ });
23327
+ } else {
23328
+ removedFieldNames = removeFields.map((field) => field.name);
23329
+ }
22618
23330
  }
22619
- if (input.removeFields !== undefined && !Array.isArray(input.removeFields)) {
22620
- return fail("'removeFields' must be an array", 'Example: {"removeFields":[{"fieldName":"oldField"}]}');
23331
+ if (addFieldNames.length > 0 && removedFieldNames.length > 0) {
23332
+ const removedNamesLower = new Set(removedFieldNames.map((name) => name.toLowerCase()));
23333
+ const conflict = addFieldNames.find((name) => removedNamesLower.has(name.toLowerCase()));
23334
+ if (conflict !== undefined) {
23335
+ validationIssues.push({
23336
+ message: `Field '${conflict}' appears in both addFields and removeFields`,
23337
+ instructions: "A single update cannot add and remove the same field. Split into two calls if you need to recreate it."
23338
+ });
23339
+ }
23340
+ }
23341
+ if (updateFields !== undefined) {
23342
+ const hasInvalidUpdateFieldsShape = hasMissingStringField(updateFields, "id");
23343
+ if (hasInvalidUpdateFieldsShape) {
23344
+ validationIssues.push({
23345
+ message: "Each field in updateFields must include a non-empty 'id' string",
23346
+ instructions: UPDATE_FIELDS_ID_INSTRUCTIONS
23347
+ });
23348
+ } else {
23349
+ const updateErr = findIsUniqueInUpdateFields(updateFields);
23350
+ if (updateErr)
23351
+ validationIssues.push(updateErr);
23352
+ const updateMetadataErr = findInvalidFieldMetadata(updateFields);
23353
+ if (updateMetadataErr)
23354
+ validationIssues.push(updateMetadataErr);
23355
+ }
23356
+ }
23357
+ const validationErr = combineValidationIssues(validationIssues);
23358
+ if (validationErr) {
23359
+ return failInvalidArgument(validationErr.message, validationErr.instructions);
22621
23360
  }
22622
23361
  let trimmedReason;
22623
- let removedFieldNames = [];
22624
- const hasRemove = Array.isArray(input.removeFields) && input.removeFields.length > 0;
23362
+ const hasRemove = removedFieldNames.length > 0;
22625
23363
  if (hasRemove) {
22626
- const removeFields = input.removeFields;
22627
- const hasInvalidRemove = removeFields.some((f) => {
22628
- if (typeof f !== "object" || f === null)
22629
- return true;
22630
- const fn = f.fieldName;
22631
- return typeof fn !== "string" || fn.trim() === "";
22632
- });
22633
- if (hasInvalidRemove) {
22634
- return fail("Each field in removeFields must include a non-empty 'fieldName' string", 'Example: {"removeFields":[{"fieldName":"oldField"}]}');
22635
- }
22636
23364
  const reason = requireDestructiveConfirmation(options, `remove fields from entity '${id}'`, 'Pass --reason "<text>" to record why fields are being removed.');
22637
23365
  if (reason === null)
22638
23366
  return;
22639
23367
  trimmedReason = reason;
22640
- removedFieldNames = removeFields.map((f) => f.fieldName);
22641
- }
22642
- if (Array.isArray(input.addFields)) {
22643
- const hasInvalidField = input.addFields.some((f) => {
22644
- if (typeof f !== "object" || f === null)
22645
- return true;
22646
- const fn = f.fieldName;
22647
- return typeof fn !== "string" || fn.trim() === "";
22648
- });
22649
- if (hasInvalidField) {
22650
- return fail("Each field in addFields must include a non-empty 'fieldName' string", 'Example: {"fieldName":"title","type":"STRING"}');
22651
- }
22652
- if (hasInvalidFieldType(input.addFields)) {
22653
- return fail("Invalid field type in addFields", `Valid types: ${VALID_FIELD_TYPES_LIST}`);
22654
- }
22655
- const addErr = validateFieldsPayload(input.addFields);
22656
- if (addErr)
22657
- return fail(addErr.message, addErr.instructions);
22658
- const addNames = input.addFields.map((f) => f.fieldName);
22659
- if (removedFieldNames.length > 0) {
22660
- const removedNamesLower = new Set(removedFieldNames.map((name) => name.toLowerCase()));
22661
- const conflict = addNames.find((name) => removedNamesLower.has(name.toLowerCase()));
22662
- if (conflict !== undefined) {
22663
- return fail(`Field '${conflict}' appears in both addFields and removeFields`, "A single update cannot add and remove the same field. Split into two calls if you need to recreate it.");
22664
- }
22665
- }
22666
- }
22667
- if (Array.isArray(input.updateFields)) {
22668
- const hasInvalidField = input.updateFields.some((f) => {
22669
- if (typeof f !== "object" || f === null)
22670
- return true;
22671
- const fid = f.id;
22672
- return typeof fid !== "string" || fid.trim() === "";
22673
- });
22674
- if (hasInvalidField) {
22675
- return fail("Each field in updateFields must include a non-empty 'id' string", `Use 'df entities get <entityId>' to find field IDs. Example: {"id":"<fieldId>","displayName":"Total Amount","isRequired":true}`);
22676
- }
22677
- const updateErr = findIsUniqueInUpdateFields(input.updateFields);
22678
- if (updateErr)
22679
- return fail(updateErr.message, updateErr.instructions);
22680
- const updateMetadataErr = findInvalidFieldMetadata(input.updateFields);
22681
- if (updateMetadataErr)
22682
- return fail(updateMetadataErr.message, updateMetadataErr.instructions);
22683
23368
  }
22684
23369
  const sdk = await connectOrFail(options.tenant);
22685
23370
  if (!sdk)
@@ -23311,12 +23996,13 @@ var registerRolesCommand = (program2) => {
23311
23996
  const sdk = await connectOrFail(options.tenant);
23312
23997
  if (!sdk)
23313
23998
  return;
23314
- const [listError, result] = await catchError2(sdk.entities.roles.getAll({
23999
+ const getAllOptions = {
23315
24000
  stats: options.stats,
23316
24001
  ...options.folderKey !== undefined && {
23317
24002
  folderKey: options.folderKey
23318
24003
  }
23319
- }));
24004
+ };
24005
+ const [listError, result] = await catchError2(sdk.entities.roles.getAll(getAllOptions));
23320
24006
  if (listError) {
23321
24007
  return fail("Error listing roles", await extractErrorMessage(listError));
23322
24008
  }
@@ -23347,4 +24033,4 @@ var registerCommands = async (program2) => {
23347
24033
 
23348
24034
  export { Command, metadata, registerCommands };
23349
24035
 
23350
- //# debugId=E0C8B7794AD61B2A64756E2164756E21
24036
+ //# debugId=7A4D0D3DD13A296A64756E2164756E21