@uipath/integrationservice-tool 0.1.8 → 0.1.10

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 +246 -239
  2. package/package.json +9 -8
package/dist/tool.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "@uipath/integrationservice-tool",
4
- version: "0.1.8",
4
+ version: "0.1.10",
5
5
  description: "Manage Integration Service connectors, connections, and triggers.",
6
6
  private: false,
7
7
  maintainers: [
@@ -11,14 +11,14 @@ var package_default = {
11
11
  ],
12
12
  repository: {
13
13
  type: "git",
14
- url: "https://github.com/UiPath/uipcli.git",
14
+ url: "https://github.com/UiPath/cli.git",
15
15
  directory: "packages/integrationservice-tool"
16
16
  },
17
17
  publishConfig: {
18
- registry: "https://registry.npmjs.org/"
18
+ registry: "https://npm.pkg.github.com/@uipath"
19
19
  },
20
20
  keywords: [
21
- "uipcli-tool"
21
+ "cli-tool"
22
22
  ],
23
23
  type: "module",
24
24
  main: "./dist/tool.js",
@@ -32,7 +32,7 @@ var package_default = {
32
32
  "dist"
33
33
  ],
34
34
  scripts: {
35
- build: "bun build ./src/tool.ts --outdir dist --format esm --target node --external commander --external @uipath/common --external @uipath/auth && bun build ./src/index.ts --outdir dist --format esm --target node --external '*/tool.js' --external commander --external @uipath/common --external @uipath/auth",
35
+ build: "bun ../../tools/build-tool.ts",
36
36
  package: "bun run build && bun pm pack",
37
37
  lint: "biome check .",
38
38
  "lint:fix": "biome check --write .",
@@ -41,19 +41,20 @@ var package_default = {
41
41
  },
42
42
  peerDependencies: {
43
43
  commander: "^14.0.3",
44
- "@uipath/common": "^0.1.7",
45
- "@uipath/auth": "^0.1.6"
44
+ "@uipath/common": "^0.1.13",
45
+ "@uipath/auth": "^0.1.9",
46
+ "@uipath/filesystem": "^0.1.6"
46
47
  },
47
48
  devDependencies: {
48
49
  "@uipath/integrationservice-sdk": "workspace:*",
49
- "@types/node": "^25.2.3",
50
+ "@types/node": "^25.5.0",
50
51
  typescript: "^5"
51
52
  }
52
53
  };
53
54
 
54
55
  // src/commands/activities.ts
55
56
  import {
56
- catchError,
57
+ catchError as catchError2,
57
58
  logger,
58
59
  OutputFormatter,
59
60
  processContext
@@ -6406,9 +6407,13 @@ async function executeOperation(options, connectionId, objectName, httpMethod =
6406
6407
  function folderOverride(folderKey) {
6407
6408
  if (!folderKey)
6408
6409
  return;
6409
- return {
6410
- headers: { "x-uipath-folderkey": folderKey }
6411
- };
6410
+ return async ({ init }) => ({
6411
+ ...init,
6412
+ headers: {
6413
+ ...init.headers,
6414
+ "x-uipath-folderkey": folderKey
6415
+ }
6416
+ });
6412
6417
  }
6413
6418
  // ../integrationservice-sdk/src/scripts/generate-sdk.ts
6414
6419
  import { join } from "node:path";
@@ -6418,11 +6423,11 @@ var SWAGGER_DIR = join(process.cwd(), "swagger");
6418
6423
  var HTTP_METHODS = new Set(["get", "post", "put", "patch", "delete"]);
6419
6424
  if (false) {}
6420
6425
  // src/utils/metadata-cache.ts
6421
- import * as fs from "node:fs/promises";
6422
- import * as os from "node:os";
6423
- import * as path from "node:path";
6424
- import { UIPATH_HOME_DIR } from "@uipath/common";
6425
- var CACHE_BASE = path.join(os.homedir(), UIPATH_HOME_DIR, "cache", "integrationservice");
6426
+ import { catchError, UIPATH_HOME_DIR } from "@uipath/common";
6427
+ import { getFileSystem } from "@uipath/filesystem";
6428
+ function getCacheBase() {
6429
+ return getFileSystem().path.join(getFileSystem().env.homedir(), UIPATH_HOME_DIR, "cache", "integrationservice");
6430
+ }
6426
6431
  var METHOD_TO_OPERATION = {
6427
6432
  GET: "List",
6428
6433
  GETBYID: "Retrieve",
@@ -6432,32 +6437,37 @@ var METHOD_TO_OPERATION = {
6432
6437
  PUT: "Replace"
6433
6438
  };
6434
6439
  function getConnectorDir(connectorKey) {
6435
- return path.join(CACHE_BASE, connectorKey);
6440
+ return getFileSystem().path.join(getCacheBase(), connectorKey);
6436
6441
  }
6437
6442
  function getConnectionDir(connectorKey, connectionId) {
6438
- return path.join(CACHE_BASE, connectorKey, connectionId);
6443
+ return getFileSystem().path.join(getCacheBase(), connectorKey, connectionId);
6439
6444
  }
6440
6445
  function getOperationFilePath(connectorKey, connectionId, objectName, operation) {
6441
- return path.join(getConnectionDir(connectorKey, connectionId), `${objectName}.${operation}.json`);
6446
+ return getFileSystem().path.join(getConnectionDir(connectorKey, connectionId), `${objectName}.${operation}.json`);
6442
6447
  }
6443
6448
  function isHidden(item) {
6444
6449
  return item?.design?.isHidden === true;
6445
6450
  }
6446
6451
  async function readJsonFile(filePath) {
6447
- try {
6448
- const data = await fs.readFile(filePath, "utf-8");
6449
- return JSON.parse(data);
6450
- } catch {
6452
+ const [readError, data] = await catchError(getFileSystem().readFile(filePath, "utf-8"));
6453
+ if (readError) {
6451
6454
  return null;
6452
6455
  }
6456
+ const [parseError, parsed] = catchError(() => JSON.parse(data));
6457
+ if (parseError) {
6458
+ return null;
6459
+ }
6460
+ return parsed;
6453
6461
  }
6454
6462
  async function writeJsonFile(filePath, data) {
6455
- await fs.mkdir(path.dirname(filePath), { recursive: true });
6456
- await fs.writeFile(filePath, JSON.stringify(data, null, 2), "utf-8");
6463
+ await getFileSystem().mkdir(getFileSystem().path.dirname(filePath), {
6464
+ recursive: true
6465
+ });
6466
+ await getFileSystem().writeFile(filePath, JSON.stringify(data, null, 2), "utf-8");
6457
6467
  return filePath;
6458
6468
  }
6459
6469
  async function cacheConnectors(connectors) {
6460
- const filePath = path.join(CACHE_BASE, "connectors.json");
6470
+ const filePath = getFileSystem().path.join(getCacheBase(), "connectors.json");
6461
6471
  const compact = connectors.map((c) => ({
6462
6472
  id: c.id,
6463
6473
  name: c.name,
@@ -6478,10 +6488,10 @@ async function cacheConnectors(connectors) {
6478
6488
  return writeJsonFile(filePath, compact);
6479
6489
  }
6480
6490
  async function readCachedConnectors() {
6481
- return readJsonFile(path.join(CACHE_BASE, "connectors.json"));
6491
+ return readJsonFile(getFileSystem().path.join(getCacheBase(), "connectors.json"));
6482
6492
  }
6483
6493
  async function cacheConnections(connectorKey, connections) {
6484
- const filePath = path.join(getConnectorDir(connectorKey), "connections.json");
6494
+ const filePath = getFileSystem().path.join(getConnectorDir(connectorKey), "connections.json");
6485
6495
  const compact = connections.map((conn) => ({
6486
6496
  id: conn.id,
6487
6497
  name: conn.name,
@@ -6497,10 +6507,10 @@ async function cacheConnections(connectorKey, connections) {
6497
6507
  return writeJsonFile(filePath, compact);
6498
6508
  }
6499
6509
  async function readCachedConnections(connectorKey) {
6500
- return readJsonFile(path.join(getConnectorDir(connectorKey), "connections.json"));
6510
+ return readJsonFile(getFileSystem().path.join(getConnectorDir(connectorKey), "connections.json"));
6501
6511
  }
6502
6512
  async function cacheActivities(connectorKey, activities) {
6503
- const filePath = path.join(getConnectorDir(connectorKey), "activities.json");
6513
+ const filePath = getFileSystem().path.join(getConnectorDir(connectorKey), "activities.json");
6504
6514
  const compact = activities.map((a) => ({
6505
6515
  name: a.name,
6506
6516
  displayName: a.displayName,
@@ -6514,10 +6524,10 @@ async function cacheActivities(connectorKey, activities) {
6514
6524
  return writeJsonFile(filePath, compact);
6515
6525
  }
6516
6526
  async function readCachedActivities(connectorKey) {
6517
- return readJsonFile(path.join(getConnectorDir(connectorKey), "activities.json"));
6527
+ return readJsonFile(getFileSystem().path.join(getConnectorDir(connectorKey), "activities.json"));
6518
6528
  }
6519
6529
  async function cacheResourcesList(connectorKey, connectionId, resources) {
6520
- const filePath = path.join(getConnectionDir(connectorKey, connectionId), "resources.json");
6530
+ const filePath = getFileSystem().path.join(getConnectionDir(connectorKey, connectionId), "resources.json");
6521
6531
  const compact = resources.map((r) => ({
6522
6532
  name: r.name,
6523
6533
  displayName: r.displayName,
@@ -6531,7 +6541,7 @@ async function cacheResourcesList(connectorKey, connectionId, resources) {
6531
6541
  return writeJsonFile(filePath, compact);
6532
6542
  }
6533
6543
  async function readCachedResourcesList(connectorKey, connectionId) {
6534
- return readJsonFile(path.join(getConnectionDir(connectorKey, connectionId), "resources.json"));
6544
+ return readJsonFile(getFileSystem().path.join(getConnectionDir(connectorKey, connectionId), "resources.json"));
6535
6545
  }
6536
6546
  function buildOperationFile(rawMetadata, methodKey) {
6537
6547
  const methodInfo = rawMetadata?.metadata?.method?.[methodKey];
@@ -6640,21 +6650,21 @@ async function readCachedForPathResolution(connectorKey, connectionId, objectNam
6640
6650
  };
6641
6651
  }
6642
6652
  function getTriggerDir(connectorKey, connectionId, operation) {
6643
- return path.join(getConnectionDir(connectorKey, connectionId), "triggers", operation);
6653
+ return getFileSystem().path.join(getConnectionDir(connectorKey, connectionId), "triggers", operation);
6644
6654
  }
6645
6655
  async function cacheTriggerObjects(connectorKey, connectionId, operation, objects) {
6646
- const filePath = path.join(getTriggerDir(connectorKey, connectionId, operation), "objects.json");
6656
+ const filePath = getFileSystem().path.join(getTriggerDir(connectorKey, connectionId, operation), "objects.json");
6647
6657
  return writeJsonFile(filePath, objects);
6648
6658
  }
6649
6659
  async function readCachedTriggerObjects(connectorKey, connectionId, operation) {
6650
- return readJsonFile(path.join(getTriggerDir(connectorKey, connectionId, operation), "objects.json"));
6660
+ return readJsonFile(getFileSystem().path.join(getTriggerDir(connectorKey, connectionId, operation), "objects.json"));
6651
6661
  }
6652
6662
  async function cacheTriggerMetadata(connectorKey, connectionId, operation, objectName, metadata) {
6653
- const filePath = path.join(getTriggerDir(connectorKey, connectionId, operation), `${objectName}.metadata.json`);
6663
+ const filePath = getFileSystem().path.join(getTriggerDir(connectorKey, connectionId, operation), `${objectName}.metadata.json`);
6654
6664
  return writeJsonFile(filePath, metadata);
6655
6665
  }
6656
6666
  async function readCachedTriggerMetadata(connectorKey, connectionId, operation, objectName) {
6657
- return readJsonFile(path.join(getTriggerDir(connectorKey, connectionId, operation), `${objectName}.metadata.json`));
6667
+ return readJsonFile(getFileSystem().path.join(getTriggerDir(connectorKey, connectionId, operation), `${objectName}.metadata.json`));
6658
6668
  }
6659
6669
 
6660
6670
  // src/commands/activities.ts
@@ -6672,7 +6682,7 @@ var registerActivitiesCommand = (program) => {
6672
6682
  }
6673
6683
  }
6674
6684
  if (!activitiesResponse) {
6675
- const [error, api] = await catchError(createApiClient(ElementsApi, {
6685
+ const [error, api] = await catchError2(createApiClient(ElementsApi, {
6676
6686
  tenant: options.tenant
6677
6687
  }));
6678
6688
  if (error) {
@@ -6684,7 +6694,7 @@ var registerActivitiesCommand = (program) => {
6684
6694
  processContext.exit(1);
6685
6695
  return;
6686
6696
  }
6687
- const [fetchError, fetched] = await catchError(api.getActivities({
6697
+ const [fetchError, fetched] = await catchError2(api.getActivities({
6688
6698
  elementKey: connectorKey
6689
6699
  }));
6690
6700
  if (fetchError) {
@@ -6738,37 +6748,42 @@ var registerActivitiesCommand = (program) => {
6738
6748
  };
6739
6749
 
6740
6750
  // src/commands/connections.ts
6741
- import { execFile } from "node:child_process";
6742
6751
  import {
6743
- catchError as catchError2,
6752
+ catchError as catchError3,
6753
+ extractErrorMessage,
6744
6754
  logger as logger2,
6745
6755
  OutputFormatter as OutputFormatter2,
6756
+ PollOutcome,
6757
+ pollUntil,
6746
6758
  processContext as processContext2
6747
6759
  } from "@uipath/common";
6748
-
6749
- // src/utils/error-handler.ts
6750
- async function extractErrorMessage(error) {
6751
- const status = error.status || error.response?.status;
6752
- if (status === 401) {
6753
- return "Unauthorized. Run `uip login` to authenticate.";
6754
- }
6755
- let errorMessage = error.message;
6756
- if (error.response) {
6757
- try {
6758
- const parsedResponse = JSON.parse(await error.response.text());
6759
- errorMessage = parsedResponse.message || error.message;
6760
- } catch {}
6761
- }
6762
- return errorMessage;
6760
+ import { getFileSystem as getFileSystem2 } from "@uipath/filesystem";
6761
+ var POLL_EXIT_CODES = {
6762
+ [PollOutcome.Timeout]: 2,
6763
+ [PollOutcome.Failed]: 1,
6764
+ [PollOutcome.Interrupted]: 1,
6765
+ [PollOutcome.Aborted]: 1
6766
+ };
6767
+ function handleAuthPollFailure(outcome, error, noun) {
6768
+ const messages = {
6769
+ [PollOutcome.Timeout]: `${noun} timed out after 5 minutes`,
6770
+ [PollOutcome.Failed]: `${noun} polling failed: ${error?.message ?? "too many consecutive errors"}`,
6771
+ [PollOutcome.Interrupted]: `${noun} polling was interrupted`,
6772
+ [PollOutcome.Aborted]: `${noun} polling was aborted`
6773
+ };
6774
+ OutputFormatter2.error({
6775
+ Result: "Failure",
6776
+ Message: messages[outcome] ?? `${noun} polling failed`,
6777
+ Instructions: "Please try again and complete the authentication more quickly."
6778
+ });
6779
+ processContext2.exit(POLL_EXIT_CODES[outcome] ?? 1);
6763
6780
  }
6764
-
6765
- // src/commands/connections.ts
6766
6781
  var registerConnectionsCommand = (program) => {
6767
6782
  const connections = program.command("connections").description("Manage UiPath Integration Service connections");
6768
6783
  connections.command("list").description("List connections. Without a connector key, lists all connections across all connectors.").argument("[connector-key]", "Connector key to filter by (e.g., uipath-salesforce-sfdc)").option("--folder-key <key>", "Folder key (x-uipath-folderkey) to filter connections by folder (optional)").option("--connection-id <id>", "Filter results to a specific connection ID (optional)").option("-t, --tenant <tenant-name>", "Tenant (optional, defaults to value selected during auth)").option("--refresh", "Force re-fetch from API, ignoring cache").trackedAction(processContext2, async (connectorKey, options) => {
6769
6784
  logger2.info(`Listing connections${connectorKey ? ` for connector: ${connectorKey}` : " (all connectors)"}${options.folderKey ? ` in folder: ${options.folderKey}` : ""}${options.connectionId ? ` filter by ID: ${options.connectionId}` : ""}${options.refresh ? " [refresh]" : ""}`);
6770
6785
  let connections2 = null;
6771
- const [configError, config] = await catchError2(createConnectionsConfig({
6786
+ const [configError, config] = await catchError3(createConnectionsConfig({
6772
6787
  tenant: options.tenant
6773
6788
  }));
6774
6789
  if (configError) {
@@ -6789,7 +6804,7 @@ var registerConnectionsCommand = (program) => {
6789
6804
  }
6790
6805
  if (!connections2) {
6791
6806
  const connectorsApi = new ConnectorsApi(config);
6792
- const [fetchError, fetched] = await catchError2(connectorsApi.apiV1ConnectorsKeyOrIdConnectionsGet({ keyOrId: connectorKey }, folderOverride(options.folderKey)));
6807
+ const [fetchError, fetched] = await catchError3(connectorsApi.apiV1ConnectorsKeyOrIdConnectionsGet({ keyOrId: connectorKey }, folderOverride(options.folderKey)));
6793
6808
  if (fetchError) {
6794
6809
  const errorMessage = await extractErrorMessage(fetchError);
6795
6810
  logger2.error(`Error listing connections: ${errorMessage}`);
@@ -6809,7 +6824,7 @@ var registerConnectionsCommand = (program) => {
6809
6824
  }
6810
6825
  } else {
6811
6826
  const connectionsApi = new ConnectionsApi(config);
6812
- const [fetchError, fetched] = await catchError2(connectionsApi.apiV1ConnectionsGet({}, folderOverride(options.folderKey)));
6827
+ const [fetchError, fetched] = await catchError3(connectionsApi.apiV1ConnectionsGet({}, folderOverride(options.folderKey)));
6813
6828
  if (fetchError) {
6814
6829
  const errorMessage = await extractErrorMessage(fetchError);
6815
6830
  logger2.error(`Error listing connections: ${errorMessage}`);
@@ -6907,78 +6922,67 @@ ${createResponse.authUrl}
6907
6922
  logger2.info(` (This may take a minute. Please complete the authentication in your browser)
6908
6923
  `);
6909
6924
  const sessionId = createResponse.sessionId;
6910
- const maxAttempts = 60;
6911
- const pollInterval = 5000;
6912
- let attempts = 0;
6913
- let sessionStatus = null;
6914
- while (attempts < maxAttempts) {
6915
- attempts++;
6916
- try {
6917
- sessionStatus = await sessionsApi.apiV1SessionsSessionIdGet({
6918
- sessionId
6919
- });
6920
- if (sessionStatus.status === "success") {
6921
- logger2.info(`
6925
+ const pollResult = await pollUntil({
6926
+ fn: () => sessionsApi.apiV1SessionsSessionIdGet({
6927
+ sessionId
6928
+ }),
6929
+ until: (s) => s.status === "success" || s.status === "failed",
6930
+ getStatus: (s) => s.status ?? "pending",
6931
+ logPrefix: "auth",
6932
+ intervalMs: 5000,
6933
+ timeoutMs: 300000,
6934
+ maxConsecutiveErrors: 0,
6935
+ onPoll: () => logger2.info("."),
6936
+ signal: processContext2.pollSignal
6937
+ });
6938
+ if (pollResult.outcome === PollOutcome.Completed && pollResult.data?.status === "success") {
6939
+ logger2.info(`
6922
6940
  ✅ Authentication successful!
6923
6941
  `);
6924
- logger2.info(`\uD83D\uDCCB Fetching updated connection list...
6942
+ logger2.info(`\uD83D\uDCCB Fetching updated connection list...
6925
6943
  `);
6926
- const connections2 = await connectorsApi.apiV1ConnectorsKeyOrIdConnectionsGet({ keyOrId: connectorKey });
6927
- if (connections2 && connections2.length > 0) {
6928
- await cacheConnections(connectorKey, connections2);
6929
- }
6930
- if (connections2 && connections2.length > 0) {
6931
- const latestConnection = connections2[0];
6932
- OutputFormatter2.success({
6933
- Result: "Success",
6934
- Code: "ConnectionCreated",
6935
- Message: "Connection created successfully!",
6936
- Data: {
6937
- ConnectionId: latestConnection.id,
6938
- ConnectionName: latestConnection.name,
6939
- Connector: latestConnection.connector.name,
6940
- State: latestConnection.state,
6941
- Owner: latestConnection.owner,
6942
- Folder: latestConnection.folder.name,
6943
- FolderKey: latestConnection.folder.key
6944
- }
6945
- });
6946
- } else {
6947
- OutputFormatter2.success({
6948
- Result: "Success",
6949
- Code: "ConnectionCreated",
6950
- Message: "Connection created successfully! Run 'uip is connection list' to see it."
6951
- });
6944
+ const connections2 = await connectorsApi.apiV1ConnectorsKeyOrIdConnectionsGet({ keyOrId: connectorKey });
6945
+ if (connections2 && connections2.length > 0) {
6946
+ await cacheConnections(connectorKey, connections2);
6947
+ }
6948
+ if (connections2 && connections2.length > 0) {
6949
+ const latestConnection = connections2[0];
6950
+ OutputFormatter2.success({
6951
+ Result: "Success",
6952
+ Code: "ConnectionCreated",
6953
+ Message: "Connection created successfully!",
6954
+ Data: {
6955
+ ConnectionId: latestConnection.id,
6956
+ ConnectionName: latestConnection.name,
6957
+ Connector: latestConnection.connector.name,
6958
+ State: latestConnection.state,
6959
+ Owner: latestConnection.owner,
6960
+ Folder: latestConnection.folder.name,
6961
+ FolderKey: latestConnection.folder.key
6952
6962
  }
6953
- return;
6954
- }
6955
- if (sessionStatus.status === "failed") {
6956
- logger2.info(`
6957
- Authentication failed!
6958
- `);
6959
- OutputFormatter2.error({
6960
- Result: "Failure",
6961
- Message: sessionStatus.message || "Authentication failed",
6962
- Instructions: "Please check your credentials and try again."
6963
- });
6964
- return;
6965
- }
6966
- logger2.info(".");
6967
- await sleep(pollInterval);
6968
- } catch (_error) {
6969
- logger2.info(".");
6970
- await sleep(pollInterval);
6963
+ });
6964
+ } else {
6965
+ OutputFormatter2.success({
6966
+ Result: "Success",
6967
+ Code: "ConnectionCreated",
6968
+ Message: "Connection created successfully! Run 'uip is connection list' to see it."
6969
+ });
6971
6970
  }
6971
+ return;
6972
6972
  }
6973
- logger2.info(`
6974
-
6975
- ⏱️ Authentication timeout!
6973
+ if (pollResult.outcome === PollOutcome.Completed && pollResult.data?.status === "failed") {
6974
+ logger2.info(`
6975
+ Authentication failed!
6976
6976
  `);
6977
- OutputFormatter2.error({
6978
- Result: "Failure",
6979
- Message: "Authentication timed out after 5 minutes",
6980
- Instructions: "Please try again and complete the authentication more quickly."
6981
- });
6977
+ OutputFormatter2.error({
6978
+ Result: "Failure",
6979
+ Message: pollResult.data.message ?? "Authentication failed",
6980
+ Instructions: "Please check your credentials and try again."
6981
+ });
6982
+ processContext2.exit(1);
6983
+ return;
6984
+ }
6985
+ handleAuthPollFailure(pollResult.outcome, pollResult.error, "Authentication");
6982
6986
  } catch (error) {
6983
6987
  const errorMessage = await extractErrorMessage(error);
6984
6988
  OutputFormatter2.error({
@@ -6991,7 +6995,7 @@ ${createResponse.authUrl}
6991
6995
  });
6992
6996
  connections.command("ping").description("Check if a connection is active and enabled").argument("<connection-id>", "Connection ID to ping").option("-t, --tenant <tenant-name>", "Tenant (optional, defaults to value selected during auth)").trackedAction(processContext2, async (connectionId, options) => {
6993
6997
  logger2.info(`Pinging connection: ${connectionId}`);
6994
- const [configError, config] = await catchError2(createConnectionsConfig({
6998
+ const [configError, config] = await catchError3(createConnectionsConfig({
6995
6999
  tenant: options.tenant
6996
7000
  }));
6997
7001
  if (configError) {
@@ -7004,7 +7008,7 @@ ${createResponse.authUrl}
7004
7008
  return;
7005
7009
  }
7006
7010
  const connectionsApi = new ConnectionsApi(config);
7007
- const [error, result] = await catchError2(connectionsApi.apiV1ConnectionsConnectionIdPingGet({
7011
+ const [error, result] = await catchError3(connectionsApi.apiV1ConnectionsConnectionIdPingGet({
7008
7012
  connectionId
7009
7013
  }));
7010
7014
  if (error) {
@@ -7074,56 +7078,47 @@ ${editResponse.authUrl}
7074
7078
  logger2.info(` (This may take a minute. Please complete the authentication in your browser)
7075
7079
  `);
7076
7080
  const sessionId = editResponse.sessionId;
7077
- const maxAttempts = 60;
7078
- const pollInterval = 5000;
7079
- let attempts = 0;
7080
- while (attempts < maxAttempts) {
7081
- attempts++;
7082
- try {
7083
- const sessionStatus = await sessionsApi.apiV1SessionsSessionIdGet({
7084
- sessionId
7085
- });
7086
- if (sessionStatus.status === "success") {
7087
- logger2.info(`
7081
+ const pollResult = await pollUntil({
7082
+ fn: () => sessionsApi.apiV1SessionsSessionIdGet({
7083
+ sessionId
7084
+ }),
7085
+ until: (s) => s.status === "success" || s.status === "failed",
7086
+ getStatus: (s) => s.status ?? "pending",
7087
+ logPrefix: "auth",
7088
+ intervalMs: 5000,
7089
+ timeoutMs: 300000,
7090
+ maxConsecutiveErrors: 0,
7091
+ onPoll: () => logger2.info("."),
7092
+ signal: processContext2.pollSignal
7093
+ });
7094
+ if (pollResult.outcome === PollOutcome.Completed && pollResult.data?.status === "success") {
7095
+ logger2.info(`
7088
7096
  Re-authentication successful!
7089
7097
  `);
7090
- OutputFormatter2.success({
7091
- Result: "Success",
7092
- Code: "ConnectionEdited",
7093
- Message: "Connection re-authenticated successfully!",
7094
- Data: {
7095
- ConnectionId: connectionId,
7096
- State: "Enabled"
7097
- }
7098
- });
7099
- return;
7098
+ OutputFormatter2.success({
7099
+ Result: "Success",
7100
+ Code: "ConnectionEdited",
7101
+ Message: "Connection re-authenticated successfully!",
7102
+ Data: {
7103
+ ConnectionId: connectionId,
7104
+ State: "Enabled"
7100
7105
  }
7101
- if (sessionStatus.status === "failed") {
7102
- logger2.info(`
7106
+ });
7107
+ return;
7108
+ }
7109
+ if (pollResult.outcome === PollOutcome.Completed && pollResult.data?.status === "failed") {
7110
+ logger2.info(`
7103
7111
  Re-authentication failed!
7104
7112
  `);
7105
- OutputFormatter2.error({
7106
- Result: "Failure",
7107
- Message: sessionStatus.message || "Re-authentication failed",
7108
- Instructions: "Please check your credentials and try again."
7109
- });
7110
- return;
7111
- }
7112
- logger2.info(".");
7113
- await sleep(pollInterval);
7114
- } catch (_error) {
7115
- logger2.info(".");
7116
- await sleep(pollInterval);
7117
- }
7113
+ OutputFormatter2.error({
7114
+ Result: "Failure",
7115
+ Message: pollResult.data.message ?? "Re-authentication failed",
7116
+ Instructions: "Please check your credentials and try again."
7117
+ });
7118
+ processContext2.exit(1);
7119
+ return;
7118
7120
  }
7119
- logger2.info(`
7120
- Authentication timeout!
7121
- `);
7122
- OutputFormatter2.error({
7123
- Result: "Failure",
7124
- Message: "Re-authentication timed out after 5 minutes",
7125
- Instructions: "Please try again and complete the authentication more quickly."
7126
- });
7121
+ handleAuthPollFailure(pollResult.outcome, pollResult.error, "Re-authentication");
7127
7122
  } catch (error) {
7128
7123
  const errorMessage = await extractErrorMessage(error);
7129
7124
  OutputFormatter2.error({
@@ -7136,24 +7131,13 @@ Authentication timeout!
7136
7131
  });
7137
7132
  };
7138
7133
  async function openBrowser(url) {
7139
- const platform = process.platform;
7140
- const cmd = platform === "darwin" ? "open" : platform === "win32" ? "start" : "xdg-open";
7141
- return new Promise((resolve, reject) => {
7142
- execFile(cmd, [url], (error) => {
7143
- if (error)
7144
- reject(error);
7145
- else
7146
- resolve();
7147
- });
7148
- });
7149
- }
7150
- function sleep(ms) {
7151
- return new Promise((resolve) => setTimeout(resolve, ms));
7134
+ await getFileSystem2().utils.open(url);
7152
7135
  }
7153
7136
 
7154
7137
  // src/commands/connectors.ts
7155
7138
  import {
7156
- catchError as catchError3,
7139
+ catchError as catchError4,
7140
+ extractErrorMessage as extractErrorMessage2,
7157
7141
  logger as logger3,
7158
7142
  OutputFormatter as OutputFormatter3,
7159
7143
  processContext as processContext3
@@ -7162,6 +7146,18 @@ var registerConnectorsCommand = (program) => {
7162
7146
  const connectors = program.command("connectors").description("Manage UiPath Integration Service connectors");
7163
7147
  connectors.command("list").description("List all connectors").option("-t, --tenant <tenant-name>", "Tenant (optional, defaults to value selected during auth").option("-f, --filter <filter>", "Filter connectors by name or key").option("--refresh", "Force re-fetch from API, ignoring cache").trackedAction(processContext3, async (options) => {
7164
7148
  logger3.info(`Listing connectors${options.filter ? ` (filter: ${options.filter})` : ""}${options.refresh ? " [refresh]" : ""}`);
7149
+ const [apiError, api] = await catchError4(createApiClient(ConnectorsApi, {
7150
+ tenant: options.tenant
7151
+ }));
7152
+ if (apiError) {
7153
+ OutputFormatter3.error({
7154
+ Result: "Failure",
7155
+ Message: "Error listing connectors",
7156
+ Instructions: apiError.message
7157
+ });
7158
+ processContext3.exit(1);
7159
+ return;
7160
+ }
7165
7161
  let connectors2 = null;
7166
7162
  if (!options.refresh) {
7167
7163
  connectors2 = await readCachedConnectors();
@@ -7170,21 +7166,9 @@ var registerConnectorsCommand = (program) => {
7170
7166
  }
7171
7167
  }
7172
7168
  if (!connectors2) {
7173
- const [apiError, api] = await catchError3(createApiClient(ConnectorsApi, {
7174
- tenant: options.tenant
7175
- }));
7176
- if (apiError) {
7177
- OutputFormatter3.error({
7178
- Result: "Failure",
7179
- Message: "Error listing connectors",
7180
- Instructions: apiError.message
7181
- });
7182
- processContext3.exit(1);
7183
- return;
7184
- }
7185
- const [fetchError, fetched] = await catchError3(api.apiV1ConnectorsGet({}));
7169
+ const [fetchError, fetched] = await catchError4(api.apiV1ConnectorsGet({}));
7186
7170
  if (fetchError) {
7187
- const errorMessage = await extractErrorMessage(fetchError);
7171
+ const errorMessage = await extractErrorMessage2(fetchError);
7188
7172
  logger3.error(`Error listing connectors: ${errorMessage}`);
7189
7173
  OutputFormatter3.error({
7190
7174
  Result: "Failure",
@@ -7234,7 +7218,7 @@ var registerConnectorsCommand = (program) => {
7234
7218
  });
7235
7219
  connectors.command("get").description("Get connector by key").argument("<connector-key>", "Connector key (e.g., uipath-zoho-desk)").option("-t, --tenant <tenant-name>", "Tenant (optional, defaults to value selected during auth").trackedAction(processContext3, async (connectorKey, options) => {
7236
7220
  logger3.info(`Getting connector: ${connectorKey}`);
7237
- const [apiError, api] = await catchError3(createApiClient(ConnectorsApi, {
7221
+ const [apiError, api] = await catchError4(createApiClient(ConnectorsApi, {
7238
7222
  tenant: options.tenant
7239
7223
  }));
7240
7224
  if (apiError) {
@@ -7246,11 +7230,11 @@ var registerConnectorsCommand = (program) => {
7246
7230
  processContext3.exit(1);
7247
7231
  return;
7248
7232
  }
7249
- const [error, connector] = await catchError3(api.apiV1ConnectorsKeyOrIdGet({
7233
+ const [error, connector] = await catchError4(api.apiV1ConnectorsKeyOrIdGet({
7250
7234
  keyOrId: connectorKey
7251
7235
  }));
7252
7236
  if (error) {
7253
- const errorMessage = await extractErrorMessage(error);
7237
+ const errorMessage = await extractErrorMessage2(error);
7254
7238
  logger3.error(`Error getting connector '${connectorKey}': ${errorMessage}`);
7255
7239
  OutputFormatter3.error({
7256
7240
  Result: "Failure",
@@ -7298,7 +7282,8 @@ var registerConnectorsCommand = (program) => {
7298
7282
 
7299
7283
  // src/commands/resources.ts
7300
7284
  import {
7301
- catchError as catchError4,
7285
+ catchError as catchError5,
7286
+ extractErrorMessage as extractErrorMessage3,
7302
7287
  logger as logger4,
7303
7288
  OutputFormatter as OutputFormatter4,
7304
7289
  processContext as processContext4,
@@ -7329,15 +7314,36 @@ function metadataFilePath(connectorKey, connectionId, objectName, operationName)
7329
7314
  return `${CACHE_PATH_PREFIX}/${connectorKey}/${connectionId}/${objectName}.${operationName}.json`;
7330
7315
  }
7331
7316
  function buildDescribeSummary(cached, connectorKey, connectionId, objectName, operationName, hasExplicitConnectionId) {
7317
+ const parameters = cached.parameters ?? [];
7318
+ const queryParams = parameters.filter((p) => p.type === "query");
7319
+ const pathParams = parameters.filter((p) => p.type === "path");
7332
7320
  const summary = {
7333
7321
  name: cached.name,
7334
7322
  displayName: cached.displayName,
7323
+ path: cached.path,
7335
7324
  operation: cached.operation,
7336
7325
  metadataFile: metadataFilePath(connectorKey, connectionId, objectName, operationName),
7337
7326
  requiredFields: cached.requestFields.filter((f) => f.required).map((f) => f.name),
7338
7327
  optionalFields: cached.requestFields.filter((f) => !f.required).map((f) => f.name),
7339
7328
  responseFields: cached.responseFields.map((f) => f.name)
7340
7329
  };
7330
+ if (queryParams.length > 0) {
7331
+ summary.queryParameters = queryParams.map((p) => ({
7332
+ name: p.name,
7333
+ displayName: p.displayName,
7334
+ required: p.required ?? false,
7335
+ defaultValue: p.defaultValue,
7336
+ description: p.description
7337
+ }));
7338
+ }
7339
+ if (pathParams.length > 0) {
7340
+ summary.pathParameters = pathParams.map((p) => ({
7341
+ name: p.name,
7342
+ displayName: p.displayName,
7343
+ required: p.required ?? false,
7344
+ description: p.description
7345
+ }));
7346
+ }
7341
7347
  if (!hasExplicitConnectionId) {
7342
7348
  summary.Warning = "Results may not include custom fields. Use --connection-id <id> for connection-specific metadata including custom objects and fields. Run 'is connections list <connector-key>' to get available connection IDs.";
7343
7349
  }
@@ -7352,9 +7358,9 @@ function parseBody(options) {
7352
7358
  });
7353
7359
  return null;
7354
7360
  }
7355
- try {
7356
- return JSON.parse(options.body);
7357
- } catch (error) {
7361
+ const body = options.body;
7362
+ const [error, parsed] = catchError5(() => JSON.parse(body));
7363
+ if (error) {
7358
7364
  OutputFormatter4.error({
7359
7365
  Result: "Failure",
7360
7366
  Message: "Invalid JSON in --body parameter",
@@ -7362,6 +7368,7 @@ function parseBody(options) {
7362
7368
  });
7363
7369
  return null;
7364
7370
  }
7371
+ return parsed;
7365
7372
  }
7366
7373
  function addExecuteOptions(cmd) {
7367
7374
  return cmd.option("--connection-id <id>", "Connection/Instance ID (required)").option("-t, --tenant <tenant-name>", "Tenant (optional, defaults to value selected during auth)").option("--query <params>", "Query parameters as key=value pairs, separated by & (e.g., limit=10&offset=0)");
@@ -7410,7 +7417,7 @@ async function fetchResourceMetadata(api, connectorKey, objectName, connectionId
7410
7417
  async function resolveOperationPath(api, connectorKey, objectName, connectionId, normalizedOperation, queryParams) {
7411
7418
  let resolvedPath = objectName;
7412
7419
  let resolvedQuery = queryParams;
7413
- try {
7420
+ const [resolveError] = await catchError5(async () => {
7414
7421
  const operationName = METHOD_TO_OPERATION[normalizedOperation] || normalizedOperation;
7415
7422
  const cached = await readCachedForPathResolution(connectorKey, connectionId, objectName, operationName);
7416
7423
  let methodPath;
@@ -7457,8 +7464,9 @@ async function resolveOperationPath(api, connectorKey, objectName, connectionId,
7457
7464
  }
7458
7465
  resolvedPath = methodPath.startsWith("/") ? methodPath.substring(1) : methodPath;
7459
7466
  }
7460
- } catch (e) {
7461
- logger4.warn(`Failed to resolve operation path for '${objectName}' on connector '${connectorKey}', falling back to object name:`, e);
7467
+ });
7468
+ if (resolveError) {
7469
+ logger4.warn(`Failed to resolve operation path for '${objectName}' on connector '${connectorKey}', falling back to object name:`, resolveError);
7462
7470
  }
7463
7471
  return { resolvedPath, resolvedQuery };
7464
7472
  }
@@ -7479,18 +7487,17 @@ async function executeAndOutput(connectorKey, objectName, httpMethod, normalized
7479
7487
  });
7480
7488
  }
7481
7489
  async function handleExecuteAction(connectorKey, objectName, httpMethod, normalizedOperation, options, requiresBody) {
7482
- try {
7483
- if (!validateConnectionId(options))
7490
+ if (!validateConnectionId(options))
7491
+ return;
7492
+ let requestBody;
7493
+ if (requiresBody) {
7494
+ requestBody = parseBody(options);
7495
+ if (requestBody === null)
7484
7496
  return;
7485
- let requestBody;
7486
- if (requiresBody) {
7487
- requestBody = parseBody(options);
7488
- if (requestBody === null)
7489
- return;
7490
- }
7491
- await executeAndOutput(connectorKey, objectName, httpMethod, normalizedOperation, options, requestBody);
7492
- } catch (error) {
7493
- const errorMessage = await extractErrorMessage(error);
7497
+ }
7498
+ const [error] = await catchError5(executeAndOutput(connectorKey, objectName, httpMethod, normalizedOperation, options, requestBody));
7499
+ if (error) {
7500
+ const errorMessage = await extractErrorMessage3(error);
7494
7501
  OutputFormatter4.error({
7495
7502
  Result: "Failure",
7496
7503
  Message: errorMessage,
@@ -7511,7 +7518,7 @@ var registerResourcesCommand = (program) => {
7511
7518
  }
7512
7519
  }
7513
7520
  if (!resourcesList) {
7514
- const [apiError, api] = await catchError4(createApiClient(ElementsApi, {
7521
+ const [apiError, api] = await catchError5(createApiClient(ElementsApi, {
7515
7522
  tenant: options.tenant
7516
7523
  }));
7517
7524
  if (apiError) {
@@ -7529,9 +7536,9 @@ var registerResourcesCommand = (program) => {
7529
7536
  }) : api.getObjects({
7530
7537
  elementKey: connectorKey
7531
7538
  });
7532
- const [fetchError, fetched] = await catchError4(fetchFn);
7539
+ const [fetchError, fetched] = await catchError5(fetchFn);
7533
7540
  if (fetchError) {
7534
- const errorMessage = await extractErrorMessage(fetchError);
7541
+ const errorMessage = await extractErrorMessage3(fetchError);
7535
7542
  logger4.error(`Error listing resources for connector '${connectorKey}': ${errorMessage}`);
7536
7543
  OutputFormatter4.error({
7537
7544
  Result: "Failure",
@@ -7630,7 +7637,7 @@ var registerResourcesCommand = (program) => {
7630
7637
  return;
7631
7638
  }
7632
7639
  }
7633
- const [apiError2, api2] = await catchError4(createApiClient(ElementsApi, {
7640
+ const [apiError2, api2] = await catchError5(createApiClient(ElementsApi, {
7634
7641
  tenant: options.tenant
7635
7642
  }));
7636
7643
  if (apiError2) {
@@ -7642,9 +7649,9 @@ var registerResourcesCommand = (program) => {
7642
7649
  processContext4.exit(1);
7643
7650
  return;
7644
7651
  }
7645
- const [metaError2, metadata2] = await catchError4(fetchResourceMetadata(api2, connectorKey, objectName, options.connectionId));
7652
+ const [metaError2, metadata2] = await catchError5(fetchResourceMetadata(api2, connectorKey, objectName, options.connectionId));
7646
7653
  if (metaError2) {
7647
- const errorMessage = await extractErrorMessage(metaError2);
7654
+ const errorMessage = await extractErrorMessage3(metaError2);
7648
7655
  OutputFormatter4.error({
7649
7656
  Result: "Failure",
7650
7657
  Message: errorMessage,
@@ -7670,7 +7677,7 @@ var registerResourcesCommand = (program) => {
7670
7677
  }
7671
7678
  return;
7672
7679
  }
7673
- const [apiError, api] = await catchError4(createApiClient(ElementsApi, {
7680
+ const [apiError, api] = await catchError5(createApiClient(ElementsApi, {
7674
7681
  tenant: options.tenant
7675
7682
  }));
7676
7683
  if (apiError) {
@@ -7682,9 +7689,9 @@ var registerResourcesCommand = (program) => {
7682
7689
  processContext4.exit(1);
7683
7690
  return;
7684
7691
  }
7685
- const [metaError, metadata] = await catchError4(fetchResourceMetadata(api, connectorKey, objectName, options.connectionId));
7692
+ const [metaError, metadata] = await catchError5(fetchResourceMetadata(api, connectorKey, objectName, options.connectionId));
7686
7693
  if (metaError) {
7687
- const errorMessage = await extractErrorMessage(metaError);
7694
+ const errorMessage = await extractErrorMessage3(metaError);
7688
7695
  OutputFormatter4.error({
7689
7696
  Result: "Failure",
7690
7697
  Message: errorMessage,
@@ -7726,7 +7733,7 @@ var registerResourcesCommand = (program) => {
7726
7733
 
7727
7734
  // src/commands/triggers.ts
7728
7735
  import {
7729
- catchError as catchError5,
7736
+ catchError as catchError6,
7730
7737
  logger as logger5,
7731
7738
  OutputFormatter as OutputFormatter5,
7732
7739
  processContext as processContext5
@@ -7734,20 +7741,20 @@ import {
7734
7741
  var CRUD_OPERATIONS = new Set(["CREATED", "UPDATED", "DELETED"]);
7735
7742
  async function fetchTriggerObjects(api, connectorKey, operationName, connectionId) {
7736
7743
  if (connectionId) {
7737
- return catchError5(api.getInstanceEventObjects({
7744
+ return catchError6(api.getInstanceEventObjects({
7738
7745
  connectionOrInstanceId: connectionId,
7739
7746
  elementKey: connectorKey,
7740
7747
  operationName
7741
7748
  }));
7742
7749
  }
7743
- return catchError5(api.getEventObjects({
7750
+ return catchError6(api.getEventObjects({
7744
7751
  elementKey: connectorKey,
7745
7752
  operationName
7746
7753
  }));
7747
7754
  }
7748
7755
  async function fetchTriggerMetadata(api, connectorKey, operationName, objectName, connectionId) {
7749
7756
  if (connectionId) {
7750
- return catchError5(api.getInstanceEventObjectMetadata({
7757
+ return catchError6(api.getInstanceEventObjectMetadata({
7751
7758
  connectionOrInstanceId: connectionId,
7752
7759
  elementKey: connectorKey,
7753
7760
  operationName,
@@ -7755,7 +7762,7 @@ async function fetchTriggerMetadata(api, connectorKey, operationName, objectName
7755
7762
  allFields: true
7756
7763
  }));
7757
7764
  }
7758
- return catchError5(api.getEventObjectMetadata({
7765
+ return catchError6(api.getEventObjectMetadata({
7759
7766
  elementKey: connectorKey,
7760
7767
  operationName,
7761
7768
  objectName,
@@ -7779,7 +7786,7 @@ var registerTriggersCommand = (program) => {
7779
7786
  return;
7780
7787
  }
7781
7788
  }
7782
- const [clientError, api] = await catchError5(createApiClient(ElementsApi, {
7789
+ const [clientError, api] = await catchError6(createApiClient(ElementsApi, {
7783
7790
  tenant: options.tenant
7784
7791
  }));
7785
7792
  if (clientError) {
@@ -7839,7 +7846,7 @@ var registerTriggersCommand = (program) => {
7839
7846
  return;
7840
7847
  }
7841
7848
  }
7842
- const [clientError, api] = await catchError5(createApiClient(ElementsApi, {
7849
+ const [clientError, api] = await catchError6(createApiClient(ElementsApi, {
7843
7850
  tenant: options.tenant
7844
7851
  }));
7845
7852
  if (clientError) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/integrationservice-tool",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "description": "Manage Integration Service connectors, connections, and triggers.",
5
5
  "private": false,
6
6
  "maintainers": [
@@ -10,14 +10,14 @@
10
10
  ],
11
11
  "repository": {
12
12
  "type": "git",
13
- "url": "https://github.com/UiPath/uipcli.git",
13
+ "url": "https://github.com/UiPath/cli.git",
14
14
  "directory": "packages/integrationservice-tool"
15
15
  },
16
16
  "publishConfig": {
17
17
  "registry": "https://registry.npmjs.org/"
18
18
  },
19
19
  "keywords": [
20
- "uipcli-tool"
20
+ "cli-tool"
21
21
  ],
22
22
  "type": "module",
23
23
  "main": "./dist/tool.js",
@@ -31,7 +31,7 @@
31
31
  "dist"
32
32
  ],
33
33
  "scripts": {
34
- "build": "bun build ./src/tool.ts --outdir dist --format esm --target node --external commander --external @uipath/common --external @uipath/auth && bun build ./src/index.ts --outdir dist --format esm --target node --external '*/tool.js' --external commander --external @uipath/common --external @uipath/auth",
34
+ "build": "bun ../../tools/build-tool.ts",
35
35
  "package": "bun run build && bun pm pack",
36
36
  "lint": "biome check .",
37
37
  "lint:fix": "biome check --write .",
@@ -40,12 +40,13 @@
40
40
  },
41
41
  "peerDependencies": {
42
42
  "commander": "^14.0.3",
43
- "@uipath/common": "^0.1.7",
44
- "@uipath/auth": "^0.1.6"
43
+ "@uipath/common": "^0.1.13",
44
+ "@uipath/auth": "^0.1.9",
45
+ "@uipath/filesystem": "^0.1.6"
45
46
  },
46
47
  "devDependencies": {
47
- "@uipath/integrationservice-sdk": "workspace:*",
48
- "@types/node": "^25.2.3",
48
+ "@uipath/integrationservice-sdk": "0.1.6",
49
+ "@types/node": "^25.5.0",
49
50
  "typescript": "^5"
50
51
  }
51
52
  }