@uipath/pm-tool 1.198.0 → 1.199.0-preview.104

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 (2) hide show
  1. package/dist/tool.js +252 -9
  2. package/package.json +2 -2
package/dist/tool.js CHANGED
@@ -21230,7 +21230,7 @@ var init_server = __esm(() => {
21230
21230
  var package_default = {
21231
21231
  name: "@uipath/pm-tool",
21232
21232
  license: "MIT",
21233
- version: "1.198.0",
21233
+ version: "1.199.0-preview.104",
21234
21234
  description: "Process Mining — process apps, transformations, and data ingestion.",
21235
21235
  private: false,
21236
21236
  repository: {
@@ -28087,6 +28087,7 @@ var SKILL_ATTRIBUTION = attributionRecord([
28087
28087
  var KNOWN_SKILL_NAMES = new Set(Object.keys(SKILL_ATTRIBUTION));
28088
28088
  var COMMAND_ATTRIBUTION = commandAttribution([
28089
28089
  ["cli", "troubleshoot", ["uip.feedback"]],
28090
+ ["llm-gateway", "operate", ["uip.llm-gateway"]],
28090
28091
  ["llm-gateway", "operate", ["uip.llm-configuration", "uip.model-hub"]],
28091
28092
  ["context-grounding", "build", ["uip.context-grounding"]],
28092
28093
  ["api-workflow", "build", ["uip.api-workflow"]],
@@ -28310,6 +28311,20 @@ Command.prototype.trackedAction = function(context, fn, properties) {
28310
28311
  telemetry.trackRequestResult(telemetryName, durationMs, success, baseProperties, requestContext);
28311
28312
  });
28312
28313
  };
28314
+
28315
+ // ../common/src/confirmation.ts
28316
+ function requireConfirmation(flags, operation) {
28317
+ if (flags.yes === true || flags.force === true) {
28318
+ return true;
28319
+ }
28320
+ OutputFormatter.error({
28321
+ Result: RESULTS.Failure,
28322
+ Message: `Confirmation required: this will ${operation} and cannot be undone.`,
28323
+ Instructions: "Re-run with --yes to confirm."
28324
+ });
28325
+ processContext.exit(1);
28326
+ return false;
28327
+ }
28313
28328
  // ../common/src/console-guard.ts
28314
28329
  var guardInstalledSlot = singleton("ConsoleGuardInstalled");
28315
28330
  var savedOriginalsSlot = singleton("ConsoleGuardOriginals");
@@ -28433,6 +28448,7 @@ var resolveConfigAsync = async ({
28433
28448
  customAuthority,
28434
28449
  customClientId,
28435
28450
  customClientSecret,
28451
+ customClientAssertion,
28436
28452
  customScopes
28437
28453
  } = {}) => {
28438
28454
  const fileAuth = getAuthFileConfig();
@@ -28458,7 +28474,7 @@ var resolveConfigAsync = async ({
28458
28474
  if (!clientSecret && fileAuth.clientSecret) {
28459
28475
  clientSecret = fileAuth.clientSecret;
28460
28476
  }
28461
- const isExternalAppAuth = clientId !== DEFAULT_CLIENT_ID && Boolean(clientSecret);
28477
+ const isExternalAppAuth = clientId !== DEFAULT_CLIENT_ID && (Boolean(clientSecret) || Boolean(customClientAssertion));
28462
28478
  const scopes = resolveScopes(isExternalAppAuth, customScopes, fileAuth.scopes);
28463
28479
  return {
28464
28480
  clientId,
@@ -29576,7 +29592,6 @@ var getAuthContext = async (options = {}) => {
29576
29592
  tenantName
29577
29593
  };
29578
29594
  };
29579
-
29580
29595
  // ../auth/src/index.ts
29581
29596
  init_constants();
29582
29597
 
@@ -29651,6 +29666,9 @@ async function pmGet(config, path3) {
29651
29666
  async function pmPost(config, path3, body) {
29652
29667
  return pmRequest(config, "POST", path3, body);
29653
29668
  }
29669
+ async function pmDelete(config, path3) {
29670
+ return pmRequest(config, "DELETE", path3);
29671
+ }
29654
29672
  async function pmGetRaw(config, path3) {
29655
29673
  const response = await fetch(buildPmUrl(config, path3), {
29656
29674
  method: "GET",
@@ -29685,6 +29703,7 @@ async function pmPutRaw(config, path3, content, etag) {
29685
29703
  }
29686
29704
 
29687
29705
  // src/commands/_shared.ts
29706
+ init_src();
29688
29707
  function fail(message, instructions) {
29689
29708
  OutputFormatter.error({
29690
29709
  Result: RESULTS.Failure,
@@ -29713,6 +29732,31 @@ function unwrapData(payload) {
29713
29732
  }
29714
29733
  return payload;
29715
29734
  }
29735
+ async function resolveJsonBody(file, inline, flag = "body") {
29736
+ const noun = flag === "filters" ? "filter spec" : "request body";
29737
+ const Noun = flag === "filters" ? "Filter spec" : "Request body";
29738
+ const Label = flag === "filters" ? "Filters" : "Body";
29739
+ if (file !== undefined && inline !== undefined) {
29740
+ throw new Error(`Provide only one of --${flag} or --${flag}-json, not both.`);
29741
+ }
29742
+ let raw;
29743
+ if (file !== undefined) {
29744
+ const content = await getFileSystem().readFile(file, "utf-8");
29745
+ if (content === null) {
29746
+ throw new Error(`${Label} file not found: ${file}`);
29747
+ }
29748
+ raw = String(content);
29749
+ } else if (inline !== undefined) {
29750
+ raw = inline;
29751
+ } else {
29752
+ throw new Error(`A ${noun} is required: pass --${flag} <json-file> or --${flag}-json <json>.`);
29753
+ }
29754
+ const [parseErr, parsed] = catchError(() => JSON.parse(raw));
29755
+ if (parseErr) {
29756
+ throw new Error(`${Noun} is not valid JSON: ${parseErr.message}`);
29757
+ }
29758
+ return parsed;
29759
+ }
29716
29760
 
29717
29761
  // src/commands/app-types.ts
29718
29762
  var APP_TYPES_LIST_EXAMPLES = [
@@ -29787,6 +29831,16 @@ var APPS_CREATE_EXAMPLES = [
29787
29831
  }
29788
29832
  }
29789
29833
  ];
29834
+ var APPS_DELETE_EXAMPLES = [
29835
+ {
29836
+ Description: "Delete a process app by id",
29837
+ Command: "uip pm apps delete 9c46289e --yes",
29838
+ Output: {
29839
+ Code: "PmAppsDelete",
29840
+ Data: { AppId: "9c46289e", Status: "Deleted" }
29841
+ }
29842
+ }
29843
+ ];
29790
29844
  function registerAppsCommand(program2) {
29791
29845
  const appsCmd = program2.command("apps").description("Manage Process Mining process apps");
29792
29846
  appsCmd.command("list").description("List process apps").addOption(new Option("--stage <stage>", "App stage to list").choices(STAGES).default("dev")).examples(APPS_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
@@ -29819,6 +29873,23 @@ function registerAppsCommand(program2) {
29819
29873
  Data: { AppId: appId, Name: name, Type: options.type }
29820
29874
  });
29821
29875
  });
29876
+ appsCmd.command("delete <app-id>").description("Delete a process app").option("-y, --yes", "Confirm this irreversible operation (required; the CLI never prompts)").examples(APPS_DELETE_EXAMPLES).trackedAction(processContext, async (appId, options) => {
29877
+ if (!requireConfirmation(options, `delete process app '${appId}'`))
29878
+ return;
29879
+ const config = await loadConfigOrExit();
29880
+ if (!config)
29881
+ return;
29882
+ const [err] = await catchError(pmDelete(config, `/apps/${appId}`));
29883
+ if (err) {
29884
+ fail(err.message, "Check the app id (uip pm apps list).");
29885
+ return;
29886
+ }
29887
+ OutputFormatter.success({
29888
+ Result: "Success",
29889
+ Code: "PmAppsDelete",
29890
+ Data: { AppId: appId, Status: "Deleted" }
29891
+ });
29892
+ });
29822
29893
  }
29823
29894
  async function createApp(config, name, options) {
29824
29895
  let version = options.typeVersion;
@@ -30032,9 +30103,180 @@ function registerIngestionsCommand(program2) {
30032
30103
  });
30033
30104
  }
30034
30105
 
30106
+ // src/commands/query.ts
30107
+ var STAGES4 = ["dev", "published"];
30108
+ var LAYOUT_TYPES = ["graph", "process-model"];
30109
+ var QUERY_RUN_EXAMPLES = [
30110
+ {
30111
+ Description: "Run an aggregate query from a JSON body (group-by + metrics)",
30112
+ Command: "uip pm query run 9c46289e --body ./query.json",
30113
+ Output: {
30114
+ Code: "PmQueryRun",
30115
+ Data: {
30116
+ Number_of_cases: { Ungrouped: 1043 }
30117
+ }
30118
+ }
30119
+ }
30120
+ ];
30121
+ var QUERY_RCA_EXAMPLES = [
30122
+ {
30123
+ Description: "Root-cause analysis: which attributes explain the selected set",
30124
+ Command: `uip pm query rca 9c46289e --body-json '{"argument":"Case_ID","exploreAttributes":["Case_type"],"selectedSet":[[{"kind":"values","dimension":"Case_status","type":"string","values":["Open"],"invert":false,"displayType":"list"}]]}'`,
30125
+ Output: {
30126
+ Code: "PmQueryRca",
30127
+ Data: { Data: {}, Warnings: null }
30128
+ }
30129
+ }
30130
+ ];
30131
+ var QUERY_INFO_EXAMPLES = [
30132
+ {
30133
+ Description: "Discover the fields, metrics and processes available for query bodies",
30134
+ Command: "uip pm query info 9c46289e",
30135
+ Output: {
30136
+ Code: "PmQueryInfo",
30137
+ Data: { fields: [], processes: [] }
30138
+ }
30139
+ }
30140
+ ];
30141
+ var QUERY_PERCENTILE_EXAMPLES = [
30142
+ {
30143
+ Description: "Compute the 50th/90th/95th percentiles of case throughput time",
30144
+ Command: "uip pm query percentile 9c46289e --field PF__throughput_time --values 0.5,0.9,0.95",
30145
+ Output: {
30146
+ Code: "PmQueryPercentile",
30147
+ Data: { values: [3600, 86400, 172800] }
30148
+ }
30149
+ }
30150
+ ];
30151
+ function registerQueryCommand(program2) {
30152
+ const queryCmd = program2.command("query").description("Query a process app: aggregate data, details, RCA, insights, " + "percentiles, layout and query metadata");
30153
+ registerBodyQuery(queryCmd, {
30154
+ name: "run",
30155
+ subpath: "",
30156
+ code: "PmQueryRun",
30157
+ summary: "Run an aggregate (group-by + metrics) data query",
30158
+ examples: QUERY_RUN_EXAMPLES,
30159
+ withLimit: true
30160
+ });
30161
+ registerBodyQuery(queryCmd, {
30162
+ name: "details",
30163
+ subpath: "/details",
30164
+ code: "PmQueryDetails",
30165
+ summary: "Run a details (raw table rows) data query",
30166
+ withLimit: true
30167
+ });
30168
+ registerBodyQuery(queryCmd, {
30169
+ name: "rca",
30170
+ subpath: "/rca",
30171
+ code: "PmQueryRca",
30172
+ summary: "Run a root-cause analysis query (body needs a non-empty 'selectedSet')",
30173
+ examples: QUERY_RCA_EXAMPLES,
30174
+ withLimit: true
30175
+ });
30176
+ registerBodyQuery(queryCmd, {
30177
+ name: "insights",
30178
+ subpath: "/processInsights",
30179
+ code: "PmQueryInsights",
30180
+ summary: "Run process insights (body needs 'processId' and 1..10 'metrics')",
30181
+ withLimit: true
30182
+ });
30183
+ queryCmd.command("info <app-id>").description("Get query metadata: the fields, metrics and processes available to build query bodies").addOption(new Option("--stage <stage>", "App stage").choices(STAGES4).default("dev")).examples(QUERY_INFO_EXAMPLES).trackedAction(processContext, async (appId, options) => {
30184
+ const config = await loadConfigOrExit();
30185
+ if (!config)
30186
+ return;
30187
+ const [err, result] = await catchError(pmGet(config, `/query/${appId}/${options.stage}/info`));
30188
+ if (err) {
30189
+ fail(err.message, "Check the app id (uip pm apps list) and that the stage has a completed ingestion.");
30190
+ return;
30191
+ }
30192
+ OutputFormatter.success({
30193
+ Result: "Success",
30194
+ Code: "PmQueryInfo",
30195
+ Data: result
30196
+ });
30197
+ });
30198
+ queryCmd.command("layout <app-id>").description("Get the persisted global graph layout of a process app").addOption(new Option("--type <type>", "Layout to read: the process 'graph' or the 'process-model'").choices(LAYOUT_TYPES).default("graph")).addOption(new Option("--stage <stage>", "App stage").choices(STAGES4).default("dev")).trackedAction(processContext, async (appId, options) => {
30199
+ const config = await loadConfigOrExit();
30200
+ if (!config)
30201
+ return;
30202
+ const endpoint = options.type === "process-model" ? "processModelGlobalLayout" : "graphLayout";
30203
+ const [err, result] = await catchError(pmGet(config, `/query/${appId}/${options.stage}/${endpoint}`));
30204
+ if (err) {
30205
+ fail(err.message, "Check the app id (uip pm apps list) and that the stage has a completed ingestion.");
30206
+ return;
30207
+ }
30208
+ OutputFormatter.success({
30209
+ Result: "Success",
30210
+ Code: "PmQueryLayout",
30211
+ Data: result
30212
+ });
30213
+ });
30214
+ queryCmd.command("percentile <app-id>").description("Compute percentiles of a numeric field").requiredOption("--field <field-id>", "Field id to compute percentiles over (uip pm query info)").requiredOption("--values <list>", "Comma-separated percentile points in 0..1, e.g. '0.5,0.9,0.95'").option("--filters <json-file>", "Path to a JSON file with a filter spec (array of AND-ed filter groups)").option("--filters-json <json>", "Inline JSON filter spec").addOption(new Option("--stage <stage>", "App stage").choices(STAGES4).default("dev")).examples(QUERY_PERCENTILE_EXAMPLES).trackedAction(processContext, async (appId, options) => {
30215
+ const config = await loadConfigOrExit();
30216
+ if (!config)
30217
+ return;
30218
+ const [buildErr, body] = await catchError(buildPercentileBody(options));
30219
+ if (buildErr) {
30220
+ fail(buildErr.message, "Pass --values as comma-separated numbers in 0..1 and a valid --filters/--filters-json spec.");
30221
+ return;
30222
+ }
30223
+ const [err, result] = await catchError(pmPost(config, `/query/${appId}/${options.stage}/percentile`, body));
30224
+ if (err) {
30225
+ fail(err.message, "Check the app id, the field id (uip pm query info) and that the stage has a completed ingestion.");
30226
+ return;
30227
+ }
30228
+ OutputFormatter.success({
30229
+ Result: "Success",
30230
+ Code: "PmQueryPercentile",
30231
+ Data: result
30232
+ });
30233
+ });
30234
+ }
30235
+ function registerBodyQuery(queryCmd, spec) {
30236
+ const cmd = queryCmd.command(`${spec.name} <app-id>`).description(spec.summary).option("--body <json-file>", "Path to a JSON file with the request body").option("--body-json <json>", "Inline JSON request body").addOption(new Option("--stage <stage>", "App stage").choices(STAGES4).default("dev"));
30237
+ if (spec.withLimit) {
30238
+ cmd.option("--limit <n>", "Max rows to return (server clamps to 1..1000)");
30239
+ }
30240
+ if (spec.examples) {
30241
+ cmd.examples(spec.examples);
30242
+ }
30243
+ cmd.trackedAction(processContext, async (appId, options) => {
30244
+ const config = await loadConfigOrExit();
30245
+ if (!config)
30246
+ return;
30247
+ const [bodyErr, body] = await catchError(resolveJsonBody(options.body, options.bodyJson));
30248
+ if (bodyErr) {
30249
+ fail(bodyErr.message, "Pass the request body with --body <json-file> or --body-json <json>. Use 'uip pm query info' to discover field/metric ids.");
30250
+ return;
30251
+ }
30252
+ const query = options.limit === undefined ? "" : `?limit=${encodeURIComponent(options.limit)}`;
30253
+ const [apiErr, result] = await catchError(pmPost(config, `/query/${appId}/${options.stage}${spec.subpath}${query}`, body));
30254
+ if (apiErr) {
30255
+ fail(apiErr.message, "Check the app id (uip pm apps list), that the stage has a completed ingestion, and the request body shape.");
30256
+ return;
30257
+ }
30258
+ OutputFormatter.success({
30259
+ Result: "Success",
30260
+ Code: spec.code,
30261
+ Data: result
30262
+ });
30263
+ });
30264
+ }
30265
+ async function buildPercentileBody(options) {
30266
+ const values = options.values.split(",").map((s) => s.trim()).filter((s) => s.length > 0).map(Number);
30267
+ if (values.length === 0 || values.some((v) => !Number.isFinite(v))) {
30268
+ throw new Error(`Invalid --values '${options.values}': expected comma-separated numbers.`);
30269
+ }
30270
+ let filters = [];
30271
+ if (options.filters !== undefined || options.filtersJson !== undefined) {
30272
+ filters = await resolveJsonBody(options.filters, options.filtersJson, "filters");
30273
+ }
30274
+ return { field: options.field, values, filters };
30275
+ }
30276
+
30035
30277
  // src/commands/transformations.ts
30036
30278
  init_src();
30037
- var STAGES4 = ["dev", "published"];
30279
+ var STAGES5 = ["dev", "published"];
30038
30280
  var TRANSFORMATIONS_RUN_EXAMPLES = [
30039
30281
  {
30040
30282
  Description: "Rebuild a single dbt model and its dependents on dev",
@@ -30057,7 +30299,7 @@ var TRANSFORMATIONS_APPLY_EXAMPLES = [
30057
30299
  ];
30058
30300
  function registerTransformationsCommand(program2) {
30059
30301
  const transformationsCmd = program2.command("transformations").description("Work with the dbt SQL transformations of a process app");
30060
- transformationsCmd.command("list <app-id>").description("List the transformation files of a process app").addOption(new Option("--stage <stage>", "App stage to read from").choices(STAGES4).default("dev")).trackedAction(processContext, async (appId, options) => {
30302
+ transformationsCmd.command("list <app-id>").description("List the transformation files of a process app").addOption(new Option("--stage <stage>", "App stage to read from").choices(STAGES5).default("dev")).trackedAction(processContext, async (appId, options) => {
30061
30303
  const config = await loadConfigOrExit();
30062
30304
  if (!config)
30063
30305
  return;
@@ -30072,7 +30314,7 @@ function registerTransformationsCommand(program2) {
30072
30314
  Data: result
30073
30315
  });
30074
30316
  });
30075
- transformationsCmd.command("get <app-id> <path>").description("Get the content of a transformation file").addOption(new Option("--stage <stage>", "App stage").choices(STAGES4).default("dev")).option("--destination <local-file>", "Write content to this local file instead of the output envelope").trackedAction(processContext, async (appId, path3, options) => {
30317
+ transformationsCmd.command("get <app-id> <path>").description("Get the content of a transformation file").addOption(new Option("--stage <stage>", "App stage").choices(STAGES5).default("dev")).option("--destination <local-file>", "Write content to this local file instead of the output envelope").trackedAction(processContext, async (appId, path3, options) => {
30076
30318
  const config = await loadConfigOrExit();
30077
30319
  if (!config)
30078
30320
  return;
@@ -30098,7 +30340,7 @@ function registerTransformationsCommand(program2) {
30098
30340
  }
30099
30341
  });
30100
30342
  });
30101
- transformationsCmd.command("update <app-id> <path>").description("Update a transformation file from a local file (ETag-safe)").requiredOption("--file <local-file>", "Local file with the new content").addOption(new Option("--stage <stage>", "App stage").choices(STAGES4).default("dev")).trackedAction(processContext, async (appId, path3, options) => {
30343
+ transformationsCmd.command("update <app-id> <path>").description("Update a transformation file from a local file (ETag-safe)").requiredOption("--file <local-file>", "Local file with the new content").addOption(new Option("--stage <stage>", "App stage").choices(STAGES5).default("dev")).trackedAction(processContext, async (appId, path3, options) => {
30102
30344
  const config = await loadConfigOrExit();
30103
30345
  if (!config)
30104
30346
  return;
@@ -30131,7 +30373,7 @@ function registerTransformationsCommand(program2) {
30131
30373
  }
30132
30374
  });
30133
30375
  });
30134
- transformationsCmd.command("apply <app-id>").description("Re-run the full data transformation on already-ingested data " + "(unlike 'run', which builds only changed dev models)").addOption(new Option("--stage <stage>", "App stage").choices(STAGES4).default("dev")).examples(TRANSFORMATIONS_APPLY_EXAMPLES).trackedAction(processContext, async (appId, options) => {
30376
+ transformationsCmd.command("apply <app-id>").description("Re-run the full data transformation on already-ingested data " + "(unlike 'run', which builds only changed dev models)").addOption(new Option("--stage <stage>", "App stage").choices(STAGES5).default("dev")).examples(TRANSFORMATIONS_APPLY_EXAMPLES).trackedAction(processContext, async (appId, options) => {
30135
30377
  const config = await loadConfigOrExit();
30136
30378
  if (!config)
30137
30379
  return;
@@ -30202,6 +30444,7 @@ var registerCommands = async (program2) => {
30202
30444
  registerAppTypesCommand(program2);
30203
30445
  registerFilesCommand(program2);
30204
30446
  registerIngestionsCommand(program2);
30447
+ registerQueryCommand(program2);
30205
30448
  registerTransformationsCommand(program2);
30206
30449
  };
30207
30450
  export {
@@ -30209,4 +30452,4 @@ export {
30209
30452
  metadata
30210
30453
  };
30211
30454
 
30212
- //# debugId=3A4CE4EA79D9034564756E2164756E21
30455
+ //# debugId=2913FEAD0FC843D764756E2164756E21
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/pm-tool",
3
3
  "license": "MIT",
4
- "version": "1.198.0",
4
+ "version": "1.199.0-preview.104",
5
5
  "description": "Process Mining — process apps, transformations, and data ingestion.",
6
6
  "private": false,
7
7
  "repository": {
@@ -26,5 +26,5 @@
26
26
  "files": [
27
27
  "dist"
28
28
  ],
29
- "gitHead": "1fadf03d7a8dd102742571dff569fdac11808afb"
29
+ "gitHead": "829a8ab8a25bce5b62c284bd1ddc674d2947f647"
30
30
  }