@uipath/rules-tool 1.204.0 → 1.205.0-preview.258

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 (47) hide show
  1. package/README.md +7 -5
  2. package/dist/DmnFactory-L7MABUC6-98k17dkr.js +46 -0
  3. package/dist/{KieDmnMarshaller-6TTUU5B4-47q50gk4.js → KieDmnMarshaller-LGE63WDG-3vemswef.js} +2 -2
  4. package/dist/THIRD-PARTY-NOTICES.md +26 -9
  5. package/dist/{business-rules-bnr581tz.js → business-rules-pm96sefm.js} +4 -4
  6. package/dist/{constants-9pa118cj.js → constants-cnn0jfw6.js} +18 -17
  7. package/dist/{embedded-file-reader-rf2g1kfj.js → embedded-file-reader-z4becc02.js} +2 -2
  8. package/dist/hitPolicyResult-CGCR73CW-9bmc4nsr.js +36 -0
  9. package/dist/index-52h8rpew.js +21 -0
  10. package/dist/index-bhjt1h5c.js +227 -0
  11. package/dist/{index-2hzp9b97.js → index-cpm94vee.js} +21 -5
  12. package/dist/index-x9msn1dj.js +85 -0
  13. package/dist/{index-4c4exdzw.js → index-ybrgtfsg.js} +576 -285
  14. package/dist/index.js +2 -2
  15. package/dist/rule-catalog-10fhgevc.js +74 -0
  16. package/dist/{rules-command-error-20gp2dv9.js → rules-command-error-k6kxwfn7.js} +2 -2
  17. package/dist/{rules-debug-service-qd3aqcg1.js → rules-debug-service-86e47tv4.js} +19 -13
  18. package/dist/{rules-init-service-xsh7mx96.js → rules-init-service-3z07e0v8.js} +7 -7
  19. package/dist/{rules-refresh-service-jgk2kq9d.js → rules-refresh-service-jn6my893.js} +3 -3
  20. package/dist/{rules-validate-service-mr2fk58k.js → rules-validate-service-hfw8m3dm.js} +7 -7
  21. package/dist/{tool-pm3ewdxc.js → tool-1pccj6q3.js} +4 -3
  22. package/dist/{tool-jpwm68hm.js → tool-5zs9eywg.js} +103 -63
  23. package/dist/tool-86f1xpxn.js +51 -0
  24. package/dist/{tool-75esv9bk.js → tool-a4r4a9be.js} +17 -7
  25. package/dist/tool-cfrcyxgm.js +26 -0
  26. package/dist/{tool-av4mmsef.js → tool-fbmxx07c.js} +2 -2
  27. package/dist/{tool-2cky8jwp.js → tool-fbxe48wd.js} +1071 -208
  28. package/dist/tool-fk8rznma.js +827 -0
  29. package/dist/{tool-mkn83w88.js → tool-gkbr01gc.js} +3 -3
  30. package/dist/{tool-8h4er38s.js → tool-h7gn1rar.js} +3 -3
  31. package/dist/{tool-8qy8pkp4.js → tool-t4k013ex.js} +8 -5
  32. package/dist/tool-tjcg2xje.js +4616 -0
  33. package/dist/{tool-eymjx05p.js → tool-txp5th7j.js} +760 -3395
  34. package/dist/{tool-tkcx6png.js → tool-wf2qkrye.js} +25 -5
  35. package/dist/{tool-wmh645tm.js → tool-yq5jph4h.js} +169 -119
  36. package/dist/tool-z1ay3csx.js +176 -0
  37. package/dist/tool.js +2 -2
  38. package/package.json +2 -2
  39. package/dist/DmnFactory-VWZOSZHH-jkpbxz3n.js +0 -42
  40. package/dist/hitPolicyResult-4WDHTX4A-gk103w84.js +0 -33
  41. package/dist/index-34pj9f36.js +0 -48
  42. package/dist/index-fs1nd5ap.js +0 -200
  43. package/dist/index-t4mx1a5e.js +0 -17
  44. package/dist/rule-catalog-5gzpe93c.js +0 -46
  45. package/dist/tool-19b4ect0.js +0 -754
  46. package/dist/tool-4dfpdepw.js +0 -55
  47. package/dist/tool-m41px07w.js +0 -49
package/dist/index.js CHANGED
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  metadata,
4
4
  registerCommands
5
- } from "./tool-jpwm68hm.js";
5
+ } from "./tool-5zs9eywg.js";
6
6
  import {
7
7
  Command
8
- } from "./tool-tkcx6png.js";
8
+ } from "./tool-wf2qkrye.js";
9
9
  import"./tool-1de529jm.js";
10
10
 
11
11
  // src/index.ts
