@uipath/rules-tool 1.205.0-preview.277 → 1.206.0-preview.279

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/DmnFactory-L7MABUC6-q2sr3grz.js +10 -0
  2. package/dist/DmnModelTypes-ATR7FVKZ-h8srwcxk.js +8 -0
  3. package/dist/KieDmnMarshaller-LGE63WDG-nfkpv8f4.js +8 -0
  4. package/dist/THIRD-PARTY-NOTICES.md +4 -4
  5. package/dist/business-rules-z2zw35qd.js +25 -0
  6. package/dist/{constants-cnn0jfw6.js → constants-1sdwfz26.js} +7 -15
  7. package/dist/{embedded-file-reader-z4becc02.js → embedded-file-reader-0228j82a.js} +1 -4
  8. package/dist/first-party-service-hegqxm82.js +8 -0
  9. package/dist/hitPolicyResult-CGCR73CW-jz89f1aa.js +12 -0
  10. package/dist/index-4a4x1ygg.js +24 -0
  11. package/dist/{index-52h8rpew.js → index-egzwtc07.js} +2 -4
  12. package/dist/{index-sby22td6.js → index-nzr4mx5p.js} +2 -22
  13. package/dist/index-xaxgkfez.js +23 -0
  14. package/dist/{tool-tjcg2xje.js → index-y5yffb2s.js} +3525 -236
  15. package/dist/index-z4kt2kt6.js +8 -0
  16. package/dist/{index-bhjt1h5c.js → index-zeszs1ra.js} +23 -66
  17. package/dist/index.js +8 -9
  18. package/dist/{jmespath-231m3hyn.js → jmespath-ab6tdc42.js} +1 -1
  19. package/dist/{js-yaml-88tdqrtd.js → js-yaml-a2bk27p6.js} +1 -3
  20. package/dist/rule-catalog-5qnmp0xp.js +71 -0
  21. package/dist/rules-command-error-30c8a3n9.js +13 -0
  22. package/dist/{rules-debug-service-830zfzcy.js → rules-debug-service-xc1cmwwh.js} +37 -38
  23. package/dist/{rules-init-service-qphmbh3k.js → rules-init-service-frjbgfcs.js} +12 -16
  24. package/dist/{rules-refresh-service-jn6my893.js → rules-refresh-service-18hrs394.js} +13 -14
  25. package/dist/{rules-validate-service-hfw8m3dm.js → rules-validate-service-s787ehrr.js} +10 -13
  26. package/dist/{tool-fk8rznma.js → tool-89e90qrm.js} +173 -223
  27. package/dist/{tool-fbxe48wd.js → tool-8cnhz30a.js} +13991 -15184
  28. package/dist/{tool-ey5djkhz.js → tool-8sjyv0xg.js} +659 -14
  29. package/dist/{tool-h7gn1rar.js → tool-93hqhaj3.js} +402 -417
  30. package/dist/{tool-c2xarvad.js → tool-cf9810hm.js} +32 -34
  31. package/dist/{tool-wf2qkrye.js → tool-cs8nyk0r.js} +990 -514
  32. package/dist/{tool-txp5th7j.js → tool-e23cj2jx.js} +127 -42
  33. package/dist/{tool-1de529jm.js → tool-epsr41wx.js} +12 -3
  34. package/dist/{tool-gkbr01gc.js → tool-fkppxa9f.js} +14 -17
  35. package/dist/{tool-86f1xpxn.js → tool-m59a481n.js} +18 -20
  36. package/dist/tool-mst6a4dr.js +73 -0
  37. package/dist/{tool-t4k013ex.js → tool-njnhj05q.js} +8 -8
  38. package/dist/tool-p7hqn93n.js +455 -0
  39. package/dist/{tool-z1ay3csx.js → tool-sbtf80ft.js} +66 -24
  40. package/dist/{tool-yq5jph4h.js → tool-vqm4apm6.js} +207 -216
  41. package/dist/tool.js +7 -8
  42. package/package.json +2 -2
  43. package/dist/DmnFactory-L7MABUC6-98k17dkr.js +0 -46
  44. package/dist/DmnModelTypes-ATR7FVKZ-jp35cecy.js +0 -18
  45. package/dist/KieDmnMarshaller-LGE63WDG-3vemswef.js +0 -20
  46. package/dist/business-rules-pm96sefm.js +0 -26
  47. package/dist/first-party-service-sd8yaf73.js +0 -27
  48. package/dist/hitPolicyResult-CGCR73CW-9bmc4nsr.js +0 -36
  49. package/dist/index-cpm94vee.js +0 -132
  50. package/dist/index-dqa169gp.js +0 -25
  51. package/dist/index-x9msn1dj.js +0 -85
  52. package/dist/index-ybrgtfsg.js +0 -3326
  53. package/dist/rule-catalog-10fhgevc.js +0 -74
  54. package/dist/rules-command-error-k6kxwfn7.js +0 -14
  55. package/dist/tool-1pccj6q3.js +0 -1116
  56. package/dist/tool-53w8skv5.js +0 -262
  57. package/dist/tool-7haj67tr.js +0 -19
  58. package/dist/tool-fbmxx07c.js +0 -73
  59. package/dist/tool-gdtpsdn7.js +0 -342
  60. package/dist/tool-jd313s2x.js +0 -10
  61. package/dist/tool-qgqscsjc.js +0 -46
  62. /package/dist/{tool-cfrcyxgm.js → tool-2nmqvfmt.js} +0 -0
