@uipath/codedapp-tool 0.1.14 → 0.2.0

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 +33 -15
  2. package/package.json +4 -4
package/dist/tool.js CHANGED
@@ -69966,7 +69966,8 @@ var getBaseHtml = ({ title, message, type: type2 }) => {
69966
69966
  // ../auth/src/server.ts
69967
69967
  var startServer = async ({
69968
69968
  redirectUri,
69969
- timeoutMs = DEFAULT_AUTH_TIMEOUT_MS
69969
+ timeoutMs = DEFAULT_AUTH_TIMEOUT_MS,
69970
+ onListening
69970
69971
  }) => {
69971
69972
  let http3;
69972
69973
  try {
@@ -70036,6 +70037,13 @@ var startServer = async ({
70036
70037
  });
70037
70038
  server.listen(redirectUri.port, () => {
70038
70039
  logger.info("Waiting for authentication callback on port:", redirectUri.port);
70040
+ if (onListening) {
70041
+ Promise.resolve(onListening()).catch((err) => {
70042
+ server.close();
70043
+ clearTimeout(timeoutHandle);
70044
+ reject(err);
70045
+ });
70046
+ }
70039
70047
  });
70040
70048
  const timeoutHandle = setTimeout(() => {
70041
70049
  server.close();
@@ -70058,24 +70066,34 @@ __export(exports_node_strategy, {
70058
70066
 
70059
70067
  class NodeAuthStrategy {
70060
70068
  async execute(url2, redirectUri) {
70061
- logger.info("Opening browser for authentication...");
70062
- logger.info(`If browser doesn't open, visit: ${url2}`);
70063
70069
  const fs8 = getFileSystem();
70064
- try {
70065
- await fs8.utils.open(url2);
70066
- } catch (err) {
70067
- const isSpawnError = err instanceof Error && "code" in err && err.code === "ENOENT";
70068
- if (isSpawnError) {
70069
- throw new Error("Could not open a browser. No supported browser launcher was found. " + `On a headless or minimal system, use non-interactive login instead:
70070
+ const callbackUrl = await startServer({
70071
+ redirectUri,
70072
+ onListening: async () => {
70073
+ let safeUrl = "";
70074
+ for (const ch of url2) {
70075
+ const c = ch.charCodeAt(0);
70076
+ if (c > 31 && (c < 128 || c > 159))
70077
+ safeUrl += ch;
70078
+ }
70079
+ logger.info("Opening browser for authentication...");
70080
+ logger.info(`If browser doesn't open, visit: ${safeUrl}`);
70081
+ const [openError] = await catchError(fs8.utils.open(url2));
70082
+ if (!openError)
70083
+ return;
70084
+ const isSpawnError = "code" in openError && openError.code === "ENOENT";
70085
+ if (isSpawnError) {
70086
+ throw new Error("Could not open a browser. No supported browser launcher was found. " + `On a headless or minimal system, use non-interactive login instead:
70070
70087
 
70071
70088
  ` + ` uip login --client-id <id> --client-secret <secret> -t <tenant>
70072
70089
 
70073
- ` + "Or install a browser opener for your OS (e.g. xdg-utils on Linux).", { cause: err });
70090
+ ` + "Or install a browser opener for your OS (e.g. xdg-utils on Linux).", { cause: openError });
70091
+ }
70092
+ throw new Error("Could not open the browser automatically. " + `Visit this URL to authenticate:
70093
+
70094
+ ${safeUrl}
70095
+ `, { cause: openError });
70074
70096
  }
70075
- throw err;
70076
- }
70077
- const callbackUrl = await startServer({
70078
- redirectUri
70079
70097
  });
70080
70098
  const code = callbackUrl.searchParams.get("code");
70081
70099
  if (!code) {
@@ -70189,7 +70207,7 @@ var init_src3 = __esm(() => {
70189
70207
  // package.json
70190
70208
  var package_default = {
70191
70209
  name: "@uipath/codedapp-tool",
70192
- version: "0.1.14",
70210
+ version: "0.2.0",
70193
70211
  description: "Build, pack, publish, deploy, and manage UiPath Coded Web Applications.",
70194
70212
  keywords: [
70195
70213
  "cli-tool",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/codedapp-tool",
3
- "version": "0.1.14",
3
+ "version": "0.2.0",
4
4
  "description": "Build, pack, publish, deploy, and manage UiPath Coded Web Applications.",
5
5
  "keywords": [
6
6
  "cli-tool",
@@ -35,9 +35,9 @@
35
35
  "lint:fix": "biome check --write ."
36
36
  },
37
37
  "devDependencies": {
38
- "@uipath/auth": "0.1.11",
39
- "@uipath/common": "0.1.15",
40
- "@uipath/filesystem": "0.1.7",
38
+ "@uipath/auth": "0.2.0",
39
+ "@uipath/common": "0.2.0",
40
+ "@uipath/filesystem": "0.2.0",
41
41
  "@types/bun": "^1.3.9",
42
42
  "chalk": "^5.3.0",
43
43
  "commander": "^14.0.3",