@@ -0,0 +1,74 @@
1
+ import {
2
+ createResourceBuilderServices,
3
+ exportResourceDefinitionAsync,
4
+ findCatalogEntityAsync,
5
+ getRemoteResourceClients,
6
+ getSolutionAuthContext,
7
+ readSpecEntryPoints,
8
+ toResourceReference
9
+ } from "./tool-fbxe48wd.js";
10
+ import"./tool-gdtpsdn7.js";
11
+ import"./tool-53w8skv5.js";
12
+ import"./tool-1pccj6q3.js";
13
+ import {
14
+ createRulesApi,
15
+ findRuleByName
16
+ } from "./tool-fbmxx07c.js";
17
+ import"./tool-txp5th7j.js";
18
+ import {
19
+ RulesCommandError
20
+ } from "./tool-t4k013ex.js";
21
+ import"./tool-wf2qkrye.js";
22
+ import"./tool-1de529jm.js";
23
+
24
+ // src/services/rule-catalog.ts
25
+ var BUSINESS_RULE_ENTITY_TYPE = "BusinessRule";
26
+ async function describeRuleAsync(name, folder) {
27
+ await getSolutionAuthContext({});
28
+ const { catalog, importer } = getRemoteResourceClients(await createResourceBuilderServices());
29
+ const entity = await findCatalogEntityAsync(catalog, { name, entityTypes: [BUSINESS_RULE_ENTITY_TYPE] }, (e) => e.entityName?.toLowerCase() === name.toLowerCase() && e.folderKey?.toLowerCase() === folder.key.toLowerCase());
30
+ if (!entity?.entityKey) {
31
+ await findRuleByName(await createRulesApi(undefined, folder), name, folder);
32
+ throw new RulesCommandError(`Business rule '${name}' is not in the resource catalog for folder '${folder.path}' yet.`, "not_found", "The rule exists in Orchestrator but the resource catalog does not list it yet, which is normal right after a deploy. Run the command again shortly.", "RetryAfter60Seconds");
33
+ }
34
+ const definition = await exportResourceDefinitionAsync(importer, toResourceReference(entity));
35
+ return readEntryPoints(definition?.spec, name);
36
+ }
37
+ async function listRulesAcrossFoldersAsync(limit, offset) {
38
+ await getSolutionAuthContext({});
39
+ const { catalog } = getRemoteResourceClients(await createResourceBuilderServices());
40
+ const rows = [];
41
+ let pageCursor;
42
+ do {
43
+ const page = await catalog.searchFolderEntities({
44
+ entityTypes: [BUSINESS_RULE_ENTITY_TYPE],
45
+ pageSize: 100,
46
+ pageCursor
47
+ });
48
+ rows.push(...(page.items ?? []).filter((e) => e.entityKey && e.entityName));
49
+ pageCursor = page.nextPage ?? undefined;
50
+ } while (pageCursor && rows.length <= offset + limit);
51
+ return {
52
+ rows: rows.slice(offset, offset + limit).map((entity) => ({
53
+ Key: entity.entityKey ?? "",
54
+ Name: entity.entityName ?? "",
55
+ FolderPath: entity.fullyQualifiedName ?? "",
56
+ FolderKey: entity.folderKey ?? "",
57
+ Description: entity.entityDescription ?? ""
58
+ })),
59
+ hasMore: rows.length > offset + limit
60
+ };
61
+ }
62
+ function readEntryPoints(spec, name) {
63
+ const entryPoints = readSpecEntryPoints(spec);
64
+ if (!entryPoints) {
65
+ throw new RulesCommandError(`Business rule '${name}' has no argument contract on its resource.`, "configuration_error", "Redeploy the rule from its solution with 'uip solution publish' and 'uip solution deploy run' so its package carries entry-points.json. If it still has no contract, contact your tenant administrator.");
66
+ }
67
+ return entryPoints;
68
+ }
69
+ export {
70
+ describeRuleAsync,
71
+ listRulesAcrossFoldersAsync
72
+ };
73
+
74
+ //# debugId=C8497903216657FE64756E2164756E21
@@ -2,8 +2,8 @@ import {
2
2
  RulesCommandError,
3
3
  isJsonObject,
4
4
  reportRulesFailure
5
- } from "./tool-8qy8pkp4.js";
6
- import"./tool-tkcx6png.js";
5
+ } from "./tool-t4k013ex.js";
6
+ import"./tool-wf2qkrye.js";
7
7
  import"./tool-1de529jm.js";
8
8
  export {
9
9
  RulesCommandError,
@@ -1,32 +1,33 @@
1
1
  import {
2
2
  buildSolutionPackageFromDir,
3
3
  uploadOrOverwriteSolution
4
- } from "./tool-75esv9bk.js";
4
+ } from "./tool-a4r4a9be.js";
5
5
  import {
6
6
  findSolutionFile,
7
7
  updateSolutionFile
8
- } from "./tool-pm3ewdxc.js";
8
+ } from "./tool-1pccj6q3.js";
9
9
  import {
10
10
  readRulesProjectNameAsync
11
- } from "./tool-mkn83w88.js";
11
+ } from "./tool-gkbr01gc.js";
12
12
  import {
13
13
  assertOneFolderOption,
14
14
  resolveRequiredFolder
15
- } from "./tool-av4mmsef.js";
15
+ } from "./tool-fbmxx07c.js";
16
16
  import {
17
17
  PersonalWorkspacesApi,
18
18
  createApiClient,
19
19
  getAuthContext
20
- } from "./tool-eymjx05p.js";
20
+ } from "./tool-txp5th7j.js";
21
21
  import {
22
22
  RulesCommandError,
23
23
  isJsonObject
24
- } from "./tool-8qy8pkp4.js";
24
+ } from "./tool-t4k013ex.js";
25
25
  import {
26
+ OutputFormatter,
26
27
  catchError,
27
28
  getFileSystem,
28
29
  logger
29
- } from "./tool-tkcx6png.js";
30
+ } from "./tool-wf2qkrye.js";
30
31
  import"./tool-1de529jm.js";
31
32
 
32
33
  // src/services/rules-engine-client.ts
@@ -76,11 +77,14 @@ async function postDebugEvaluate(config, request, timeoutSeconds) {
76
77
  }