@@ -1,18 +1,21 @@
1
1
  import {
2
- addSdkUserAgentHeader,
3
2
  getFileSystem,
3
+ catchError,
4
+ extractErrorMessage,
5
+ logger,
4
6
  getSdkUserAgentToken,
7
+ addSdkUserAgentHeader,
5
8
  installSdkUserAgentHeader
6
- } from "./tool-wf2qkrye.js";
9
+ } from "./tool-cs8nyk0r.js";
7
10
  import {
8
11
  __require
9
- } from "./tool-1de529jm.js";
12
+ } from "./tool-epsr41wx.js";
10
13
 
11
14
  // ../auth/src/catch-error.ts
12
15
  function isPromiseLike(value) {
13
16
  return value !== null && typeof value === "object" && typeof value.then === "function";
14
17
  }
15
- function catchError(fnOrPromise) {
18
+ function catchError2(fnOrPromise) {
16
19
  if (isPromiseLike(fnOrPromise)) {
17
20
  return settlePromiseLike(fnOrPromise);
18
21
  }
@@ -53,7 +56,7 @@ function isAuthProfileStorage(value) {
53
56
  return value !== null && typeof value === "object" && "getStore" in value && "run" in value;
54
57
  }
55
58
  function createProfileStorage() {
56
- const [error, mod] = catchError(() => __require("node:async_hooks"));
59
+ const [error, mod] = catchError2(() => __require("node:async_hooks"));
57
60
  if (error || typeof mod?.AsyncLocalStorage !== "function") {
58
61
  return {
59
62
  getStore: () => {
@@ -150,7 +153,7 @@ var normalizeAndValidateBaseUrl = (rawUrl) => {
150
153
  baseUrl = `https://${baseUrl}`;
151
154
  }
152
155
  const resolvedBaseUrl = baseUrl;
153
- const [urlError, url] = catchError(() => new URL(resolvedBaseUrl));
156
+ const [urlError, url] = catchError2(() => new URL(resolvedBaseUrl));
154
157
  if (urlError) {
155
158
  const shapeHint = !hasScheme && !hostCandidate.includes(".") ? ` "${rawUrl.trim()}" is not a URL or a host name. Pass the full authority URL — https://<host>, or just <host> (https:// is assumed).` : ` ${urlError instanceof Error ? urlError.message : "Unknown error"}`;
156
159
  throw new InvalidBaseUrlError(baseUrl, `Malformed URL.${shapeHint}`);
@@ -277,7 +280,7 @@ var getTokenExpiration = (accessToken) => {
277
280
  // ../auth/src/sessionIdentity.ts
278
281
  var parseAuthFlow = (value) => value === "authorization_code" || value === "client_credentials" || value === "federated_credentials" ? value : undefined;
279
282
  var decodeClaims = (accessToken) => {
280
- const [error, claims] = catchError(() => parseJWT(accessToken));
283
+ const [error, claims] = catchError2(() => parseJWT(accessToken));
281
284
  return error ? undefined : claims;
282
285
  };
283
286
  var asString = (value) => typeof value === "string" && value.length > 0 ? value : undefined;
@@ -369,6 +372,8 @@ var ENV_AUTH_VARS = {
369
372
  };
370
373
 
371
374
  class EnvAuthConfigError extends Error {
375
+ errorCode = "configuration_error";
376
+ retry = "RetryWillNotFix";
372
377
  constructor(message) {
373
378
  super(message);
374
379
  this.name = "EnvAuthConfigError";
@@ -385,7 +390,7 @@ var requireEnv = (name) => {
385
390
  };
386
391
  var OPAQUE_TOKEN_BASE_URL_VAR = "UIPATH_URL";
387
392
  var resolveBaseUrl = (rawUrl, failureContext) => {
388
- const [baseUrlError, baseUrl] = catchError(() => normalizeAndValidateBaseUrl(rawUrl));
393
+ const [baseUrlError, baseUrl] = catchError2(() => normalizeAndValidateBaseUrl(rawUrl));
389
394
  if (baseUrlError) {
390
395
  if (baseUrlError instanceof InvalidBaseUrlError) {
391
396
  throw baseUrlError;
@@ -400,18 +405,18 @@ var readAuthFromEnv = () => {
400
405
  const organizationId = requireEnv(ENV_AUTH_VARS.organizationId);
401
406
  const tenantName = requireEnv(ENV_AUTH_VARS.tenantName);
402
407
  const tenantId = requireEnv(ENV_AUTH_VARS.tenantId);
403
- const [parseError, payload] = catchError(() => parseJWT(accessToken));
408
+ const [parseError, payload] = catchError2(() => parseJWT(accessToken));
404
409
  if (parseError) {
405
410
  const parseErrorMessage = parseError instanceof Error ? parseError.message : String(parseError);
406
411
  const rawUrl = process.env[OPAQUE_TOKEN_BASE_URL_VAR];
407
412
  if (!rawUrl) {
408
413
  throw new EnvAuthConfigError(`${ENV_AUTH_VARS.token} is not a JWT (treating it as an opaque token, ` + `e.g. a Personal Access Token). Set ${OPAQUE_TOKEN_BASE_URL_VAR} to the ` + `UiPath base URL if this is a PAT, or fix the token if it was meant to ` + `be a JWT (parse error: ${parseErrorMessage}).`);
409
414
  }
410
- const baseUrl2 = resolveBaseUrl(rawUrl, `Failed to validate ${OPAQUE_TOKEN_BASE_URL_VAR}`);
415
+ const baseUrl = resolveBaseUrl(rawUrl, `Failed to validate ${OPAQUE_TOKEN_BASE_URL_VAR}`);
411
416
  return {
412
417
  loginStatus: "Logged in",
413
418
  accessToken,
414
- baseUrl: baseUrl2,
419
+ baseUrl,
415
420
  organizationName,
416
421
  organizationId,
417
422
  tenantName,
@@ -521,13 +526,13 @@ var defaultIsRobotIpcAvailable = async () => {
521
526
  if (process.platform === "win32") {
522
527
  return true;
523
528
  }
524
- const [pipeNamesError, pipeNames] = await catchError(getRobotIpcPipeNames());
529
+ const [pipeNamesError, pipeNames] = await catchError2(getRobotIpcPipeNames());
525
530
  if (pipeNamesError || !pipeNames) {
526
531
  return false;
527
532
  }
528
533
  const fs = getFileSystem();
529
534
  for (const pipeName of pipeNames) {
530
- const [existsError, exists] = await catchError(fs.exists(pipeName));
535
+ const [existsError, exists] = await catchError2(fs.exists(pipeName));
531
536
  if (!existsError && exists === true) {
532
537
  return true;
533
538
  }
@@ -545,7 +550,7 @@ var withTimeout = (promise, timeoutMs) => new Promise((resolve, reject) => {
545
550
  });
546
551
  });
547
552
  var parseResourceUrl = (url) => {
548
- const [error, parsed] = catchError(() => new URL(url));
553
+ const [error, parsed] = catchError2(() => new URL(url));
549
554
  if (error || !parsed)
550
555
  return;
551
556
  const segments = parsed.pathname.split("/").filter(Boolean);
@@ -565,7 +570,7 @@ var defaultLoadModule = async () => {
565
570
  if (!hostLoader) {
566
571
  return;
567
572
  }
568
- const [error, mod] = await catchError(() => hostLoader());
573
+ const [error, mod] = await catchError2(() => hostLoader());
569
574
  if (error || !mod) {
570
575
  return;
571
576
  }
@@ -591,7 +596,7 @@ var tryRobotClientFallback = async (options = {}) => {
591
596
  const mod = await loadModule();
592
597
  if (!mod)
593
598
  return;
594
- const [ctorError, proxy] = catchError(() => new mod.RobotProxyConstructor);
599
+ const [ctorError, proxy] = catchError2(() => new mod.RobotProxyConstructor);
595
600
  if (ctorError || !proxy) {
596
601
  return;
597
602
  }
@@ -614,7 +619,7 @@ var tryRobotClientFallback = async (options = {}) => {
614
619
  let organizationIdFromToken;
615
620
  let tenantIdFromToken;
616
621
  let issuerFromToken;
617
- const [jwtError, claims] = catchError(() => parseJWT(accessToken));
622
+ const [jwtError, claims] = catchError2(() => parseJWT(accessToken));
618
623
  if (!jwtError && claims) {
619
624
  const rawOrgId = claims.prtId ?? claims.organizationId ?? claims.prt_id;
620
625
  if (typeof rawOrgId === "string" && rawOrgId.length > 0) {
@@ -641,7 +646,7 @@ var tryRobotClientFallback = async (options = {}) => {
641
646
  } catch {
642
647
  return;
643
648
  } finally {
644
- await catchError(() => withTimeout(proxy.CloseAsync(), CLOSE_TIMEOUT_MS));
649
+ await catchError2(() => withTimeout(proxy.CloseAsync(), CLOSE_TIMEOUT_MS));
645
650
  }
646
651
  };
647
652
 
@@ -672,7 +677,7 @@ var fetchTenantsAndOrganizations = async (baseUrl, accessToken, organizationId,
672
677
  const message = `Failed to get tenants and organizations: ${response.status} ${errorText}`;
673
678
  throw new Error(IDENTIFIER_STATUSES.has(response.status) ? `${message}. ${organizationHint(organizationId)}` : message);
674
679
  }
675
- const [parseError, data] = await catchError(response.json());
680
+ const [parseError, data] = await catchError2(response.json());
676
681
  if (parseError) {
677
682
  throw new Error(describeNonJsonResponse(organizationId, response, parseError));
678
683
  }
@@ -711,9 +716,12 @@ var refreshAccessToken = async ({
711
716
  body: tokenParams
712
717
  });
713
718
  const tokenData = await tokenResponse.json();
714
- if (!tokenResponse.ok) {
719
+ if (tokenResponse.status === 400 || tokenResponse.status === 401) {
715
720
  throw new TokenRefreshOAuthError;
716
721
  }
722
+ if (!tokenResponse.ok) {
723
+ throw new Error(`Token refresh failed: HTTP ${tokenResponse.status}`);
724
+ }
717
725
  const newAccessToken = tokenData.access_token;
718
726
  const newRefreshToken = tokenData.refresh_token;
719
727
  if (typeof newAccessToken !== "string" || typeof newRefreshToken !== "string") {
@@ -776,20 +784,20 @@ var probeAsync = async (fs, candidate) => {
776
784
  var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) => {
777
785
  const fs = getFileSystem();
778
786
  if (fs.path.isAbsolute(envFilePath)) {
779
- const probe2 = await probeAsync(fs, envFilePath);
780
- return probe2.exists ? { exists: true, absolutePath: envFilePath, source: "absolute" } : {
787
+ const probe = await probeAsync(fs, envFilePath);
788
+ return probe.exists ? { exists: true, absolutePath: envFilePath, source: "absolute" } : {
781
789
  exists: false,
782
790
  absolutePath: envFilePath,
783
791
  source: "absolute",
784
- ...probe2.unusable ? { unusable: probe2.unusable } : {}
792
+ ...probe.unusable ? { unusable: probe.unusable } : {}
785
793
  };
786
794
  }
787
795
  const cwd = opts?.cwd ?? fs.env.cwd();
788
796
  let searchDir = cwd;
789
797
  while (true) {
790
798
  const candidate = fs.path.join(searchDir, envFilePath);
791
- const probe2 = await probeAsync(fs, candidate);
792
- if (probe2.exists) {
799
+ const probe = await probeAsync(fs, candidate);
800
+ if (probe.exists) {
793
801
  return {
794
802
  exists: true,
795
803
  absolutePath: candidate,
@@ -1157,7 +1165,7 @@ async function resolveRobotTenantId(robotCreds, deps) {
1157
1165
  const key = `${baseUrl}|${organization}|${tenantName}|${accessToken}`;
1158
1166
  let pending = deps.cache.get(key);
1159
1167
  if (!pending) {
1160
- pending = catchError(lookupRobotTenantId({ baseUrl, accessToken, organization, tenantName }, deps)).then(([error, resolution]) => {
1168
+ pending = catchError2(lookupRobotTenantId({ baseUrl, accessToken, organization, tenantName }, deps)).then(([error, resolution]) => {
1161
1169
  const settled = error ? { hint: tenantLookupFailureHint(tenantName, error.message) } : resolution;
1162
1170
  if (!settled.tenantId) {
1163
1171
  deps.cache.delete(key);
@@ -1170,7 +1178,7 @@ async function resolveRobotTenantId(robotCreds, deps) {
1170
1178
  }
1171
1179
  async function lookupRobotTenantId(target, deps) {
1172
1180
  const { baseUrl, accessToken, organization, tenantName } = target;
1173
- const [error, data] = await catchError(deps.fetchTenantsAndOrgs(baseUrl, accessToken, organization, AbortSignal.timeout(deps.lookupTimeoutMs)));
1181
+ const [error, data] = await catchError2(deps.fetchTenantsAndOrgs(baseUrl, accessToken, organization, AbortSignal.timeout(deps.lookupTimeoutMs)));
1174
1182
  if (error) {
1175
1183
  const reason = error.name === "TimeoutError" ? `the tenant list did not answer within ${deps.lookupTimeoutMs} ms.` : error.message;
1176
1184
  return { hint: tenantLookupFailureHint(tenantName, reason) };
@@ -1192,7 +1200,7 @@ function tenantLookupFailureHint(tenantName, reason) {
1192
1200
  return `Could not resolve the id of tenant '${tenantName}' from the ` + `Robot session: ${reason} Commands that need the tenant id will ` + `fail until it can be resolved.`;
1193
1201
  }
1194
1202
  function decodePathSegment(segment) {
1195
- const [error, decoded] = catchError(() => decodeURIComponent(segment));
1203
+ const [error, decoded] = catchError2(() => decodeURIComponent(segment));
1196
1204
  return error ? segment : decoded;
1197
1205
  }
1198
1206
  var isFileNotFoundError = (error) => {
@@ -1432,26 +1440,38 @@ function errorMessage(error) {
1432
1440
  }
1433
1441
 
1434
1442
  // ../auth/src/authContext.ts
1443
+ class AuthContextUnavailableError extends Error {
1444
+ instructionContext;
1445
+ sessionHint;
1446
+ errorCode = "authentication_required";
1447
+ retry = "RetryWillNotFix";
1448
+ constructor(message, instructionContext = "auth", sessionHint) {
1449
+ super(message);
1450
+ this.instructionContext = instructionContext;
1451
+ this.sessionHint = sessionHint;
1452
+ this.name = "AuthContextUnavailableError";
1453
+ }
1454
+ }
1435
1455
  var getAuthContext = async (options = {}) => {
1436
1456
  const status = await getLoginStatusAsync({
1437
1457
  ensureTokenValidityMinutes: options.ensureTokenValidityMinutes,
1438
1458
  envFilePath: options.envFilePath
1439
1459
  });
1440
1460
  if (status.loginStatus !== "Logged in" || !status.baseUrl || !status.accessToken) {
1441
- throw new Error(status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.");
1461
+ throw new AuthContextUnavailableError(status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.", "auth", status.hint);
1442
1462
  }
1443
- const tenantName = options.tenant ?? status.tenantName;
1463
+ const tenantName = options.tenant || status.tenantName;
1444
1464
  if (options.requireOrganizationId && !status.organizationId) {
1445
- throw new Error("Organization ID not available. Ensure you are logged in with an organization context.");
1465
+ throw new AuthContextUnavailableError("Organization ID not available. Ensure you are logged in with an organization context.", "identity");
1446
1466
  }
1447
1467
  if (options.requireOrganizationName && !status.organizationName) {
1448
- throw new Error("Organization name not available. Ensure you are logged in with an organization context.");
1468
+ throw new AuthContextUnavailableError("Organization name not available. Ensure you are logged in with an organization context.", "identity");
1449
1469
  }
1450
1470
  if (options.requireTenantId && !status.tenantId) {
1451
- throw new Error("Tenant ID not available. Ensure UIPATH_TENANT_ID is set.");
1471
+ throw new AuthContextUnavailableError(`Tenant ID not available. Ensure UIPATH_TENANT_ID is set.${status.hint ? ` ${status.hint}` : ""}`, "identity", status.hint);
1452
1472
  }
1453
- if (options.requireTenantName && tenantName === undefined) {
1454
- throw new Error("Tenant not provided and UIPATH_TENANT_NAME not set. Run 'uip login' to select a tenant, or use 'uip login tenant set <tenant>' to switch tenants.");
1473
+ if (options.requireTenantName && !tenantName) {
1474
+ throw new AuthContextUnavailableError("Tenant not provided and UIPATH_TENANT_NAME not set. Run 'uip login' to select a tenant, or use 'uip login tenant set <tenant>' to switch tenants.", "identity");
1455
1475
  }
1456
1476
  return {
1457
1477
  baseUrl: status.baseUrl,
@@ -2884,7 +2904,7 @@ var package_default = {
2884
2904
  name: "@uipath/orchestrator-sdk",
2885
2905
  author: "UiPath",
2886
2906
  license: "SEE LICENSE IN LICENSE.txt",
2887
- version: "1.205.0",
2907
+ version: "1.206.0",
2888
2908
  repository: {
2889
2909
  type: "git",
2890
2910
  url: "https://github.com/UiPath/cli.git",
@@ -2911,6 +2931,10 @@ var package_default = {
2911
2931
  types: "./dist/src/index.d.ts",
2912
2932
  default: "./dist/index.js"
2913
2933
  }
2934
+ },
2935
+ "./folder-feed": {
2936
+ types: "./dist/src/folder-feed.d.ts",
2937
+ default: "./dist/folder-feed.js"
2914
2938
  }
2915
2939
  },
2916
2940
  files: [
@@ -2918,11 +2942,12 @@ var package_default = {
2918
2942
  ],
2919
2943
  private: true,
2920
2944
  scripts: {
2921
- build: "bun build ./src/index.ts --outdir dist --format esm --target node --sourcemap=linked && bun build ./src/index.browser.ts --outdir dist --format esm --target browser --external @uipath/auth --external @uipath/common --sourcemap=linked && tsc -p tsconfig.build.json --noCheck",
2945
+ build: "bun build ./src/index.ts ./src/folder-feed.ts --outdir dist --format esm --target node --sourcemap=linked && bun build ./src/index.browser.ts --outdir dist --format esm --target browser --external @uipath/auth --external @uipath/common --sourcemap=linked && tsc -p tsconfig.build.json --noCheck",
2922
2946
  generate: "bun run src/scripts/generate-sdk.ts",
2923
2947
  lint: "biome check .",
2924
2948
  test: "vitest run",
2925
- "test:coverage": "vitest run --coverage"
2949
+ "test:coverage": "vitest run --coverage",
2950
+ typecheck: "tsc --noEmit"
2926
2951
  },
2927
2952
  devDependencies: {
2928
2953
  "@uipath/auth": "workspace:*",
@@ -3490,7 +3515,7 @@ async function resolveFolder(input, options) {
3490
3515
  }
3491
3516
  return resolveByKey(foldersApi, input.folderKey);
3492
3517
  }
3493
- return resolveByPath(foldersApi, input.folderPath);
3518
+ return resolveByPath(config, foldersApi, input.folderPath);
3494
3519
  }
3495
3520
  async function resolveByKey(foldersApi, folderKey) {
3496
3521
  const folder = await foldersApi.foldersGetByKeyByIdentifier({
@@ -3507,12 +3532,12 @@ async function resolveByKey(foldersApi, folderKey) {
3507
3532
  feedType: folder.feedType
3508
3533
  };
3509
3534
  }
3510
- async function resolveByPath(foldersApi, folderPath) {
3535
+ async function resolveByPath(config, foldersApi, folderPath) {
3511
3536
  const response = await foldersApi.foldersGet({
3512
3537
  $filter: `FullyQualifiedName eq '${folderPath.replace(/'/g, "''")}'`,
3513
3538
  $top: 1
3514
3539
  });
3515
- const folder = response.value?.[0];
3540
+ const folder = response.value?.[0] ?? await resolveInPersonalWorkspace(config, foldersApi, folderPath);
3516
3541
  if (!folder?.id || !folder.key || !folder.fullyQualifiedName || !folder.displayName) {
3517
3542
  throw new Error(`Folder not found: '${folderPath}'.`);
3518
3543
  }
@@ -3524,6 +3549,66 @@ async function resolveByPath(foldersApi, folderPath) {
3524
3549
  feedType: folder.feedType
3525
3550
  };
3526
3551
  }
3552
+ var CURRENT_USER_FOLDER_PAGE_SIZE = 1000;
3553
+ var CURRENT_USER_FOLDER_PAGE_LIMIT = 50;
3554
+ async function resolveInPersonalWorkspace(config, foldersApi, folderPath) {
3555
+ const workspace = await lookupOrMiss("GetPersonalWorkspace", folderPath, () => new PersonalWorkspacesApi(config).personalWorkspacesGetPersonalWorkspace());
3556
+ if (!workspace?.key || !workspace.name) {
3557
+ return;
3558
+ }
3559
+ const wanted = folderPath.toLowerCase();
3560
+ const root = workspace.name.toLowerCase();
3561
+ let key;
3562
+ if (wanted === root) {
3563
+ key = workspace.key;
3564
+ } else if (wanted.startsWith(`${root}/`)) {
3565
+ key = await findKeyInCurrentUserFolders(foldersApi, folderPath);
3566
+ }
3567
+ if (!key) {
3568
+ return;
3569
+ }
3570
+ const folder = await foldersApi.foldersGetByKeyByIdentifier({
3571
+ identifier: key
3572
+ });
3573
+ return folder?.fullyQualifiedName?.toLowerCase() === wanted ? folder : undefined;
3574
+ }
3575
+ async function findKeyInCurrentUserFolders(foldersApi, folderPath) {
3576
+ const wanted = folderPath.toLowerCase();
3577
+ let skip = 0;
3578
+ for (let page = 0;page < CURRENT_USER_FOLDER_PAGE_LIMIT; page++) {
3579
+ const result = await lookupOrMiss("GetAllForCurrentUser", folderPath, () => foldersApi.foldersGetAllForCurrentUser({
3580
+ take: CURRENT_USER_FOLDER_PAGE_SIZE,
3581
+ skip
3582
+ }));
3583
+ const rows = result?.pageItems ?? [];
3584
+ const match = rows.find((row) => row.fullyQualifiedName?.toLowerCase() === wanted);
3585
+ if (match) {
3586
+ return match.key;
3587
+ }
3588
+ skip += rows.length;
3589
+ if (rows.length === 0 || typeof result?.count === "number" && skip >= result.count) {
3590
+ return;
3591
+ }
3592
+ }
3593
+ logger.debug(`GetAllForCurrentUser: stopped after ${CURRENT_USER_FOLDER_PAGE_LIMIT} pages without finding '${folderPath}'.`);
3594
+ return;
3595
+ }
3596
+ async function lookupOrMiss(endpoint, folderPath, call) {
3597
+ const [error, value] = await catchError(call());
3598
+ if (!error) {
3599
+ return value;
3600
+ }
3601
+ if (!isLookupMiss(error)) {
3602
+ throw error;
3603
+ }
3604
+ logger.debug(`${endpoint} lookup for '${folderPath}' failed: ${await extractErrorMessage(error)}`);
3605
+ return;
3606
+ }
3607
+ function isLookupMiss(error) {
3608
+ const failure = error;
3609
+ const status = failure?.response?.status ?? failure?.status;
3610
+ return typeof status === "number" && status >= 400 && status < 500 && status !== 408 && status !== 429;
3611
+ }
3527
3612
 
3528
3613
  // ../orchestrator-sdk/src/odata.ts
3529
3614
  var ODATA_STRING_LITERAL_PATTERN = /^'(?:[^']|'')*'$/;
@@ -3758,4 +3843,4 @@ var KB_INLINE_LIMITS = {
3758
3843
  };
3759
3844
  export { getLoginStatusAsync, getAuthContext, BusinessRulesApi, PersonalWorkspacesApi, UsersApi, createApiClient, resolveFolder, quoteODataStringLiteral };
3760
3845
 
3761
- //# debugId=E77C8053501FB34864756E2164756E21
3846
+ //# debugId=FCF55219427BCDC464756E2164756E21
@@ -18,7 +18,7 @@ var __toESM = (mod, isNodeMode, target) => {
18
18
  return cached;
19
19
  }
20
20
  target = mod != null ? __create(__getProtoOf(mod)) : {};
21
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
21
+ const to = isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
22
22
  if (mod && typeof mod === "object" || typeof mod === "function") {
23
23
  for (let key of __getOwnPropNames(mod))
24
24
  if (!__hasOwnProp.call(to, key))
@@ -32,8 +32,17 @@ var __toESM = (mod, isNodeMode, target) => {
32
32
  return to;
33
33
  };
34
34
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
35
+ var __exportCjs = (target, getters, setters) => {
36
+ for (var name in getters)
37
+ __defProp(target, name, {
38
+ get: getters[name],
39
+ set: setters[name],
40
+ enumerable: true,
41
+ configurable: true
42
+ });
43
+ };
35
44
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
36
45
 
37
- export { __toESM, __commonJS, __require };
46
+ export { __toESM, __commonJS, __exportCjs, __require };
38
47
 
39
- //# debugId=4A15A0D6FCDB684764756E2164756E21
48
+ //# debugId=6692E9B4C735B07364756E2164756E21
@@ -1,14 +1,11 @@
1
1
  import {
2
- RulesCommandError,
3
- isJsonObject
4
- } from "./tool-t4k013ex.js";
2
+ getFileSystem,
3
+ catchError
4
+ } from "./tool-cs8nyk0r.js";
5
5
  import {
6
- catchError,
7
- getFileSystem
8
- } from "./tool-wf2qkrye.js";
9
- import {
10
- __require
11
- } from "./tool-1de529jm.js";
6
+ RulesCommandError2,
7
+ isJsonObject2
8
+ } from "./tool-njnhj05q.js";
12
9
 
13
10
  // ../packager/packager-tool-businessrules/src/entry-point-id.ts
14
11
  var EntryPointIdSalt = "uipath:business-rules:entry-point";
@@ -51,7 +48,7 @@ async function readRuleProjectAsync(projectPath) {
51
48
  contents: await fs.readFile(fs.path.join(projectDir, name), "utf-8") ?? ""
52
49
  })));
53
50
  if (dmnFiles.length === 0) {
54
- throw new RulesCommandError(`No .dmn file found in ${projectDir}.`, "not_found", "Add the rule's .dmn file at the top level of the project, or run 'uip rules init <name>' to scaffold one.");
51
+ throw new RulesCommandError2(`No .dmn file found in ${projectDir}.`, "not_found", "Add the rule's .dmn file at the top level of the project, or run 'uip rules init <name>' to scaffold one.");
55
52
  }
56
53
  return {
57
54
  projectDir,
@@ -61,7 +58,7 @@ async function readRuleProjectAsync(projectPath) {
61
58
  };
62
59
  }
63
60
  async function buildRuleEntryPointsAsync(dmnFiles, publishedEntryPoints, ruleName) {
64
- const { buildBusinessRulePackagingFiles } = await import("./index-bhjt1h5c.js");
61
+ const { buildBusinessRulePackagingFiles } = await import("./index-zeszs1ra.js");
65
62
  const packaging = await buildBusinessRulePackagingFiles(dmnFiles, publishedEntryPoints, true);
66
63
  if (publishedEntryPoints != null || ruleName === undefined) {
67
64
  return packaging;
@@ -81,10 +78,10 @@ async function readRulesProjectNameAsync(projectDir) {
81
78
  const raw = await fs.readFile(filePath, "utf-8");
82
79
  const project = raw === null ? undefined : parseJson(raw);
83
80
  if (raw !== null && project === undefined) {
84
- throw new RulesCommandError(`Could not read ${filePath}: it is not valid JSON.`, "invalid_argument", "Fix the project file, or run 'uip rules init <name> --force' to recreate it.");
81
+ throw new RulesCommandError2(`Could not read ${filePath}: it is not valid JSON.`, "invalid_argument", "Fix the project file, or run 'uip rules init <name> --force' to recreate it.");
85
82
  }
86
- if (!isJsonObject(project) || project.ProjectType !== "BusinessRules") {
87
- throw new RulesCommandError(`${projectDir} is not a business rules project.`, "invalid_argument", "Pass the folder that holds the rules project's project.uiproj, created by 'uip rules init'.");
83
+ if (!isJsonObject2(project) || project.ProjectType !== "BusinessRules") {
84
+ throw new RulesCommandError2(`${projectDir} is not a business rules project.`, "invalid_argument", "Pass the folder that holds the rules project's project.uiproj, created by 'uip rules init'.");
88
85
  }
89
86
  return typeof project.Name === "string" ? project.Name : "";
90
87
  }
@@ -96,8 +93,8 @@ async function readPublishedEntryPoints(projectDir) {
96
93
  return;
97
94
  }
98
95
  const published = parseJson(raw);
99
- if (!isJsonObject(published) || !Array.isArray(published.entryPoints)) {
100
- throw new RulesCommandError(`${filePath} is not an entry-points document: it needs an "entryPoints" array.`, "invalid_argument", `Fix or delete ${ENTRY_POINTS_FILE}; deleting it gives every entry point a new uniqueId, which breaks the consumers bound to the old ones.`);
96
+ if (!isJsonObject2(published) || !Array.isArray(published.entryPoints)) {
97
+ throw new RulesCommandError2(`${filePath} is not an entry-points document: it needs an "entryPoints" array.`, "invalid_argument", `Fix or delete ${ENTRY_POINTS_FILE}; deleting it gives every entry point a new uniqueId, which breaks the consumers bound to the old ones.`);
101
98
  }
102
99
  return published;
103
100
  }
@@ -108,4 +105,4 @@ function parseJson(raw) {
108
105
 
109
106
  export { ENTRY_POINTS_FILE, BINDINGS_FILE, readRuleProjectAsync, buildRuleEntryPointsAsync, readRulesProjectNameAsync };
110
107
 
111
- //# debugId=1C1501D8026EDA3B64756E2164756E21
108
+ //# debugId=3C93FC778F7ABEA064756E2164756E21
@@ -1,51 +1,49 @@
1
- import {
2
- R,
3
- X
4
- } from "./tool-z1ay3csx.js";
5
1
  import {
6
2
  e,
7
- i,
8
3
  n,
9
- r
10
- } from "./tool-jd313s2x.js";
4
+ i,
5
+ r,
6
+ R2,
7
+ X2
8
+ } from "./tool-sbtf80ft.js";
11
9
 
12
10
  // ../../node_modules/@uipath/dmn-editor-utils/dist/chunks/chunk-JAGAV2EF.js
13
11
  var f = new Set([e.Collect, e.RuleOrder, e.OutputOrder]);
14
- var m = new Set([e.Priority, e.OutputOrder]);
12
+ var m3 = new Set([e.Priority, e.OutputOrder]);
15
13
  var O = (e2) => e2.hitPolicy === e.Collect && e2.aggregation ? e2.aggregation : f.has(e2.hitPolicy) ? "list" : "value";
16
- var R2 = (e2) => !!e2 && i.includes(e2);
14
+ var R = (e2) => !!e2 && i.includes(e2);
17
15
  var C = (e2, n2) => e2 === n.Sum || e2 === n.Count ? "number" : n2?.typeRef;
18
16
  var p = (e2, n2) => n2.typeRef ?? (e2.decision.decisionTable.outputs.length === 1 ? e2.decision.variableTypeRef : undefined);
19
- var T = (e2, n2) => X(e2, n2).isCollection;
20
- var g = (e2) => r.includes(R(e2));
17
+ var T = (e2, n2) => X2(e2, n2).isCollection;
18
+ var g2 = (e2) => r.includes(R2(e2));
21
19
  var x = (e2, n2) => {
22
- let t = X(e2, n2);
20
+ let t = X2(e2, n2);
23
21
  if (t.isCollection || t.foreign)
24
22
  return false;
25
23
  let i2 = t.baseTypeRef;
26
- return i2 === undefined || g(i2) && i2 !== "Any";
24
+ return i2 === undefined || g2(i2) && i2 !== "Any";
27
25
  };
28
26
  var u = (e2, n2) => {
29
- let t = X(e2, n2);
27
+ let t = X2(e2, n2);
30
28
  if (t.foreign)
31
29
  return "Any";
32
30
  if (t.baseTypeRef !== undefined)
33
31
  return t.baseTypeRef;
34
32
  let i2 = t.chain[t.chain.length - 1];
35
- return i2 ? R(i2.name) : undefined;
33
+ return i2 ? R2(i2.name) : undefined;
36
34
  };
37
- var E = (e2, n2) => n2 && g(n2) ? n2 : u(e2, n2);
35
+ var E2 = (e2, n2) => n2 && g2(n2) ? n2 : u(e2, n2);
38
36
  var A = (e2, n2) => {
39
- let t = p(e2, n2), i2 = n2.allowedValues?.text.trim() || X(e2, t).chain.find((r2) => r2.allowedValues?.trim())?.allowedValues;
37
+ let t = p(e2, n2), i2 = n2.allowedValues?.text.trim() || X2(e2, t).chain.find((r2) => r2.allowedValues?.trim())?.allowedValues;
40
38
  return i2 ? { text: i2, typeRef: u(e2, t) } : undefined;
41
39
  };
42
40
  var S = (e2, n2, t) => {
43
41
  if (n2 === n.Count)
44
42
  return true;
45
43
  let i2 = p(e2, t), r2 = u(e2, i2);
46
- return !T(e2, i2) && (!r2 || ["number", "Any"].includes(R(r2)));
44
+ return !T(e2, i2) && (!r2 || ["number", "Any"].includes(R2(r2)));
47
45
  };
48
46
 
49
- export { f, m, O, R2 as R, C, p, T, g, x, u, E, A, S };
47
+ export { f, m3, O, R, C, p, T, g2, x, u, E2, A, S };
50
48
 
51
- //# debugId=5BB7BDD21176C3C264756E2164756E21
49
+ //# debugId=31405D58E09C528664756E2164756E21
@@ -0,0 +1,73 @@
1
+ import {
2
+ BusinessRulesApi,
3
+ createApiClient,
4
+ resolveFolder,
5
+ quoteODataStringLiteral
6
+ } from "./tool-e23cj2jx.js";
7
+ import {
8
+ RulesCommandError2
9
+ } from "./tool-njnhj05q.js";
10
+
11
+ // src/services/business-rules.ts
12
+ function assertOneFolderOption2(options) {
13
+ if (options.folderPath !== undefined && options.folderKey !== undefined) {
14
+ throw new RulesCommandError2("Options --folder-path and --folder-key cannot be used together.", "invalid_argument", "Provide either --folder-path <path> or --folder-key <key>, not both.");
15
+ }
16
+ }
17
+ async function resolveRequiredFolder2(options) {
18
+ assertOneFolderOption2(options);
19
+ const folder = await resolveFolder({ folderPath: options.folderPath, folderKey: options.folderKey }, { tenant: options.tenant });
20
+ if (!folder) {
21
+ throw new RulesCommandError2("Missing required option --folder-path or --folder-key.", "invalid_argument", "Provide --folder-path <path> or --folder-key <key>. Run 'uip or folders list' to find folder paths.");
22
+ }
23
+ return folder;
24
+ }
25
+ function createRulesApi2(tenant, folder) {
26
+ return createApiClient(BusinessRulesApi, {
27
+ tenant,
28
+ folderId: folder.id.toString()
29
+ });
30
+ }
31
+ function ruleNotFound2(name, folder) {
32
+ return new RulesCommandError2(`Business rule '${name}' was not found in folder '${folder.path}'.`, "not_found", `Run 'uip rules list --folder-path "${folder.path}"' to see the rules in this folder.`);
33
+ }
34
+ async function findRuleByName2(api, name, folder) {
35
+ const result = await api.businessRulesGet({
36
+ $filter: `Name eq ${quoteODataStringLiteral(name)}`,
37
+ $top: 1
38
+ });
39
+ const rule = result.value?.[0];
40
+ if (!rule) {
41
+ throw ruleNotFound2(name, folder);
42
+ }
43
+ return rule;
44
+ }
45
+ function formatRule2(rule, folder) {
46
+ return {
47
+ Key: rule.id ?? "",
48
+ Name: rule.name,
49
+ FolderPath: folder.path,
50
+ FolderKey: folder.key,
51
+ Description: rule.description ?? "",
52
+ CurrentVersion: rule.currentVersion?.versionNumber ?? ""
53
+ };
54
+ }
55
+ function formatRuleDetail2(rule, folder) {
56
+ return {
57
+ ...formatRule2(rule, folder),
58
+ Tags: (rule.tags ?? []).map((tag) => tag.name),
59
+ CreationTime: rule.creationTime,
60
+ LastModificationTime: rule.lastModificationTime
61
+ };
62
+ }
63
+ function formatVersion2(version) {
64
+ return {
65
+ Version: version.versionNumber ?? "",
66
+ IsActive: version.isActive === true,
67
+ CreationTime: version.creationTime
68
+ };
69
+ }
70
+
71
+ export { assertOneFolderOption2, resolveRequiredFolder2, createRulesApi2, ruleNotFound2, findRuleByName2, formatRule2, formatRuleDetail2, formatVersion2 };
72
+
73
+ //# debugId=3821AC45F94CDB2E64756E2164756E21