@uipath/codedapp-tool 1.202.2 → 1.202.3-preview.238

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.
@@ -1506,6 +1506,32 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
1506
1506
 
1507
1507
  ## reflect-metadata@0.2.2
1508
1508
 
1509
+ Copyright notices from the source file headers, which the
1510
+ bundle does not keep:
1511
+
1512
+ ```
1513
+ Copyright (C) Microsoft. All rights reserved.
1514
+ ```
1515
+
1516
+ `CopyrightNotice.txt` shipped with the package:
1517
+
1518
+ ```
1519
+ /*! *****************************************************************************
1520
+ Copyright (c) Microsoft Corporation. All rights reserved.
1521
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
1522
+ this file except in compliance with the License. You may obtain a copy of the
1523
+ License at http://www.apache.org/licenses/LICENSE-2.0
1524
+
1525
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1526
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
1527
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
1528
+ MERCHANTABLITY OR NON-INFRINGEMENT.
1529
+
1530
+ See the Apache Version 2.0 License for specific language governing permissions
1531
+ and limitations under the License.
1532
+ ***************************************************************************** */
1533
+ ```
1534
+
1509
1535
  SPDX: Apache-2.0
1510
1536
 
1511
1537
  ```
@@ -2016,6 +2042,25 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
2016
2042
 
2017
2043
  ## tslib@1.14.1
2018
2044
 
2045
+ `CopyrightNotice.txt` shipped with the package:
2046
+
2047
+ ```
2048
+ /*! *****************************************************************************
2049
+ Copyright (c) Microsoft Corporation.
2050
+
2051
+ Permission to use, copy, modify, and/or distribute this software for any
2052
+ purpose with or without fee is hereby granted.
2053
+
2054
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
2055
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
2056
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
2057
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
2058
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
2059
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2060
+ PERFORMANCE OF THIS SOFTWARE.
2061
+ ***************************************************************************** */
2062
+ ```
2063
+
2019
2064
  SPDX: 0BSD
2020
2065
 
2021
2066
  ```
@@ -45,6 +45,7 @@ import {
45
45
  parseAuthFlow,
46
46
  parseJWT,
47
47
  readAuthFromEnv,
48
+ readTokenScopes,
48
49
  refreshAccessToken,
49
50
  refreshTokenFingerprint,
50
51
  registerRobotClientLoader,
@@ -58,7 +59,7 @@ import {
58
59
  selectTenantWithDeps,
59
60
  setActiveAuthProfile,
60
61
  setAuthFileConfig
61
- } from "./packager-tool-pvtdkdk8.js";
62
+ } from "./packager-tool-v4meqsaj.js";
62
63
  import {
63
64
  isBrowser,
64
65
  isNode
@@ -124,6 +125,7 @@ export {
124
125
  parseAuthFlow,
125
126
  parseJWT,
126
127
  readAuthFromEnv,
128
+ readTokenScopes,
127
129
  refreshAccessToken,
128
130
  refreshTokenFingerprint,
129
131
  registerRobotClientLoader,
@@ -139,4 +141,4 @@ export {
139
141
  setAuthFileConfig
140
142
  };
141
143
 
142
- //# debugId=2791EE15E4B4F73864756E2164756E21
144
+ //# debugId=019277289A5B586264756E2164756E21
@@ -8,11 +8,11 @@ import {
8
8
  isGuid,
9
9
  logger,
10
10
  normalizeProjectType
11
- } from "./packager-tool-ckanbe2q.js";
11
+ } from "./packager-tool-k20swr78.js";
12
12
  import {
13
13
  getAuthContext,
14
14
  getLoginStatusAsync
15
- } from "./packager-tool-pvtdkdk8.js";
15
+ } from "./packager-tool-v4meqsaj.js";
16
16
  import"./packager-tool-aybzcdfg.js";
17
17
  import"./packager-tool-0gctz400.js";
18
18
  import {
package/dist/index.js CHANGED
@@ -2,11 +2,11 @@
2
2
  import {
3
3
  metadata,
4
4
  registerCommands
5
- } from "./packager-tool-npxwr0xj.js";
5
+ } from "./packager-tool-a6843kt5.js";
6
6
  import {
7
7
  Command
8
- } from "./packager-tool-ckanbe2q.js";
9
- import"./packager-tool-pvtdkdk8.js";
8
+ } from "./packager-tool-k20swr78.js";
9
+ import"./packager-tool-v4meqsaj.js";
10
10
  import"./packager-tool-05wez2xw.js";
11
11
  import"./packager-tool-aybzcdfg.js";
12
12
  import"./packager-tool-0gctz400.js";