77
78
  async function engineFailure(response, tenantName) {
78
79
  const text = await response.text().catch(() => "");
79
- if (response.status === 404 && /Service: businessrules not found in Organization/i.test(text)) {
80
- return new RulesCommandError(`Business Rules is not enabled on tenant '${tenantName}'.`, "configuration_error", "Ask your UiPath contact to enable Business Rules for this tenant, or switch to a tenant that has it with 'uip login tenant set <tenant-name>'.");
80
+ if (response.status === 404 && /businessrules not found in organization/i.test(text)) {
81
+ return new RulesCommandError(`Business Rules is not available on tenant '${tenantName}': it is not enabled there, or not offered in the tenant's region.`, "configuration_error", "Switch to a tenant that has Business Rules with 'uip login tenant set <tenant-name>', or ask your UiPath representative to enable it for this tenant.", "RetryWillNotFix", { httpStatus: 404 });
81
82
  }
82
83
  const [, body] = catchError(() => JSON.parse(text));
83
84
  const error = isJsonObject(body) && isJsonObject(body.error) ? body.error : {};
85
+ if (error.code === "PREVIEW_NOT_ENABLED") {
86
+ return new RulesCommandError("Business Rules is a preview feature and is not enabled for your organization.", "configuration_error", "Ask your UiPath representative to enroll your organization in the Business Rules preview.", "RetryWillNotFix", { httpStatus: response.status, errorCode: error.code });
87
+ }
84
88
  if (error.code === "STUDIO_FORBIDDEN") {
85
89
  return new RulesCommandError("Studio Web did not let the rules engine read the uploaded project.", "permission_denied", "Check in Studio Web that your account can open the uploaded solution.");
86
90
  }
@@ -91,7 +95,7 @@ async function engineFailure(response, tenantName) {
91
95
  // src/services/rules-debug-service.ts
92
96
  async function debugRuleProjectAsync(projectPath, options) {
93
97
  assertOneFolderOption(options);
94
- const inputs = [{ id: "1", data: await parseInput(options.inputs) }];
98
+ const input = await parseInput(options.inputs);
95
99
  const fs = getFileSystem();
96
100
  const projectDir = fs.path.resolve(projectPath);
97
101
  const projectName = await readRulesProjectName(projectDir);
@@ -101,8 +105,10 @@ async function debugRuleProjectAsync(projectPath, options) {
101
105
  await assertBusinessRulesServiceAsync(config, options.timeout);
102
106
  const folderKey = await evaluationFolderKey(options);
103
107
  const existingSolutionId = (await findSolutionFile(fs, projectDir))?.solutionId;
104
- logger.info(`Uploading the solution of '${projectName}' to Studio Web...`);
105
108
  const uisPath = await buildSolutionPackageFromDir(fs, solutionDir);
109
+ OutputFormatter.log({
110
+ Message: `Uploading the local solution of '${projectName}' to Studio Web.`
111
+ });
106
112
  const [uploadError, upload] = await catchError(uploadOrOverwriteSolution(config, organizationName, uisPath, existingSolutionId, fs));
107
113
  await fs.rm(uisPath).catch(() => {
108
114
  return;
@@ -118,7 +124,7 @@ async function debugRuleProjectAsync(projectPath, options) {
118
124
  throw new RulesCommandError(`Studio Web returned no project named '${projectName}' for the uploaded solution.`, "not_found", "Check that the project is listed in the solution's .uipx, then run the command again.");
119
125
  }
120
126
  logger.info(`Evaluating against Studio Web project ${project.id}...`);
121
- const response = await evaluateRuleDebugAsync({ ...config, folderKey }, { projectId: project.id, explain: options.explain, inputs }, options.timeout);
127
+ const response = await evaluateRuleDebugAsync({ ...config, folderKey }, { projectId: project.id, input }, options.timeout);
122
128
  return {
123
129
  solutionId: upload.id,
124
130
  projectId: project.id,
@@ -190,4 +196,4 @@ export {
190
196
  debugRuleProjectAsync
191
197
  };
192
198
 
193
- //# debugId=176F4486C7DFBCBB64756E2164756E21
199
+ //# debugId=4DAA15188929FF8E64756E2164756E21
@@ -1,25 +1,25 @@
1
- import"./tool-75esv9bk.js";
1
+ import"./tool-a4r4a9be.js";
2
2
  import {
3
3
  prepareProjectLocation,
4
4
  tryRegisterProjectInParentSolution
5
- } from "./tool-pm3ewdxc.js";
5
+ } from "./tool-1pccj6q3.js";
6
6
  import {
7
7
  BINDINGS_FILE,
8
8
  ENTRY_POINTS_FILE,
9
9
  buildRuleEntryPointsAsync
10
- } from "./tool-mkn83w88.js";
11
- import"./tool-8qy8pkp4.js";
10
+ } from "./tool-gkbr01gc.js";
11
+ import"./tool-t4k013ex.js";
12
12
  import {
13
13
  catchError,
14
14
  getFileSystem
15
- } from "./tool-tkcx6png.js";
15
+ } from "./tool-wf2qkrye.js";
16
16
  import {
17
17
  __require
18
18
  } from "./tool-1de529jm.js";
19
19
 
20
20
  // src/services/project-artifacts.ts
21
21
  async function ensureProjectArtifacts(args) {
22
- const { addProjectArtifactsToSolutionAsync } = await import("./index-2hzp9b97.js");
22
+ const { addProjectArtifactsToSolutionAsync } = await import("./index-cpm94vee.js");
23
23
  return addProjectArtifactsToSolutionAsync(args);
24
24
  }
25
25
 
@@ -29,7 +29,7 @@ var SEEDED_DMN_FILE = "Business rule.dmn";
29
29
  var formatJson = (value) => `${JSON.stringify(value, null, 2)}
30
30
  `;
31
31
  async function createSeededRuleFilesAsync(ruleName) {
32
- const { createNewBusinessRuleDmn } = await import("./constants-9pa118cj.js");
32
+ const { createNewBusinessRuleDmn } = await import("./constants-cnn0jfw6.js");
33
33
  const dmn = createNewBusinessRuleDmn();
34
34
  const packaging = await buildRuleEntryPointsAsync([{ name: SEEDED_DMN_FILE, contents: dmn }], undefined, ruleName);
35
35
  return {
@@ -3,15 +3,15 @@ import {
3
3
  ENTRY_POINTS_FILE,
4
4
  buildRuleEntryPointsAsync,
5
5
  readRuleProjectAsync
6
- } from "./tool-mkn83w88.js";
6
+ } from "./tool-gkbr01gc.js";
7
7
  import {
8
8
  RulesCommandError
9
- } from "./tool-8qy8pkp4.js";
9
+ } from "./tool-t4k013ex.js";
10
10
  import {
11
11
  catchError,
12
12
  extractErrorMessageSync,
13
13
  getFileSystem
14
- } from "./tool-tkcx6png.js";
14
+ } from "./tool-wf2qkrye.js";
15
15
  import"./tool-1de529jm.js";
16
16
 
17
17
  // src/services/rules-refresh-service.ts
@@ -2,9 +2,9 @@ import {
2
2
  ENTRY_POINTS_FILE,
3
3
  buildRuleEntryPointsAsync,
4
4
  readRuleProjectAsync
5
- } from "./tool-mkn83w88.js";
6
- import"./tool-8qy8pkp4.js";
7
- import"./tool-tkcx6png.js";
5
+ } from "./tool-gkbr01gc.js";
6
+ import"./tool-t4k013ex.js";
7
+ import"./tool-wf2qkrye.js";
8
8
  import {
9
9
  __require
10
10
  } from "./tool-1de529jm.js";
@@ -40,10 +40,10 @@ async function validateDmnFileAsync(file) {
40
40
  { importDmnDocument },
41
41
  { UnreadableDmnError }
42
42
  ] = await Promise.all([
43
- import("./index-4c4exdzw.js"),
44
- import("./index-t4mx1a5e.js"),
45
- import("./index-34pj9f36.js"),
46
- import("./index-fs1nd5ap.js")
43
+ import("./index-ybrgtfsg.js"),
44
+ import("./index-52h8rpew.js"),
45
+ import("./index-x9msn1dj.js"),
46
+ import("./index-bhjt1h5c.js")
47
47
  ]);
48
48
  const diagnostics = await validateDmnDocument(file.contents);
49
49
  const imported = diagnostics.some((d) => d.code === "DMN_DOCUMENT_UNREADABLE") ? await importDmnDocument(file.contents) : undefined;
@@ -1,8 +1,9 @@
1
1
  import {
2
2
  catchError,
3
3
  logger,
4
+ quoteForShell,
4
5
  unsupportedSolutionProjectType
5
- } from "./tool-tkcx6png.js";
6
+ } from "./tool-wf2qkrye.js";
6
7
 
7
8
  // ../solution-sdk/src/solution-file.ts
8
9
  var STUDIO_WEB_PROJECT_TYPE_OVERRIDES = {
@@ -421,7 +422,7 @@ function buildRegistrationSuccessInstructions(solutionDir) {
421
422
  return [
422
423
  "The project is listed in the parent solution manifest.",
423
424
  "Packing or uploading the solution will sync solution resources automatically.",
424
- `To sync resources before packaging, run 'uip solution resources refresh --solution-folder "${solutionDir}"'.`
425
+ `To sync resources before packaging, run: uip solution resources refresh --solution-folder ${quoteForShell(solutionDir)}`
425
426
  ].join(`
426
427
  `);
427
428
  }
@@ -1112,4 +1113,4 @@ function zipSync(data, opts) {
1112
1113
 
1113
1114
  export { normalizeProjectType, toPortableRelativePath, prepareProjectLocation, findSolutionFile, updateSolutionFile, tryRegisterProjectInParentSolution, findSolutionFileUpward, zipSync };
1114
1115
 
1115
- //# debugId=C832F611B3EFC07D64756E2164756E21
1116
+ //# debugId=3445B6577F0AE8E064756E2164756E21
@@ -10,7 +10,7 @@ import {
10
10
  parseLimit,
11
11
  parseOffset,
12
12
  processContext
13
- } from "./tool-tkcx6png.js";
13
+ } from "./tool-wf2qkrye.js";
14
14
  import {
15
15
  __require
16
16
  } from "./tool-1de529jm.js";
@@ -19,7 +19,7 @@ var package_default = {
19
19
  name: "@uipath/rules-tool",
20
20
  author: "UiPath",
21
21
  license: "SEE LICENSE IN LICENSE.txt",
22
- version: "1.204.0",
22
+ version: "1.205.0-preview.258",
23
23
  description: "Create and manage UiPath Business Rules (DMN) projects.",
24
24
  private: false,
25
25
  repository: {
@@ -56,7 +56,7 @@ var package_default = {
56
56
  "@types/node": "^25.5.2",
57
57
  "@uipath/auth": "workspace:*",
58
58
  "@uipath/common": "workspace:*",
59
- "@uipath/dmn-editor-utils": "0.1164.0",
59
+ "@uipath/dmn-editor-utils": "0.1201.7",
60
60
  "@uipath/filesystem": "workspace:*",
61
61
  "@uipath/orchestrator-sdk": "workspace:*",
62
62
  "@uipath/packager-tool-businessrules": "workspace:*",
@@ -71,7 +71,7 @@ var package_default = {
71
71
  var RULES_DEBUG_EXAMPLES = [
72
72
  {
73
73
  Description: "Upload the rules project to Studio Web and evaluate it with one set of input values, returning the trace id of the run",
74
- Command: `uip rules debug ./LoanSolution/LoanEligibility --inputs '{"creditScore": 720}' --explain`,
74
+ Command: `uip rules debug ./LoanSolution/LoanEligibility --inputs '{"creditScore": 720}'`,
75
75
  Output: {
76
76
  Code: "RulesDebug",
77
77
  Data: {
@@ -79,44 +79,39 @@ var RULES_DEBUG_EXAMPLES = [
79
79
  projectId: "ee8a16e8-385c-42c1-81ee-1628ab7d7cb7",
80
80
  studioWebUrl: "https://cloud.uipath.com/acme/studio_/designer/ee8a16e8-385c-42c1-81ee-1628ab7d7cb7?solutionId=30823424-33e3-405e-f21c-08df1c789a14",
81
81
  fileName: "LoanEligibility.dmn",
82
- stats: {
83
- submitted: 1,
84
- succeeded: 1,
85
- failed: 0,
86
- notEvaluated: 0
82
+ result: {
83
+ decisions: [
84
+ {
85
+ decisionName: "Eligibility",
86
+ outputs: { eligible: true }
87
+ }
88
+ ]
87
89
  },
88
- results: [
89
- {
90
- id: "1",
91
- decisions: [
92
- {
93
- decisionName: "Eligibility",
94
- outputs: { eligible: true }
95
- }
96
- ]
97
- }
98
- ],
99
90
  traceId: "499d9124f5da47462bd6535055483918"
100
91
  }
101
92
  }
102
93
  }
103
94
  ];
104
95
  var registerDebugCommand = (program) => {
105
- program.command("debug").description("Upload the rules project's solution to Studio Web and evaluate it once through the rules engine. Returns the decision outputs and errors, and with --explain the trace id that shows which rules fired.").argument("<project-path>", "Path to the business rules project directory (must contain project.uiproj)").option("-i, --inputs <json>", "Input values as a JSON object or @file.json").option("--explain", "Publish a trace of the run and return its id (read it with 'uip traces spans get')").option("--folder-path <path>", "Folder to evaluate in and publish the --explain trace into (default: your personal workspace)").option("--folder-key <key>", "Key (GUID) of the folder to evaluate in and publish the --explain trace into").option("--timeout <seconds>", "Maximum seconds to wait for the rules engine to evaluate (default: 120)", (value) => parseBoundedInt(value, "--timeout", { min: 1, max: 3600 })).option("--login-validity <minutes>", "Minimum minutes before token expiration to trigger a refresh (default: 10)", (value) => Number.parseInt(value, 10), 10).examples(RULES_DEBUG_EXAMPLES).trackedAction(processContext, async (projectPath, options) => {
106
- const { reportRulesFailure } = await import("./rules-command-error-20gp2dv9.js");
107
- const { debugRuleProjectAsync } = await import("./rules-debug-service-qd3aqcg1.js");
96
+ program.command("debug").description("Upload the rules project's solution to Studio Web and evaluate it once through the rules engine. Returns the decision outputs and errors, and the trace id that shows which rules fired.").argument("<project-path>", "Path to the business rules project directory (must contain project.uiproj)").option("-i, --inputs <json>", "Input values as a JSON object or @file.json").option("--folder-path <path>", "Folder to evaluate in and record the run's trace under (default: your personal workspace)").option("--folder-key <key>", "Key (GUID) of the folder to evaluate in and record the run's trace under").option("--timeout <seconds>", "Maximum seconds to wait for the rules engine to evaluate (default: 120)", (value) => parseBoundedInt(value, "--timeout", { min: 1, max: 3600 })).option("--login-validity <minutes>", "Minimum minutes before token expiration to trigger a refresh (default: 10)", (value) => Number.parseInt(value, 10), 10).examples(RULES_DEBUG_EXAMPLES).trackedAction(processContext, async (projectPath, options) => {
97
+ const { reportRulesFailure } = await import("./rules-command-error-k6kxwfn7.js");
98
+ const { debugRuleProjectAsync } = await import("./rules-debug-service-86e47tv4.js");
108
99
  const [error, result] = await catchError(debugRuleProjectAsync(projectPath, options));
109
100
  if (error) {
110
101
  await reportRulesFailure("Failed to debug business rules project", error);
111
102
  return;
112
103
  }
113
- if (result.response.stats.failed > 0) {
104
+ const errors = evaluationErrors(result);
105
+ if (errors.length > 0) {
114
106
  OutputFormatter.error({
115
107
  Result: RESULTS.Failure,
116
108
  Code: "RulesDebug",
117
109
  ErrorCode: "invalid_argument",
118
- Message: failedEvaluationMessage(result),
119
- Instructions: `Check the input values against the rule's inputs; Data.results holds the engine's errors. ${traceHint(result, options.explain === true) ?? "Run with --explain to see which rules fired."}`,
110
+ Message: failedEvaluationMessage(errors),
111
+ Instructions: [
112
+ "Check the input values against the rule's inputs; Data.result holds the engine's errors.",
113
+ result.response.result?.decisions?.length ? traceHint(result) : undefined
114
+ ].filter(Boolean).join(" "),
120
115
  Retry: "RetryWillNotFix",
121
116
  Data: formatDebugResult(result)
122
117
  });
@@ -127,7 +122,7 @@ var registerDebugCommand = (program) => {
127
122
  Result: RESULTS.Success,
128
123
  Code: "RulesDebug",
129
124
  Data: formatDebugResult(result),
130
- ...successInstructions(result, options.explain === true)
125
+ ...successInstructions(result)
131
126
  }, { preserveDataKeys: true });
132
127
  });
133
128
  };
@@ -138,27 +133,29 @@ function formatDebugResult(result) {
138
133
  projectId: result.projectId,
139
134
  studioWebUrl: result.studioWebUrl,
140
135
  fileName: response.fileName,
141
- stats: response.stats,
142
- results: response.results,
136
+ result: response.result,
137
+ ...response.error ? { error: response.error } : {},
143
138
  ...response.traceId ? { traceId: response.traceId } : {}
144
139
  };
145
140
  }
146
- function failedEvaluationMessage(result) {
147
- const [firstError] = result.response.results.flatMap((input) => [
148
- ...input.errors ?? [],
149
- ...(input.decisions ?? []).flatMap((decision) => decision.error ? [decision.error] : [])
150
- ]);
141
+ function evaluationErrors(result) {
142
+ const outcome = result.response.result;
143
+ return [
144
+ ...outcome?.errors ?? [],
145
+ ...(outcome?.decisions ?? []).flatMap((decision) => decision.error ? [decision.error] : []),
146
+ ...result.response.error ? [result.response.error] : []
147
+ ];
148
+ }
149
+ function failedEvaluationMessage(errors) {
150
+ const firstError = errors.find((error) => error.message);
151
151
  return firstError?.message ? `The rules engine failed to evaluate the input: ${firstError.message}` : "The rules engine failed to evaluate the input.";
152
152
  }
153
- function successInstructions(result, explain) {
154
- const hint = traceHint(result, explain);
153
+ function successInstructions(result) {
154
+ const hint = traceHint(result);
155
155
  return hint ? { Instructions: hint } : {};
156
156
  }
157
- function traceHint(result, explain) {
158
- if (!explain) {
159
- return;
160
- }
161
- return result.response.traceId ? `Run 'uip traces spans get ${result.response.traceId}' to see which rules fired.` : "The rules engine recorded no trace for this run.";
157
+ function traceHint(result) {
158
+ return result.response.traceId ? `Run 'uip traces spans get ${result.response.traceId}' to see which rules fired.` : undefined;
162
159
  }
163
160
 
164
161
  // src/commands/folder-options.ts
@@ -194,15 +191,15 @@ var RULES_DESCRIBE_EXAMPLES = [
194
191
  var registerDescribeCommand = (program) => {
195
192
  const command = program.command("describe").description("(Preview) Get the entry points of a deployed business rule's active version, with their input and output argument schemas. Use them to map arguments when binding the rule. Same row shape as 'uip or packages entry-points'.").argument("<rule-name>", "Business rule name");
196
193
  addUnsupportedTenantOption(addFolderOptions(command)).examples(RULES_DESCRIBE_EXAMPLES).trackedAction(processContext, async (name, options) => {
197
- const rules = await import("./business-rules-bnr581tz.js");
198
- const { reportRulesFailure, RulesCommandError } = await import("./rules-command-error-20gp2dv9.js");
194
+ const rules = await import("./business-rules-pm96sefm.js");
195
+ const { reportRulesFailure, RulesCommandError } = await import("./rules-command-error-k6kxwfn7.js");
199
196
  if (options.tenant !== undefined) {
200
197
  await reportRulesFailure("Failed to describe business rule", new RulesCommandError("'uip rules describe' does not support --tenant: it reads the rule from the resource catalog of the tenant you are logged in to.", "invalid_argument", "Run 'uip login tenant set <tenant-name>' to switch tenants, then run the command again."));
201
198
  return;
202
199
  }
203
200
  const [error, entryPoints] = await catchError((async () => {
204
201
  const folder = await rules.resolveRequiredFolder(options);
205
- const { describeRuleAsync } = await import("./rule-catalog-5gzpe93c.js");
202
+ const { describeRuleAsync } = await import("./rule-catalog-10fhgevc.js");
206
203
  return describeRuleAsync(name, folder);
207
204
  })());
208
205
  if (error) {
@@ -241,8 +238,8 @@ var RULES_GET_EXAMPLES = [
241
238
  var registerGetCommand = (program) => {
242
239
  const command = program.command("get").description("(Preview) Get a deployed business rule by name. Use 'rules versions' for its version history and 'rules describe' for its argument contract.").argument("<rule-name>", "Business rule name");
243
240
  addTenantOption(addFolderOptions(command)).examples(RULES_GET_EXAMPLES).trackedAction(processContext, async (name, options) => {
244
- const rules = await import("./business-rules-bnr581tz.js");
245
- const { reportRulesFailure } = await import("./rules-command-error-20gp2dv9.js");
241
+ const rules = await import("./business-rules-pm96sefm.js");
242
+ const { reportRulesFailure } = await import("./rules-command-error-k6kxwfn7.js");
246
243
  const [error, found] = await catchError((async () => {
247
244
  const folder = await rules.resolveRequiredFolder(options);
248
245
  const api = await rules.createRulesApi(options.tenant, folder);
@@ -295,7 +292,7 @@ Packing or uploading the solution will sync solution resources automatically.`
295
292
  ];
296
293
  var registerInitCommand = (program) => {
297
294
  program.command("init").description("Create a new business rules project seeded with one decision table. If run outside an existing solution, a parent '<name>Solution' is scaffolded automatically and the rules project is created inside it. If run inside an existing solution, the project is added to that solution.").argument("<name>", "Business rules project name").option("--force", "Force initialization even if target directory exists and is not empty").option("--skip-solution-registration", "Do not auto-register this project in the surrounding solution").examples(RULES_INIT_EXAMPLES).trackedAction(processContext, async (name, options) => {
298
- const { rulesInitAsync } = await import("./rules-init-service-xsh7mx96.js");
295
+ const { rulesInitAsync } = await import("./rules-init-service-3z07e0v8.js");
299
296
  const [error, result] = await catchError(rulesInitAsync(name, {
300
297
  force: options.force,
301
298
  skipRegistration: options.skipSolutionRegistration === true
@@ -350,13 +347,29 @@ var RULES_LIST_EXAMPLES = [
350
347
  }
351
348
  ]
352
349
  }
350
+ },
351
+ {
352
+ Description: "List the business rules in every folder you can see, one row per folder a rule is shared to",
353
+ Command: "uip rules list --all-folders",
354
+ Output: {
355
+ Code: "RulesList",
356
+ Data: [
357
+ {
358
+ Key: "3f1c2a9e-8b4d-4e2a-9c1f-6d7e8f9a0b1c",
359
+ Name: "LoanEligibility",
360
+ FolderPath: "Shared",
361
+ FolderKey: "9b2d4f6a-1c3e-4a5b-8d7f-0e1a2b3c4d5e",
362
+ Description: "Decides loan eligibility"
363
+ }
364
+ ]
365
+ }
353
366
  }
354
367
  ];
355
368
  var registerListCommand = (program) => {
356
- const command = program.command("list").description("(Preview) List business rules deployed to Orchestrator in a folder. Returns key, name, folder, description and current version.");
357
- addTenantOption(addFolderOptions(command)).option("-l, --limit <number>", "Number of items to return", parseLimit, DEFAULT_PAGE_SIZE).option("--offset <number>", "Number of items to skip", parseOffset, 0).examples(RULES_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
358
- const { reportRulesFailure } = await import("./rules-command-error-20gp2dv9.js");
359
- const [error, rows] = await catchError(listRules(options));
369
+ const command = program.command("list").description("(Preview) List business rules deployed to Orchestrator in a folder, or across all accessible folders with --all-folders. Returns key, name, folder, description and, for one folder, current version. --all-folders returns one row per folder a rule is shared to.");
370
+ addTenantOption(addFolderOptions(command)).option("--all-folders", "List business rules across all accessible folders").option("-l, --limit <number>", "Number of items to return", parseLimit, DEFAULT_PAGE_SIZE).option("--offset <number>", "Number of items to skip", parseOffset, 0).examples(RULES_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
371
+ const { reportRulesFailure } = await import("./rules-command-error-k6kxwfn7.js");
372
+ const [error, result] = await catchError(listRules(options));
360
373
  if (error) {
361
374
  await reportRulesFailure("Failed to list business rules", error);
362
375
  return;
@@ -365,23 +378,50 @@ var registerListCommand = (program) => {
365
378
  Result: RESULTS.Success,
366
379
  Code: "RulesList",
367
380
  Pagination: new Pagination({
368
- returned: rows.length,
381
+ returned: result.rows.length,
369
382
  limit: options.limit,
370
- offset: options.offset
383
+ offset: options.offset,
384
+ hasMore: result.hasMore
371
385
  }),
372
- Data: rows
386
+ Data: result.rows
373
387
  });
374
388
  });
375
389
  };
376
390
  async function listRules(options) {
377
- const rules = await import("./business-rules-bnr581tz.js");
391
+ const rules = await import("./business-rules-pm96sefm.js");
392
+ const { RulesCommandError } = await import("./rules-command-error-k6kxwfn7.js");
393
+ const hasFolderSelector = options.folderPath !== undefined || options.folderKey !== undefined;
394
+ if (options.allFolders && hasFolderSelector) {
395
+ throw new RulesCommandError("Option --all-folders cannot be used with --folder-path or --folder-key.", "invalid_argument", "Use --all-folders by itself, or provide a single folder selector with --folder-path or --folder-key.");
396
+ }
397
+ if (options.allFolders) {
398
+ return listRulesAcrossFolders(options);
399
+ }
400
+ if (!hasFolderSelector) {
401
+ throw new RulesCommandError("Missing required option --folder-path, --folder-key or --all-folders.", "invalid_argument", "Provide --folder-path <path> or --folder-key <key> to list one folder, or --all-folders to list every folder. Run 'uip or folders list' to find folder paths.");
402
+ }
378
403
  const folder = await rules.resolveRequiredFolder(options);
379
404
  const api = await rules.createRulesApi(options.tenant, folder);
380
405
  const page = await api.businessRulesGet({
381
406
  $top: options.limit,
382
407
  $skip: options.offset
383
408
  });
384
- return (page.value ?? []).map((rule) => rules.formatRule(rule, folder));
409
+ return {
410
+ rows: (page.value ?? []).map((rule) => rules.formatRule(rule, folder)),
411
+ hasMore: undefined
412
+ };
413
+ }
414
+ async function listRulesAcrossFolders(options) {
415
+ const { RulesCommandError } = await import("./rules-command-error-k6kxwfn7.js");
416
+ if (options.tenant !== undefined) {
417
+ throw new RulesCommandError("'uip rules list --all-folders' does not support --tenant: it lists rules from the resource catalog of the tenant you are logged in to.", "invalid_argument", "Drop --all-folders and pass --folder-path <path> or --folder-key <key> to list one folder in that tenant, or run 'uip login tenant set <tenant-name>' to switch tenants.");
418
+ }
419
+ const { listRulesAcrossFoldersAsync } = await import("./rule-catalog-10fhgevc.js");
420
+ const result = await listRulesAcrossFoldersAsync(options.limit, options.offset);
421
+ if (!result) {
422
+ throw new RulesCommandError("Listing business rules across folders needs the Node CLI: the browser build cannot read the resource catalog.", "configuration_error", "Drop --all-folders and pass --folder-path <path> or --folder-key <key> to list one folder.");
423
+ }
424
+ return result;
385
425
  }
386
426
 
387
427
  // src/commands/refresh.ts
@@ -403,8 +443,8 @@ var RULES_REFRESH_EXAMPLES = [
403
443
  ];
404
444
  var registerRefreshCommand = (program) => {
405
445
  program.command("refresh").description("Regenerate entry-points.json and bindings_v2.json from the rules project's .dmn, keeping each published entry point's uniqueId. Run it after editing a .dmn outside Studio Web, before 'uip solution pack'.").argument("<project-path>", "Path to the business rules project directory (must contain project.uiproj)").examples(RULES_REFRESH_EXAMPLES).trackedAction(processContext, async (projectPath) => {
406
- const { reportRulesFailure } = await import("./rules-command-error-20gp2dv9.js");
407
- const { refreshRuleProjectAsync } = await import("./rules-refresh-service-jgk2kq9d.js");
446
+ const { reportRulesFailure } = await import("./rules-command-error-k6kxwfn7.js");
447
+ const { refreshRuleProjectAsync } = await import("./rules-refresh-service-jn6my893.js");
408
448
  const [error, result] = await catchError(refreshRuleProjectAsync(projectPath));
409
449
  if (error) {
410
450
  await reportRulesFailure("Failed to refresh business rules package files", error);
@@ -442,8 +482,8 @@ var RULES_VALIDATE_EXAMPLES = [
442
482
  ];
443
483
  var registerValidateCommand = (program) => {
444
484
  program.command("validate").description("Check a rules project for what Studio Web blocks publish and debug on, the designer's diagnostics for each .dmn, and for an entry-points.json out of step with the .dmn. Errors exit 1; warnings are reported only.").argument("<project-path>", "Path to the business rules project directory (must contain project.uiproj)").examples(RULES_VALIDATE_EXAMPLES).trackedAction(processContext, async (projectPath) => {
445
- const { reportRulesFailure } = await import("./rules-command-error-20gp2dv9.js");
446
- const { validateRuleProjectAsync } = await import("./rules-validate-service-mr2fk58k.js");
485
+ const { reportRulesFailure } = await import("./rules-command-error-k6kxwfn7.js");
486
+ const { validateRuleProjectAsync } = await import("./rules-validate-service-hfw8m3dm.js");
447
487
  const [error, result] = await catchError(validateRuleProjectAsync(projectPath));
448
488
  if (error) {
449
489
  await reportRulesFailure("Failed to validate business rules project", error);
@@ -518,8 +558,8 @@ var RULES_VERSIONS_EXAMPLES = [
518
558
  var registerVersionsCommand = (program) => {
519
559
  const command = program.command("versions").description("(Preview) List the versions of a deployed business rule. The active version is the one consumers evaluate.").argument("<rule-name>", "Business rule name");
520
560
  addTenantOption(addFolderOptions(command)).option("-l, --limit <number>", "Number of versions to return", parseLimit, DEFAULT_PAGE_SIZE).option("--offset <number>", "Number of versions to skip", parseOffset, 0).examples(RULES_VERSIONS_EXAMPLES).trackedAction(processContext, async (name, options) => {
521
- const rules = await import("./business-rules-bnr581tz.js");
522
- const { reportRulesFailure } = await import("./rules-command-error-20gp2dv9.js");
561
+ const rules = await import("./business-rules-pm96sefm.js");
562
+ const { reportRulesFailure } = await import("./rules-command-error-k6kxwfn7.js");
523
563
  const [error, page] = await catchError((async () => {
524
564
  const folder = await rules.resolveRequiredFolder(options);
525
565
  const api = await rules.createRulesApi(options.tenant, folder);
@@ -571,4 +611,4 @@ var registerCommands = async (program) => {
571
611
 
572
612
  export { metadata, registerCommands };
573
613
 
574
- //# debugId=E7F12C26C09D106B64756E2164756E21
614
+ //# debugId=910B5A6972EDBD3164756E2164756E21