@@ -6,6 +6,7 @@ import {
6
6
  OutputFormatter,
7
7
  RESULTS,
8
8
  canPrompt,
9
+ carriedErrorCode,
9
10
  catchError,
10
11
  describeConnectivityError,
11
12
  extractErrorDetails,
@@ -22,10 +23,12 @@ import {
22
23
  requireConfirmation,
23
24
  trackShipSucceeded,
24
25
  tryRegisterProjectInParentSolution
25
- } from "./packager-tool-ckanbe2q.js";
26
+ } from "./packager-tool-k20swr78.js";
26
27
  import {
27
- getLoginStatusAsync
28
- } from "./packager-tool-pvtdkdk8.js";
28
+ getLoginStatusAsync,
29
+ readTokenScopes,
30
+ resolveSessionIdentity
31
+ } from "./packager-tool-v4meqsaj.js";
29
32
  import {
30
33
  WEBAPP_MANIFEST_FILE_NAME,
31
34
  WebAppToolFactory
@@ -20615,7 +20618,7 @@ var require_ignore = __commonJS(function(exports, module) {
20615
20618
  var package_default = {
20616
20619
  name: "@uipath/codedapp-tool",
20617
20620
  license: "SEE LICENSE IN LICENSE.txt",
20618
- version: "1.202.2",
20621
+ version: "1.202.3-preview.238",
20619
20622
  description: "Build, pack, publish, deploy, and manage UiPath Coded Web Applications.",
20620
20623
  keywords: [
20621
20624
  "cli-tool",
@@ -21412,6 +21415,7 @@ var MESSAGES = {
21412
21415
  AUTHENTICATION_FAILED: 'Authentication failed. Please check your UIPATH_ACCESS_TOKEN, run "uip login" to authenticate, or pass credentials via CLI flags',
21413
21416
  ACCESS_DENIED: "Access denied. You may not have permission to access this tenant/organization",
21414
21417
  API_ENDPOINT_NOT_FOUND: "API endpoint not found. Please check your UIPATH_BASE_URL configuration",
21418
+ APPS_SERVICE_APP_TOKEN_HINT: "The UiPath Apps service rejected this external application's token: it is missing the Apps.Read and Apps.Write scopes. Grant them to the external application (Admin > External Applications), then add them to 'uip login --scope'.",
21415
21419
  SERVER_ERROR: "Server error occurred. Please try again later or contact UiPath support",
21416
21420
  SERVICES_UNAVAILABLE: "UiPath services are temporarily unavailable. Please try again later",
21417
21421
  RATE_LIMIT_EXCEEDED: "Rate limit exceeded. Please wait and try again",
@@ -21638,7 +21642,7 @@ var MESSAGE_BUILDERS = {
21638
21642
  var getHttpErrorMessage = (status, context) => {
21639
21643
  switch (status) {
21640
21644
  case 401:
21641
- return MESSAGES.ERRORS.AUTHENTICATION_FAILED;
21645
+ return context ? `Authentication failed during ${context.toLowerCase()}. Please check your UIPATH_ACCESS_TOKEN, run "uip login" to authenticate, or pass credentials via CLI flags` : MESSAGES.ERRORS.AUTHENTICATION_FAILED;
21642
21646
  case 403:
21643
21647
  return context ? `Access denied. You may not have permission to ${context.toLowerCase()} in this tenant/organization` : MESSAGES.ERRORS.ACCESS_DENIED;
21644
21648
  case 404:
@@ -21727,7 +21731,10 @@ var ALLOWED_PUSH_EXTENSIONS = new Set([
21727
21731
  ".wasm",
21728
21732
  ".webmanifest",
21729
21733
  ".lock",
21730
- ".license"
21734
+ ".license",
21735
+ ".bcmap",
21736
+ ".bin",
21737
+ ".symbols"
21731
21738
  ]);
21732
21739
  var PUSH_FILE_SIZE_WARN_BYTES = 2 * 1024 * 1024;
21733
21740
  var PUSH_FILE_SIZE_BLOCK_BYTES = 10 * 1024 * 1024;
@@ -21790,10 +21797,23 @@ function buildAppUrl(params) {
21790
21797
  }
21791
21798
 
21792
21799
  // src/utils/error-handler.ts
21793
- async function createHttpErrorMessage(response, context) {
21800
+ var APPS_SCOPE_PREFIX = "Apps.";
21801
+ function appsServiceHint(status, appsServiceToken) {
21802
+ if (status !== 401 || !appsServiceToken)
21803
+ return;
21804
+ if (resolveSessionIdentity(appsServiceToken)?.type !== "Application") {
21805
+ return;
21806
+ }
21807
+ const scopes = readTokenScopes(appsServiceToken) ?? [];
21808
+ if (scopes.some((scope) => scope.startsWith(APPS_SCOPE_PREFIX))) {
21809
+ return;
21810
+ }
21811
+ return MESSAGES.ERRORS.APPS_SERVICE_APP_TOKEN_HINT;
21812
+ }
21813
+ async function createHttpErrorMessage(response, context, appsServiceToken) {
21794
21814
  const errorText = await response.text();
21795
- const userFriendlyMessage = getHttpErrorMessage(response.status, context);
21796
- let fullMessage = userFriendlyMessage;
21815
+ const hint = appsServiceHint(response.status, appsServiceToken);
21816
+ let fullMessage = hint ? `Authentication failed${context ? ` during ${context.toLowerCase()}` : ""}. ${hint}` : getHttpErrorMessage(response.status, context);
21797
21817
  if (errorText && errorText !== "{}" && errorText.trim() !== "") {
21798
21818
  fullMessage += `
21799
21819
  API Response: ${errorText}`;
@@ -21803,9 +21823,14 @@ HTTP ${response.status}: ${MESSAGES.ERRORS.NO_ERROR_DETAILS}`;
21803
21823
  }
21804
21824
  return fullMessage;
21805
21825
  }
21806
- async function handleHttpError(response, context) {
21807
- const errorMessage = await createHttpErrorMessage(response, context);
21808
- throw new Error(errorMessage);
21826
+ async function handleHttpError(response, context, appsServiceToken) {
21827
+ const errorMessage = await createHttpErrorMessage(response, context, appsServiceToken);
21828
+ const error = new Error(errorMessage);
21829
+ if (appsServiceHint(response.status, appsServiceToken)) {
21830
+ const errorCode = "permission_denied";
21831
+ Object.assign(error, { errorCode });
21832
+ }
21833
+ throw error;
21809
21834
  }
21810
21835
 
21811
21836
  // src/services/deployed-apps.ts
@@ -42943,8 +42968,13 @@ function isPersonalFolder(folder) {
42943
42968
  function matchesWorkspace(folder, personalWorkspace) {
42944
42969
  return personalWorkspace ? isPersonalFolder(folder) : !isPersonalFolder(folder);
42945
42970
  }
42946
- async function fetchFolders(baseUrl, accessToken, orgId, tenantName) {
42947
- const url2 = `${baseUrl}/${orgId}/${tenantName}/orchestrator_/api/Folders/GetAllForCurrentUser`;
42971
+ function sameFolderKey(a, b) {
42972
+ return a.toLowerCase() === b.toLowerCase();
42973
+ }
42974
+ var FOLDER_PAGE_SIZE = 100;
42975
+ var FOLDER_PAGE_LIMIT = 100;
42976
+ async function fetchFolderPage(baseUrl, accessToken, orgId, tenantName, skip) {
42977
+ const url2 = `${baseUrl}/${orgId}/${tenantName}/orchestrator_/api/Folders/GetAllForCurrentUser?take=${FOLDER_PAGE_SIZE}&skip=${skip}`;
42948
42978
  const response = await fetch(url2, {
42949
42979
  headers: createHeaders({ bearerToken: accessToken })
42950
42980
  });
@@ -42953,12 +42983,34 @@ async function fetchFolders(baseUrl, accessToken, orgId, tenantName) {
42953
42983
  }
42954
42984
  const data = await response.json();
42955
42985
  const items = data.PageItems ?? data.value ?? [];
42956
- return items.map((item) => ({
42957
- key: String(item.Key ?? item.key ?? ""),
42958
- displayName: String(item.DisplayName ?? item.displayName ?? ""),
42959
- fullyQualifiedName: String(item.FullyQualifiedName ?? item.fullyQualifiedName ?? ""),
42960
- folderType: String(item.FolderType ?? item.folderType ?? "")
42961
- }));
42986
+ const count = data.Count ?? data.count;
42987
+ return {
42988
+ folders: items.map((item) => ({
42989
+ key: String(item.Key ?? item.key ?? ""),
42990
+ displayName: String(item.DisplayName ?? item.displayName ?? ""),
42991
+ fullyQualifiedName: String(item.FullyQualifiedName ?? item.fullyQualifiedName ?? ""),
42992
+ folderType: String(item.FolderType ?? item.folderType ?? "")
42993
+ })),
42994
+ total: typeof count === "number" ? count : null
42995
+ };
42996
+ }
42997
+ async function fetchFolders(baseUrl, accessToken, orgId, tenantName, stopEarly) {
42998
+ const all = [];
42999
+ for (let page = 0;page < FOLDER_PAGE_LIMIT; page++) {
43000
+ const { folders, total } = await fetchFolderPage(baseUrl, accessToken, orgId, tenantName, all.length);
43001
+ all.push(...folders);
43002
+ if (stopEarly?.(all))
43003
+ break;
43004
+ if (folders.length === 0)
43005
+ break;
43006
+ if (total !== null) {
43007
+ if (all.length >= total)
43008
+ break;
43009
+ } else if (folders.length < FOLDER_PAGE_SIZE) {
43010
+ break;
43011
+ }
43012
+ }
43013
+ return all;
42962
43014
  }
42963
43015
  async function promptFolderSelection(folders, logger2, personalWorkspace) {
42964
43016
  const filtered = personalWorkspace === undefined ? folders : folders.filter((f) => matchesWorkspace(f, personalWorkspace));
@@ -43005,13 +43057,12 @@ async function promptFolderSelection(folders, logger2, personalWorkspace) {
43005
43057
  return selection;
43006
43058
  }
43007
43059
  async function validateExplicitFolderKey(folderKey, personalWorkspace, baseUrl, accessToken, orgId, tenantName) {
43008
- const [fetchErr, folders] = await catchError(fetchFolders(baseUrl, accessToken, orgId, tenantName));
43060
+ const [fetchErr, folders] = await catchError(fetchFolders(baseUrl, accessToken, orgId, tenantName, (gathered) => gathered.some((f) => sameFolderKey(f.key, folderKey))));
43009
43061
  if (fetchErr)
43010
43062
  return;
43011
- const match = folders.find((f) => f.key === folderKey);
43012
- if (!match) {
43013
- throw new Error(`Folder key '${folderKey}' was not found among folders accessible to your account. Re-check the key with 'uip or folders list --output json'.`);
43014
- }
43063
+ const match = folders.find((f) => sameFolderKey(f.key, folderKey));
43064
+ if (!match)
43065
+ return;
43015
43066
  if (!matchesWorkspace(match, personalWorkspace)) {
43016
43067
  const folderKind = isPersonalFolder(match) ? "a Personal Workspace" : "a shared tenant";
43017
43068
  const publishedAs = personalWorkspace ? "into your Personal Workspace" : "into the tenant feed";
@@ -43064,7 +43115,7 @@ async function getDeployedApp(appName, displayTitle, envConfig, legacyAppName) {
43064
43115
  })
43065
43116
  });
43066
43117
  if (!response.ok)
43067
- await handleHttpError(response, MESSAGES.ERROR_CONTEXT.APP_DEPLOYMENT);
43118
+ await handleHttpError(response, MESSAGES.ERROR_CONTEXT.APP_DEPLOYMENT, envConfig.accessToken);
43068
43119
  const data = await response.json();
43069
43120
  const match = data.value.find((app) => searchTerms.includes(app.title));
43070
43121
  if (match)
@@ -43092,7 +43143,7 @@ async function getPublishedAppByName(appName, envConfig, version2) {
43092
43143
  })
43093
43144
  });
43094
43145
  if (!response.ok)
43095
- await handleHttpError(response, MESSAGES.ERROR_CONTEXT.APP_DEPLOYMENT);
43146
+ await handleHttpError(response, MESSAGES.ERROR_CONTEXT.APP_DEPLOYMENT, envConfig.accessToken);
43096
43147
  const data = await response.json();
43097
43148
  const matches = data.value.filter((app) => app.title === appName);
43098
43149
  if (matches.length === 0)
@@ -43118,7 +43169,7 @@ async function getAllPublishedVersions(systemName, envConfig) {
43118
43169
  })
43119
43170
  });
43120
43171
  if (!response.ok)
43121
- await handleHttpError(response, MESSAGES.ERROR_CONTEXT.APP_DEPLOYMENT);
43172
+ await handleHttpError(response, MESSAGES.ERROR_CONTEXT.APP_DEPLOYMENT, envConfig.accessToken);
43122
43173
  const data = await response.json();
43123
43174
  return data.value;
43124
43175
  }
@@ -43168,7 +43219,7 @@ async function deployNewApp(appName, routingName, systemName, deployVersion, env
43168
43219
  body: JSON.stringify(body)
43169
43220
  });
43170
43221
  if (!response.ok)
43171
- await handleHttpError(response, MESSAGES.ERROR_CONTEXT.APP_DEPLOYMENT);
43222
+ await handleHttpError(response, MESSAGES.ERROR_CONTEXT.APP_DEPLOYMENT, envConfig.accessToken);
43172
43223
  const data = await response.json();
43173
43224
  return data.id;
43174
43225
  }
@@ -43241,7 +43292,7 @@ async function upgradeApp(params) {
43241
43292
  if (await waitForUpgradeToLand(params))
43242
43293
  return;
43243
43294
  }
43244
- await handleHttpError(response, MESSAGES.ERROR_CONTEXT.APP_UPGRADE);
43295
+ await handleHttpError(response, MESSAGES.ERROR_CONTEXT.APP_UPGRADE, params.envConfig.accessToken);
43245
43296
  }
43246
43297
  async function updateAppConfig(update, logger2) {
43247
43298
  const fsys = getFileSystem();
@@ -43529,7 +43580,8 @@ var registerDeployCommand = (program) => {
43529
43580
  OutputFormatter.error({
43530
43581
  Result: RESULTS.Failure,
43531
43582
  Message: "Deploy failed",
43532
- Instructions: error52.message
43583
+ Instructions: error52.message,
43584
+ ErrorCode: carriedErrorCode(error52)
43533
43585
  });
43534
43586
  processContext.exit(1);
43535
43587
  return;
@@ -43777,7 +43829,7 @@ function querystringSingleKey(key, value, keyPrefix = "") {
43777
43829
  var package_default2 = {
43778
43830
  name: "@uipath/solution-sdk",
43779
43831
  license: "SEE LICENSE IN LICENSE.txt",
43780
- version: "1.202.1",
43832
+ version: "1.202.1-preview.238",
43781
43833
  repository: {
43782
43834
  type: "git",
43783
43835
  url: "https://github.com/UiPath/cli.git",
@@ -44076,7 +44128,7 @@ var SUCCEEDED = "creationsucceeded";
44076
44128
  var TERMINAL = new Set([SUCCEEDED, "creationfailed", "validationfailed"]);
44077
44129
  // src/services/project-artifacts.ts
44078
44130
  async function ensureProjectArtifacts(args) {
44079
- const { addProjectArtifactsToSolutionAsync } = await import("./index-qy2v9fh9.js");
44131
+ const { addProjectArtifactsToSolutionAsync } = await import("./index-g2tmj55j.js");
44080
44132
  return addProjectArtifactsToSolutionAsync(args);
44081
44133
  }
44082
44134
 
@@ -45077,7 +45129,7 @@ async function registerCodedApp(metadata, envConfig, isActionApp, feedId, logger
45077
45129
  body: JSON.stringify(payload)
45078
45130
  });
45079
45131
  if (!response.ok) {
45080
- await handleHttpError(response, MESSAGES.ERROR_CONTEXT.CODED_APP_REGISTRATION);
45132
+ await handleHttpError(response, MESSAGES.ERROR_CONTEXT.CODED_APP_REGISTRATION, envConfig.accessToken);
45081
45133
  }
45082
45134
  return await response.json();
45083
45135
  }
@@ -45369,7 +45421,7 @@ var registerPublishCommand = (program) => {
45369
45421
  const failure = await extractErrorDetails(error52);
45370
45422
  OutputFormatter.error({
45371
45423
  Result: RESULTS.Failure,
45372
- ErrorCode: failure.errorCode,
45424
+ ErrorCode: carriedErrorCode(error52) ?? failure.errorCode,
45373
45425
  Message: `Publish failed: ${failure.message}`,
45374
45426
  Instructions: describeConnectivityError(error52)?.instructions ?? failure.details,
45375
45427
  Retry: failure.retry,
@@ -48069,7 +48121,7 @@ async function promptCreateNewSolution(envConfig, logger2) {
48069
48121
  async function persistProjectId(projectId, logger2) {
48070
48122
  const fs = getFileSystem();
48071
48123
  const [saveErr] = await catchError((async () => {
48072
- const { saveEnvFileAsync } = await import("./index-7zbv11qn.js");
48124
+ const { saveEnvFileAsync } = await import("./index-5add4qh9.js");
48073
48125
  const localEnvPath = fs.path.join(fs.env.cwd(), ".env");
48074
48126
  await saveEnvFileAsync({
48075
48127
  envPath: localEnvPath,
@@ -48416,4 +48468,4 @@ var registerCommands = async (program) => {
48416
48468
 
48417
48469
  export { metadata, registerCommands };
48418
48470
 
48419
- //# debugId=0E03175F143C562964756E2164756E21
48471
+ //# debugId=56632591276400C764756E2164756E21
@@ -4170,6 +4170,12 @@ function isCliErrorCode(value) {
4170
4170
  function isRetryHint(value) {
4171
4171
  return typeof value === "string" && RETRY_HINT_VALUES.has(value);
4172
4172
  }
4173
+ function carriedErrorCode(error) {
4174
+ if (!error || typeof error !== "object")
4175
+ return;
4176
+ const code = error.errorCode;
4177
+ return isCliErrorCode(code) ? code : undefined;
4178
+ }
4173
4179
  var RESULTS = {
4174
4180
  Success: "Success",
4175
4181
  Failure: "Failure",
@@ -4549,7 +4555,165 @@ class ConfigurationError extends Error {
4549
4555
  function isConfigurationError(error) {
4550
4556
  return typeof error === "object" && error !== null && "__brand" in error && error.__brand === "ConfigurationError";
4551
4557
  }
4552
- function applyFilter(data, filter) {
4558
+ function countRecords(data) {
4559
+ if (Array.isArray(data))
4560
+ return data.length;
4561
+ return data == null ? 0 : 1;
4562
+ }
4563
+ function availableFields(data) {
4564
+ const records = Array.isArray(data) ? data : [data];
4565
+ const keys = new Set;
4566
+ for (const record of records) {
4567
+ if (record && typeof record === "object" && !Array.isArray(record)) {
4568
+ for (const key of Object.keys(record))
4569
+ keys.add(key);
4570
+ }
4571
+ }
4572
+ return [...keys];
4573
+ }
4574
+ function decodeQuotedIdentifier(whole, inner) {
4575
+ const [error, decoded] = catchError(() => JSON.parse(whole));
4576
+ if (!error && typeof decoded === "string")
4577
+ return decoded;
4578
+ return inner.replace(/\\(.)/g, "$1");
4579
+ }
4580
+ function referencedFields(filter) {
4581
+ const top = new Set;
4582
+ const nested = new Set;
4583
+ const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
4584
+ const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
4585
+ const quoted = [];
4586
+ const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
4587
+ const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
4588
+ if (!isAlias) {
4589
+ quoted.push({
4590
+ name: decodeQuotedIdentifier(whole, name),
4591
+ index,
4592
+ tail: isPathTail(withoutValueLiterals, index)
4593
+ });
4594
+ }
4595
+ return `"${" ".repeat(whole.length - 2)}"`;
4596
+ });
4597
+ const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
4598
+ const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
4599
+ const place = (name, index, tail) => {
4600
+ if (tail || index >= rootEnd)
4601
+ nested.add(name);
4602
+ else
4603
+ top.add(name);
4604
+ };
4605
+ for (const entry of quoted)
4606
+ place(entry.name, entry.index, entry.tail);
4607
+ const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
4608
+ const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
4609
+ for (const match of identifiers) {
4610
+ const [, name, trailing] = match;
4611
+ if (trailing || reserved.has(name))
4612
+ continue;
4613
+ place(name, match.index, isPathTail(withoutLiterals, match.index));
4614
+ }
4615
+ return {
4616
+ top: [...top],
4617
+ nested: [...nested].filter((name) => !top.has(name)),
4618
+ hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
4619
+ };
4620
+ }
4621
+ function appearsBelowTopLevel(data, name) {
4622
+ let budget = 2000;
4623
+ const visit = (value, depth) => {
4624
+ if (budget-- <= 0 || depth > 4)
4625
+ return false;
4626
+ if (value === null || typeof value !== "object")
4627
+ return false;
4628
+ if (Array.isArray(value))
4629
+ return value.some((entry) => visit(entry, depth));
4630
+ const record = value;
4631
+ if (depth > 0 && Object.hasOwn(record, name))
4632
+ return true;
4633
+ return Object.values(record).some((entry) => visit(entry, depth + 1));
4634
+ };
4635
+ return visit(data, 0);
4636
+ }
4637
+ function alwaysNullKeys(records) {
4638
+ const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
4639
+ if (objects.length === 0 || objects.length !== records.length)
4640
+ return [];
4641
+ const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
4642
+ if (keys.length === 0)
4643
+ return [];
4644
+ const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
4645
+ return nullKeys.length === keys.length ? nullKeys : [];
4646
+ }
4647
+ function carriesOnlyNulls(value) {
4648
+ if (value === null)
4649
+ return true;
4650
+ if (Array.isArray(value)) {
4651
+ return value.length > 0 && value.every(carriesOnlyNulls);
4652
+ }
4653
+ if (typeof value === "object" && value !== undefined) {
4654
+ const values = Object.values(value);
4655
+ return values.length > 0 && values.every(carriesOnlyNulls);
4656
+ }
4657
+ return false;
4658
+ }
4659
+ function nameList(names, cap2 = 12) {
4660
+ const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
4661
+ const rest = names.length - shown.length;
4662
+ return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
4663
+ }
4664
+ function buildFilterWarning(filter, data, outcome) {
4665
+ const present = availableFields(data);
4666
+ const refs = referencedFields(filter);
4667
+ const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
4668
+ const unchecked = refs.nested.filter((name) => !present.includes(name));
4669
+ const count = countRecords(data);
4670
+ const scope = `${count} record(s)`;
4671
+ const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
4672
+ const soundness = unchecked.length > 0 ? `${nameList(unchecked)} ${unchecked.length === 1 ? "reads" : "read"} below the top level, so ${unchecked.length === 1 ? "it was" : "they were"} not checked against the record keys` : refs.top.length > 0 ? "every field it names exists" : "";
4673
+ const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
4674
+ let detail;
4675
+ let lede;
4676
+ if (outcome.kind === "null-elements") {
4677
+ lede = "returned only null values";
4678
+ const projected = `all ${outcome.count} of the elements it projected are null`;
4679
+ if (unknown.length > 0) {
4680
+ detail = `${projected}, because ${isNotAField(unknown)}`;
4681
+ } else if (unchecked.length > 0) {
4682
+ detail = withSoundness(projected);
4683
+ } else {
4684
+ detail = `${projected}, and every field it names exists — a multi-select list ` + `(\`[A, B]\`) reads each entry against \`Data\` itself, so on a list ` + `result use \`[].[A, B]\` or \`[].{a: A, b: B}\` to read the records`;
4685
+ }
4686
+ } else if (outcome.kind === "null-rows") {
4687
+ lede = "returned only null values";
4688
+ const projected = `every value it projected is null on all ${outcome.count} row(s)`;
4689
+ detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
4690
+ } else if (outcome.kind === "null-values") {
4691
+ lede = "returned only null values";
4692
+ const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
4693
+ const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
4694
+ if (sameSet) {
4695
+ detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
4696
+ } else if (unknown.length > 0) {
4697
+ detail = `${projected}, because ${isNotAField(unknown)}`;
4698
+ } else {
4699
+ detail = withSoundness(`${projected} on all ${scope}`);
4700
+ }
4701
+ } else {
4702
+ lede = "returned nothing";
4703
+ if (unknown.length > 0) {
4704
+ detail = isNotAField(unknown);
4705
+ } else {
4706
+ const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
4707
+ detail = withSoundness(`${selection} — it read ${scope}`);
4708
+ }
4709
+ }
4710
+ const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
4711
+ return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
4712
+ }
4713
+ function appendWarning(existing, note) {
4714
+ return existing ? `${existing} ${note}` : note;
4715
+ }
4716
+ function applyFilter(data, filter, onWarning) {
4553
4717
  const codec = requireJmespath();
4554
4718
  let result;
4555
4719
  try {
@@ -4557,9 +4721,34 @@ function applyFilter(data, filter) {
4557
4721
  } catch (err) {
4558
4722
  throw new FilterEvaluationError(filter, err);
4559
4723
  }
4560
- if (result == null)
4724
+ const inputCount = countRecords(data);
4725
+ const warn = (outcome) => {
4726
+ if (inputCount === 0)
4727
+ return;
4728
+ const note = buildFilterWarning(filter, data, outcome);
4729
+ getOutputSink().writeErr(`[WARN] ${note}
4730
+ `);
4731
+ onWarning?.(note);
4732
+ };
4733
+ const warnIfAllNull = (records) => {
4734
+ const keys = alwaysNullKeys(records);
4735
+ if (keys.length > 0)
4736
+ warn({ kind: "null-values", keys });
4737
+ };
4738
+ if (result == null) {
4739
+ warn({ kind: "empty" });
4561
4740
  return [];
4741
+ }
4562
4742
  if (Array.isArray(result)) {
4743
+ if (result.length === 0) {
4744
+ warn({ kind: "empty" });
4745
+ } else if (result.every((entry) => entry === null)) {
4746
+ warn({ kind: "null-elements", count: result.length });
4747
+ } else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
4748
+ warn({ kind: "null-rows", count: result.length });
4749
+ } else {
4750
+ warnIfAllNull(result);
4751
+ }
4563
4752
  if (result.length > 0 && typeof result[0] !== "object") {
4564
4753
  const fieldMatch = filter.match(/\.(\w+)$/);
4565
4754
  const key = fieldMatch ? fieldMatch[1] : "Value";
@@ -4567,10 +4756,30 @@ function applyFilter(data, filter) {
4567
4756
  }
4568
4757
  return result;
4569
4758
  }
4570
- if (typeof result === "object")
4759
+ if (typeof result === "object") {
4760
+ warnIfAllNull([result]);
4571
4761
  return result;
4762
+ }
4572
4763
  return { Value: result };
4573
4764
  }
4765
+ function filterFailureData(envelope) {
4766
+ const filter = getOutputFilter();
4767
+ const data = envelope.Data;
4768
+ if (!filter || data == null)
4769
+ return;
4770
+ let note;
4771
+ const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
4772
+ note = n;
4773
+ }));
4774
+ if (filterError) {
4775
+ envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
4776
+ return;
4777
+ }
4778
+ envelope.Data = filtered;
4779
+ if (note) {
4780
+ envelope.Warning = appendWarning(envelope.Warning, note);
4781
+ }
4782
+ }
4574
4783
  function defaultErrorCodeForResult(result) {
4575
4784
  switch (result) {
4576
4785
  case RESULTS.AuthenticationError:
@@ -4653,8 +4862,14 @@ var OutputFormatter;
4653
4862
  }
4654
4863
  const filter = getOutputFilter();
4655
4864
  if (filter) {
4656
- const filtered = applyFilter(data.Data, filter);
4865
+ let note;
4866
+ const filtered = applyFilter(data.Data, filter, (n) => {
4867
+ note = n;
4868
+ });
4657
4869
  data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
4870
+ if (note) {
4871
+ data.Warning = appendWarning(data.Warning, note);
4872
+ }
4658
4873
  }
4659
4874
  logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
4660
4875
  }
@@ -4682,6 +4897,7 @@ var OutputFormatter;
4682
4897
  delete envelope.TelemetryErrorClass;
4683
4898
  delete envelope.TelemetryTerminalOutcome;
4684
4899
  delete envelope.TelemetryTerminalSignal;
4900
+ filterFailureData(envelope);
4685
4901
  if (!suppressTelemetry) {
4686
4902
  telemetry.trackEvent(CommonTelemetryEvents.Error, {
4687
4903
  result: data.Result,
@@ -4730,13 +4946,20 @@ var OutputFormatter;
4730
4946
  OutputFormatter.log = log;
4731
4947
  function formatToString(data) {
4732
4948
  const filter = getOutputFilter();
4949
+ const envelope = data;
4733
4950
  if ("Data" in data && data.Data != null) {
4734
4951
  data.Data = normalizeDataKeys(data.Data);
4735
4952
  if (filter) {
4736
- data.Data = normalizeDataKeys(applyFilter(data.Data, filter));
4953
+ let note;
4954
+ data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
4955
+ note = n;
4956
+ }));
4957
+ if (note) {
4958
+ envelope.Warning = appendWarning(envelope.Warning, note);
4959
+ }
4737
4960
  }
4738
4961
  }
4739
- const output = normalizeOutputKeys(data);
4962
+ const output = normalizeOutputKeys(envelope);
4740
4963
  const lines = [];
4741
4964
  const sink = getOutputSink();
4742
4965
  printOutput(output, getOutputFormat(), (msg) => {
@@ -5948,6 +6171,6 @@ async function findSolutionFileUpward(fs, startDir) {
5948
6171
  }
5949
6172
  }
5950
6173
 
5951
- export { catchError, describeConnectivityError, extractErrorDetails, extractErrorMessage, getOutputSink, logger, RESULTS, EXIT_CODES, ConfigurationError, isConfigurationError, OutputFormatter, InvalidArgumentError, Command, Option, processContext, requireConfirmation, isGuid, canPrompt, registerPackageMetadataOptions, mapPackageMetadataOptions, getSdkUserAgentToken, addSdkUserAgentHeader, installSdkUserAgentHeader, trackShipSucceeded, normalizeProjectType, tryRegisterProjectInParentSolution, findNearestParentUipxFile, findSolutionFileUpward };
6174
+ export { catchError, describeConnectivityError, extractErrorDetails, extractErrorMessage, getOutputSink, logger, carriedErrorCode, RESULTS, EXIT_CODES, ConfigurationError, isConfigurationError, OutputFormatter, InvalidArgumentError, Command, Option, processContext, requireConfirmation, isGuid, canPrompt, registerPackageMetadataOptions, mapPackageMetadataOptions, getSdkUserAgentToken, addSdkUserAgentHeader, installSdkUserAgentHeader, trackShipSucceeded, normalizeProjectType, tryRegisterProjectInParentSolution, findNearestParentUipxFile, findSolutionFileUpward };
5952
6175
 
5953
- //# debugId=221D447EF9BC866A64756E2164756E21
6176
+ //# debugId=9C26377B6BB841D564756E2164756E21
@@ -698,6 +698,12 @@ var resolveSessionIdentity = (accessToken, authFlow) => {
698
698
  identity.clientId = clientId;
699
699
  return identity;
700
700
  };
701
+ var pickScopes = (claims) => {
702
+ const raw = claims?.scope;
703
+ const scopes = Array.isArray(raw) ? raw.filter((entry) => asString(entry) !== undefined) : typeof raw === "string" ? raw.split(/\s+/).filter(Boolean) : [];
704
+ return scopes.length > 0 ? scopes : undefined;
705
+ };
706
+ var readTokenScopes = (accessToken) => accessToken ? pickScopes(decodeClaims(accessToken)) : undefined;
701
707
 
702
708
  // ../auth/src/envAuth.ts
703
709
  var ENV_AUTH_ENABLE_VAR = "UIPATH_CLI_ENABLE_ENV_AUTH";
@@ -2320,6 +2326,6 @@ var authenticate = async ({
2320
2326
  });
2321
2327
  };
2322
2328
 
2323
- export { setAuthFileConfig, InvalidBaseUrlError, DEFAULT_AUTH_PROFILE, AuthProfileValidationError, normalizeAuthProfileName, setActiveAuthProfile, clearActiveAuthProfile, getActiveAuthProfile, runWithAuthProfile, resolveAuthProfileFilePath, getActiveAuthProfileFilePath, parseJWT, parseAuthFlow, resolveSessionIdentity, ENV_AUTH_ENABLE_VAR, ENFORCE_ROBOT_AUTH_VAR, ENV_AUTH_VARS, EnvAuthConfigError, isEnvAuthEnabled, isRobotAuthEnforced, readAuthFromEnv, refreshTokenFingerprint, loadRefreshBreaker, saveRefreshBreaker, clearRefreshBreaker, registerRobotClientLoader, TokenRefreshOAuthError, isTokenRefreshOAuthFailure, refreshAccessToken, AUTH_FLOW_ENV_VAR, DEFAULT_AUTH_FILENAME, DEFAULT_ENV_FILENAME, resolveEnvFileLocationAsync, resolveEnvFilePathAsync, loadEnvFileAsync, saveEnvFileAsync, CredentialSource, getLoginStatusAsync, getLoginStatusWithDeps, getAuthContext, getAuthEnv, ClientCredentialsAuthenticationError, clientCredentialsLogin, JWT_BEARER_ASSERTION_TYPE, FederatedCredentialsAuthenticationError, federatedCredentialsLogin, fetchTenantsAndOrganizations, TENANT_SELECTION_REQUIRED_CODE, INVALID_TENANT_CODE, TenantSelectionError, TenantSelectionRequiredError, InvalidTenantError, isTenantSelectionError, selectTenantWithDeps, interactiveLoginWithDeps, interactiveLogin, logoutWithDeps, logout, authenticate };
2329
+ export { setAuthFileConfig, InvalidBaseUrlError, DEFAULT_AUTH_PROFILE, AuthProfileValidationError, normalizeAuthProfileName, setActiveAuthProfile, clearActiveAuthProfile, getActiveAuthProfile, runWithAuthProfile, resolveAuthProfileFilePath, getActiveAuthProfileFilePath, parseJWT, parseAuthFlow, resolveSessionIdentity, readTokenScopes, ENV_AUTH_ENABLE_VAR, ENFORCE_ROBOT_AUTH_VAR, ENV_AUTH_VARS, EnvAuthConfigError, isEnvAuthEnabled, isRobotAuthEnforced, readAuthFromEnv, refreshTokenFingerprint, loadRefreshBreaker, saveRefreshBreaker, clearRefreshBreaker, registerRobotClientLoader, TokenRefreshOAuthError, isTokenRefreshOAuthFailure, refreshAccessToken, AUTH_FLOW_ENV_VAR, DEFAULT_AUTH_FILENAME, DEFAULT_ENV_FILENAME, resolveEnvFileLocationAsync, resolveEnvFilePathAsync, loadEnvFileAsync, saveEnvFileAsync, CredentialSource, getLoginStatusAsync, getLoginStatusWithDeps, getAuthContext, getAuthEnv, ClientCredentialsAuthenticationError, clientCredentialsLogin, JWT_BEARER_ASSERTION_TYPE, FederatedCredentialsAuthenticationError, federatedCredentialsLogin, fetchTenantsAndOrganizations, TENANT_SELECTION_REQUIRED_CODE, INVALID_TENANT_CODE, TenantSelectionError, TenantSelectionRequiredError, InvalidTenantError, isTenantSelectionError, selectTenantWithDeps, interactiveLoginWithDeps, interactiveLogin, logoutWithDeps, logout, authenticate };
2324
2330
 
2325
- //# debugId=3D2BACA7964D278C64756E2164756E21
2331
+ //# debugId=4A2C2EA2558C1B7A64756E2164756E21
package/dist/tool.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  metadata,
3
3
  registerCommands
4
- } from "./packager-tool-npxwr0xj.js";
5
- import"./packager-tool-ckanbe2q.js";
6
- import"./packager-tool-pvtdkdk8.js";
4
+ } from "./packager-tool-a6843kt5.js";
5
+ import"./packager-tool-k20swr78.js";
6
+ import"./packager-tool-v4meqsaj.js";
7
7
  import"./packager-tool-05wez2xw.js";
8
8
  import"./packager-tool-aybzcdfg.js";
9
9
  import"./packager-tool-0gctz400.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/codedapp-tool",
3
3
  "license": "SEE LICENSE IN LICENSE.txt",
4
- "version": "1.202.2",
4
+ "version": "1.202.3-preview.238",
5
5
  "description": "Build, pack, publish, deploy, and manage UiPath Coded Web Applications.",
6
6
  "keywords": [
7
7
  "cli-tool",
@@ -28,5 +28,5 @@
28
28
  "publishConfig": {
29
29
  "registry": "https://registry.npmjs.org/"
30
30
  },
31
- "gitHead": "a783d71f93c1ba5f1f77ad26ffddcc32f52c1199"
31
+ "gitHead": "537e43df1d3583633cfd3a0b88634f9ce3ba9d6b"
32
32
  }