@uipath/codedapp-tool 1.204.1-preview.254 → 1.205.0-preview.256
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.
- package/dist/THIRD-PARTY-NOTICES.md +2 -2
- package/dist/{embedded-file-reader-v8c2yj2a.js → embedded-file-reader-r66242ey.js} +2 -2
- package/dist/{index-wj8fy4z0.js → index-0k30knwv.js} +1138 -2077
- package/dist/index-78bnpdqb.js +3177 -0
- package/dist/{index-y32y7rjh.js → index-wbp18pm0.js} +2 -2
- package/dist/index.js +8 -7
- package/dist/{node-strategy-0267x5e5.js → node-strategy-myagr1zp.js} +1 -1
- package/dist/packager-tool-5ebgtev7.js +22083 -0
- package/dist/{packager-tool-cfc7qtm7.js → packager-tool-cmfktvbt.js} +183 -1970
- package/dist/packager-tool-d94wjncg.js +1814 -0
- package/dist/{packager-tool-t6b34p5f.js → packager-tool-gbp9jdy5.js} +1679 -264
- package/dist/{packager-tool-0v3s8r01.js → packager-tool-je2re4j6.js} +11 -1
- package/dist/{packager-tool-cakm5nqb.js → packager-tool-pxqgvv15.js} +159 -45
- package/dist/{packager-tool-nd0vpsgx.js → packager-tool-s8h46737.js} +124 -58
- package/dist/{packager-tool-zzg1ddjd.js → packager-tool-vc19fcdp.js} +4 -3
- package/dist/packager-tool.js +5 -4
- package/dist/tool.js +8 -7
- package/package.json +5 -2
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
import {
|
|
2
2
|
findNearestParentUipxFile,
|
|
3
3
|
tryRegisterProjectInParentSolution
|
|
4
|
-
} from "./packager-tool-
|
|
4
|
+
} from "./packager-tool-vc19fcdp.js";
|
|
5
5
|
import {
|
|
6
6
|
getLoginStatusAsync,
|
|
7
7
|
readTokenScopes,
|
|
8
8
|
resolveSessionIdentity
|
|
9
|
-
} from "./packager-tool-
|
|
9
|
+
} from "./packager-tool-s8h46737.js";
|
|
10
10
|
import {
|
|
11
11
|
ACTION_SCHEMA_FILE_NAME,
|
|
12
|
+
ERROR_MESSAGES,
|
|
13
|
+
HTML_ENTRY_POINT_CANDIDATES,
|
|
12
14
|
WEBAPP_MANIFEST_FILE_NAME,
|
|
13
15
|
WebAppToolFactory,
|
|
16
|
+
isActionApp,
|
|
17
|
+
isBundleRelativePath,
|
|
18
|
+
isCanonicalBundleChild,
|
|
19
|
+
isHtmlEntryPointPath,
|
|
20
|
+
normalizeBundlePath,
|
|
14
21
|
parseActionSchema,
|
|
15
22
|
readProjectName,
|
|
23
|
+
resolveHtmlEntryPoint,
|
|
16
24
|
validateActionSchema
|
|
17
|
-
} from "./packager-tool-
|
|
25
|
+
} from "./packager-tool-pxqgvv15.js";
|
|
18
26
|
import {
|
|
19
27
|
CommandDimensions,
|
|
20
28
|
ConfigurationError,
|
|
@@ -36,15 +44,17 @@ import {
|
|
|
36
44
|
isGuid,
|
|
37
45
|
logger,
|
|
38
46
|
mapPackageMetadataOptions,
|
|
47
|
+
pascalCaseDataKeys,
|
|
39
48
|
processContext,
|
|
49
|
+
quoteForShell,
|
|
40
50
|
registerPackageMetadataOptions,
|
|
41
51
|
requireConfirmation,
|
|
42
52
|
telemetry,
|
|
43
53
|
trackShipSucceeded
|
|
44
|
-
} from "./packager-tool-
|
|
54
|
+
} from "./packager-tool-cmfktvbt.js";
|
|
45
55
|
import {
|
|
46
56
|
getFileSystem
|
|
47
|
-
} from "./packager-tool-
|
|
57
|
+
} from "./packager-tool-je2re4j6.js";
|
|
48
58
|
import {
|
|
49
59
|
__commonJS,
|
|
50
60
|
__export,
|
|
@@ -20628,7 +20638,7 @@ var package_default = {
|
|
|
20628
20638
|
name: "@uipath/codedapp-tool",
|
|
20629
20639
|
author: "UiPath",
|
|
20630
20640
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
20631
|
-
version: "1.
|
|
20641
|
+
version: "1.205.0-preview.256",
|
|
20632
20642
|
description: "Build, pack, publish, deploy, and manage UiPath Coded Web Applications.",
|
|
20633
20643
|
keywords: [
|
|
20634
20644
|
"cli-tool",
|
|
@@ -20667,18 +20677,302 @@ var package_default = {
|
|
|
20667
20677
|
"@uipath/auth": "workspace:*",
|
|
20668
20678
|
"@uipath/common": "workspace:*",
|
|
20669
20679
|
"@uipath/filesystem": "workspace:*",
|
|
20680
|
+
"@uipath/orchestrator-sdk": "workspace:*",
|
|
20670
20681
|
"@uipath/packager-tool-webapp": "workspace:*",
|
|
20671
20682
|
"@uipath/solution-sdk": "workspace:*",
|
|
20672
20683
|
"@uipath/solutionpackager-tool-core": "workspace:*",
|
|
20673
20684
|
"@types/bun": "^1.3.11",
|
|
20674
20685
|
chalk: "^5.3.0",
|
|
20675
20686
|
commander: "^14.0.3",
|
|
20687
|
+
fflate: "^0.8.2",
|
|
20676
20688
|
ignore: "^5.3.2",
|
|
20677
20689
|
inquirer: "^12.9.6",
|
|
20678
20690
|
ora: "^9.3.0",
|
|
20679
20691
|
typescript: "^7.0.2",
|
|
20680
20692
|
zod: "^4.3.6"
|
|
20693
|
+
},
|
|
20694
|
+
optionalDependencies: {
|
|
20695
|
+
"@uipath/codedapp-convert-sdk": "0.1.0-beta.2"
|
|
20696
|
+
}
|
|
20697
|
+
};
|
|
20698
|
+
|
|
20699
|
+
// src/actions/convert.ts
|
|
20700
|
+
import { pathToFileURL } from "node:url";
|
|
20701
|
+
var CONVERT_SDK_PACKAGE = "@uipath/codedapp-convert-sdk";
|
|
20702
|
+
var CONVERT_SDK_DIST_TAG = "beta";
|
|
20703
|
+
var CONVERT_SDK_INSTALL = `uip tools install codedapp (reinstalls the tool together with the SDK it ships), or install the SDK beside the tool: npm install -g ${CONVERT_SDK_PACKAGE}@${CONVERT_SDK_DIST_TAG} (without -g for a project-local CLI)`;
|
|
20704
|
+
var CONVERT_SDK_OVERRIDE_ENV = "UIP_CODEDAPP_CONVERT_SDK";
|
|
20705
|
+
var CONVERT_ERROR = {
|
|
20706
|
+
FILE_REQUIRED: "CONVERT_FILE_REQUIRED",
|
|
20707
|
+
FILE_NOT_FOUND: "CONVERT_FILE_NOT_FOUND",
|
|
20708
|
+
UNSUPPORTED_TYPE: "CONVERT_UNSUPPORTED_TYPE",
|
|
20709
|
+
NOT_A_DIRECTORY: "CONVERT_NOT_A_DIRECTORY",
|
|
20710
|
+
DIR_NOT_EMPTY: "CONVERT_DIR_NOT_EMPTY",
|
|
20711
|
+
SDK_UNAVAILABLE: "CONVERT_SDK_UNAVAILABLE",
|
|
20712
|
+
PREREQUISITE_MISSING: "CONVERT_PREREQUISITE_MISSING",
|
|
20713
|
+
INPUT_REJECTED: "CONVERT_INPUT_REJECTED",
|
|
20714
|
+
OUT_EMPTY: "CONVERT_OUT_EMPTY"
|
|
20715
|
+
};
|
|
20716
|
+
|
|
20717
|
+
class ConvertError extends Error {
|
|
20718
|
+
code;
|
|
20719
|
+
instructions;
|
|
20720
|
+
constructor(code, message, instructions) {
|
|
20721
|
+
super(message);
|
|
20722
|
+
this.code = code;
|
|
20723
|
+
this.instructions = instructions;
|
|
20724
|
+
this.name = "ConvertError";
|
|
20725
|
+
}
|
|
20726
|
+
}
|
|
20727
|
+
function skillInstallCommand(outDir, source) {
|
|
20728
|
+
const fs = getFileSystem();
|
|
20729
|
+
const rel = fs.path.relative(outDir, source).split(/[\\/]/).join("/");
|
|
20730
|
+
return `uip skills install --repo ./${rel} --path .`;
|
|
20731
|
+
}
|
|
20732
|
+
function outcomeOf(converted) {
|
|
20733
|
+
if (converted.blocking > 0 || converted.syntaxProblems.length > 0) {
|
|
20734
|
+
return "cannot-run";
|
|
20735
|
+
}
|
|
20736
|
+
const gaps = converted.report.converter + converted.unconverted.expressions + converted.unconverted.eventHandlers;
|
|
20737
|
+
return gaps > 0 ? "converted-with-gaps" : "converted";
|
|
20738
|
+
}
|
|
20739
|
+
var isInputRejection = (error) => error instanceof Error && error.name === "ConversionInputError";
|
|
20740
|
+
async function loadConverterSdk(importModule = (s) => import(s)) {
|
|
20741
|
+
const override = process.env[CONVERT_SDK_OVERRIDE_ENV];
|
|
20742
|
+
const specifier = override ? pathToFileURL(getFileSystem().path.resolve(override)).href : CONVERT_SDK_PACKAGE;
|
|
20743
|
+
try {
|
|
20744
|
+
const sdk = await importModule(specifier);
|
|
20745
|
+
if (typeof sdk.convertFile !== "function" || typeof sdk.detectAppKind !== "function" || typeof sdk.checkPrerequisites !== "function") {
|
|
20746
|
+
throw new Error(`'${specifier}' does not export the converter SDK`);
|
|
20747
|
+
}
|
|
20748
|
+
return sdk;
|
|
20749
|
+
} catch (error) {
|
|
20750
|
+
throw new ConvertError(CONVERT_ERROR.SDK_UNAVAILABLE, `The converter SDK could not be loaded from '${specifier}': ${error.message}`, override ? `Point ${CONVERT_SDK_OVERRIDE_ENV} at the SDK's built dist/index.js, or unset it to use the installed ${CONVERT_SDK_PACKAGE}.` : `Run ${CONVERT_SDK_INSTALL}.`);
|
|
20751
|
+
}
|
|
20752
|
+
}
|
|
20753
|
+
function extensionOf(file) {
|
|
20754
|
+
const base = getFileSystem().path.basename(file);
|
|
20755
|
+
const dot = base.lastIndexOf(".");
|
|
20756
|
+
return dot > 0 ? base.slice(dot) : "";
|
|
20757
|
+
}
|
|
20758
|
+
function defaultOutputDir(file, cwd) {
|
|
20759
|
+
const fs = getFileSystem();
|
|
20760
|
+
return fs.path.resolve(cwd, fs.path.basename(file, extensionOf(file)));
|
|
20761
|
+
}
|
|
20762
|
+
async function checkOutputDir(out, force) {
|
|
20763
|
+
const fs = getFileSystem();
|
|
20764
|
+
const stat = await fs.stat(out);
|
|
20765
|
+
if (stat === null)
|
|
20766
|
+
return;
|
|
20767
|
+
if (!stat.isDirectory()) {
|
|
20768
|
+
throw new ConvertError(CONVERT_ERROR.NOT_A_DIRECTORY, `Output path '${out}' exists and is not a directory.`);
|
|
20769
|
+
}
|
|
20770
|
+
if ((await fs.readdir(out)).length > 0 && !force) {
|
|
20771
|
+
throw new ConvertError(CONVERT_ERROR.DIR_NOT_EMPTY, `Output directory '${out}' is not empty.`);
|
|
20772
|
+
}
|
|
20773
|
+
}
|
|
20774
|
+
async function executeConvert(options, sdkLoader = loadConverterSdk) {
|
|
20775
|
+
const fs = getFileSystem();
|
|
20776
|
+
const cwd = options.cwd ?? fs.env.cwd();
|
|
20777
|
+
if (!options.file?.trim()) {
|
|
20778
|
+
throw new ConvertError(CONVERT_ERROR.FILE_REQUIRED, "An exported app file is required.");
|
|
20779
|
+
}
|
|
20780
|
+
const file = fs.path.resolve(cwd, options.file);
|
|
20781
|
+
if (extensionOf(file).toLowerCase() !== ".uiapp") {
|
|
20782
|
+
throw new ConvertError(CONVERT_ERROR.UNSUPPORTED_TYPE, `'${options.file}' is not an Apps export: expected a .uiapp file.`);
|
|
20783
|
+
}
|
|
20784
|
+
const fileStat = await fs.stat(file);
|
|
20785
|
+
if (fileStat === null || !fileStat.isFile()) {
|
|
20786
|
+
throw new ConvertError(CONVERT_ERROR.FILE_NOT_FOUND, `'${options.file}' was not found.`);
|
|
20787
|
+
}
|
|
20788
|
+
if (options.out !== undefined && options.out.trim() === "") {
|
|
20789
|
+
throw new ConvertError(CONVERT_ERROR.OUT_EMPTY, "--out was given but is empty.");
|
|
20790
|
+
}
|
|
20791
|
+
if (options.out === undefined) {
|
|
20792
|
+
const stem = fs.path.basename(file, extensionOf(file));
|
|
20793
|
+
if (stem === "." || stem === "..") {
|
|
20794
|
+
throw new ConvertError(CONVERT_ERROR.OUT_EMPTY, `'${fs.path.basename(file)}' leaves no directory name to convert into.`);
|
|
20795
|
+
}
|
|
20796
|
+
}
|
|
20797
|
+
const out = options.out === undefined ? defaultOutputDir(file, cwd) : fs.path.resolve(cwd, options.out);
|
|
20798
|
+
await checkOutputDir(out, options.force);
|
|
20799
|
+
const sdk = await sdkLoader();
|
|
20800
|
+
const ready = sdk.checkPrerequisites();
|
|
20801
|
+
if (!ready.ok) {
|
|
20802
|
+
throw new ConvertError(CONVERT_ERROR.PREREQUISITE_MISSING, ready.message, ready.instructions);
|
|
20803
|
+
}
|
|
20804
|
+
let converted;
|
|
20805
|
+
try {
|
|
20806
|
+
converted = await sdk.convertFile({
|
|
20807
|
+
input: file,
|
|
20808
|
+
outDir: out,
|
|
20809
|
+
noCache: options.noCache,
|
|
20810
|
+
quiet: true,
|
|
20811
|
+
print: false
|
|
20812
|
+
});
|
|
20813
|
+
} catch (error) {
|
|
20814
|
+
if (isInputRejection(error)) {
|
|
20815
|
+
throw new ConvertError(CONVERT_ERROR.INPUT_REJECTED, error.message, error.instructions);
|
|
20816
|
+
}
|
|
20817
|
+
throw error;
|
|
20818
|
+
}
|
|
20819
|
+
const skill = converted.skill ? {
|
|
20820
|
+
...converted.skill,
|
|
20821
|
+
install: skillInstallCommand(out, converted.skill.source)
|
|
20822
|
+
} : undefined;
|
|
20823
|
+
const nextSteps = [
|
|
20824
|
+
`cd ${quoteForShell(out)}`,
|
|
20825
|
+
"npm install && npm run dev",
|
|
20826
|
+
`Read ${converted.report.path} — 'converter' issues are the converter's, 'source-app' issues were already broken in Apps Studio.`
|
|
20827
|
+
];
|
|
20828
|
+
if (skill) {
|
|
20829
|
+
nextSteps.push(`${skill.install} — installs the fix-converted-app skill for every coding agent on this machine (add --agent <name> for one).`, "Then open the project in your coding agent and ask it to run fix-converted-app: it works through the report's converter-blamed issues in the generated code.");
|
|
20830
|
+
}
|
|
20831
|
+
return {
|
|
20832
|
+
path: out,
|
|
20833
|
+
kind: converted.kind,
|
|
20834
|
+
source: file,
|
|
20835
|
+
outcome: outcomeOf(converted),
|
|
20836
|
+
pages: converted.pages,
|
|
20837
|
+
files: converted.files,
|
|
20838
|
+
kept: converted.kept,
|
|
20839
|
+
media: converted.media,
|
|
20840
|
+
expressions: converted.expressions,
|
|
20841
|
+
unconverted: converted.unconverted,
|
|
20842
|
+
viewGaps: converted.viewGaps,
|
|
20843
|
+
syntaxProblems: converted.syntaxProblems,
|
|
20844
|
+
blocking: converted.blocking,
|
|
20845
|
+
report: converted.report,
|
|
20846
|
+
skill,
|
|
20847
|
+
nextSteps
|
|
20848
|
+
};
|
|
20849
|
+
}
|
|
20850
|
+
|
|
20851
|
+
// src/commands/convert.ts
|
|
20852
|
+
var CONVERT_EXAMPLES = [
|
|
20853
|
+
{
|
|
20854
|
+
Description: "Convert an exported VB low-code app into a coded app in ./expense-app",
|
|
20855
|
+
Command: "uip codedapp convert ./expense-app.uiapp",
|
|
20856
|
+
Output: {
|
|
20857
|
+
Code: "ConvertCompleted",
|
|
20858
|
+
Data: {
|
|
20859
|
+
Path: "./expense-app",
|
|
20860
|
+
Kind: "uiapp",
|
|
20861
|
+
Pages: 3,
|
|
20862
|
+
Files: 58,
|
|
20863
|
+
Report: { Issues: 0, Converter: 0, SourceApp: 0, ByDesign: 0 }
|
|
20864
|
+
}
|
|
20865
|
+
}
|
|
20866
|
+
},
|
|
20867
|
+
{
|
|
20868
|
+
Description: "Convert into a chosen directory; the report lists two things the converter did not manage, and NextSteps says how to install the fix-converted-app skill for your coding agent",
|
|
20869
|
+
Command: "uip codedapp convert ./expense-app.uiapp --out ./apps/expense",
|
|
20870
|
+
Output: {
|
|
20871
|
+
Code: "ConvertCompletedWithGaps",
|
|
20872
|
+
Data: {
|
|
20873
|
+
Path: "./apps/expense",
|
|
20874
|
+
Report: { Issues: 2, Converter: 2, SourceApp: 0, ByDesign: 0 },
|
|
20875
|
+
Skill: {
|
|
20876
|
+
Install: "uip skills install --repo ./.uipath/agent-skills --path ."
|
|
20877
|
+
}
|
|
20878
|
+
}
|
|
20879
|
+
}
|
|
20880
|
+
},
|
|
20881
|
+
{
|
|
20882
|
+
Description: "Re-convert into an existing project (its uipath.json is kept)",
|
|
20883
|
+
Command: "uip codedapp convert ./expense-app.uiapp --force --refresh",
|
|
20884
|
+
Output: {
|
|
20885
|
+
Code: "ConvertCompleted",
|
|
20886
|
+
Data: {
|
|
20887
|
+
Path: "./expense-app",
|
|
20888
|
+
Kept: ["uipath.json"]
|
|
20889
|
+
}
|
|
20890
|
+
}
|
|
20681
20891
|
}
|
|
20892
|
+
];
|
|
20893
|
+
var CONVERT_FAILURE_INSTRUCTIONS = {
|
|
20894
|
+
[CONVERT_ERROR.FILE_REQUIRED]: "Pass the exported app, for example: uip codedapp convert ./my-app.uiapp",
|
|
20895
|
+
[CONVERT_ERROR.FILE_NOT_FOUND]: "Check the path. Export the app from Apps Studio (Export → .uiapp) if you do not have the file yet.",
|
|
20896
|
+
[CONVERT_ERROR.UNSUPPORTED_TYPE]: "Pass the .uiapp file that Apps Studio exports for a VB app (Export → .uiapp).",
|
|
20897
|
+
[CONVERT_ERROR.NOT_A_DIRECTORY]: "Choose an output directory path with --out instead of an existing file path.",
|
|
20898
|
+
[CONVERT_ERROR.DIR_NOT_EMPTY]: "Choose an empty directory with --out, or rerun with --force to convert into it (generated files are replaced; uipath.json and node_modules are kept).",
|
|
20899
|
+
[CONVERT_ERROR.OUT_EMPTY]: "Pass a directory path with --out, or leave --out off to convert into ./<file name> in the current directory.",
|
|
20900
|
+
[CONVERT_ERROR.SDK_UNAVAILABLE]: `Run ${CONVERT_SDK_INSTALL}.`,
|
|
20901
|
+
[CONVERT_ERROR.PREREQUISITE_MISSING]: "Install the .NET 10 runtime from https://dotnet.microsoft.com/download and make sure `dotnet` is on the PATH.",
|
|
20902
|
+
[CONVERT_ERROR.INPUT_REJECTED]: "Check the exported file; the message above says what the converter could not read."
|
|
20903
|
+
};
|
|
20904
|
+
var CONVERT_ERROR_CODES = {
|
|
20905
|
+
[CONVERT_ERROR.FILE_REQUIRED]: "invalid_argument",
|
|
20906
|
+
[CONVERT_ERROR.FILE_NOT_FOUND]: "not_found",
|
|
20907
|
+
[CONVERT_ERROR.UNSUPPORTED_TYPE]: "invalid_argument",
|
|
20908
|
+
[CONVERT_ERROR.NOT_A_DIRECTORY]: "invalid_argument",
|
|
20909
|
+
[CONVERT_ERROR.DIR_NOT_EMPTY]: "invalid_argument",
|
|
20910
|
+
[CONVERT_ERROR.OUT_EMPTY]: "invalid_argument",
|
|
20911
|
+
[CONVERT_ERROR.SDK_UNAVAILABLE]: "configuration_error",
|
|
20912
|
+
[CONVERT_ERROR.PREREQUISITE_MISSING]: "configuration_error",
|
|
20913
|
+
[CONVERT_ERROR.INPUT_REJECTED]: "invalid_argument"
|
|
20914
|
+
};
|
|
20915
|
+
function getConvertErrorCode(error) {
|
|
20916
|
+
return error instanceof ConvertError ? CONVERT_ERROR_CODES[error.code] : undefined;
|
|
20917
|
+
}
|
|
20918
|
+
function getConvertFailureInstructions(error) {
|
|
20919
|
+
if (error instanceof ConvertError) {
|
|
20920
|
+
return error.instructions ?? CONVERT_FAILURE_INSTRUCTIONS[error.code];
|
|
20921
|
+
}
|
|
20922
|
+
return "Rerun with --refresh to bind every expression afresh; if it fails again, send the conversion-log.ndjson from the output directory with the report.";
|
|
20923
|
+
}
|
|
20924
|
+
function convertFailure(result) {
|
|
20925
|
+
if (result.outcome === "cannot-run") {
|
|
20926
|
+
const why = [];
|
|
20927
|
+
if (result.blocking > 0) {
|
|
20928
|
+
why.push(`${result.blocking} blocking issue(s)`);
|
|
20929
|
+
}
|
|
20930
|
+
if (result.syntaxProblems.length > 0) {
|
|
20931
|
+
why.push(`${result.syntaxProblems.length} generated file(s) with TypeScript that does not parse`);
|
|
20932
|
+
}
|
|
20933
|
+
return {
|
|
20934
|
+
Code: "ConvertOutputCannotRun",
|
|
20935
|
+
Message: `Converted into ${result.path}, but the app cannot run as converted: ${why.join(" and ")}.`,
|
|
20936
|
+
Instructions: `Read ${result.report.path}: these are the converter's own gaps, so send it with conversion-log.ndjson to the converter team. The rest of the project is written and can be looked at.`
|
|
20937
|
+
};
|
|
20938
|
+
}
|
|
20939
|
+
return;
|
|
20940
|
+
}
|
|
20941
|
+
var registerConvertCommand = (program) => {
|
|
20942
|
+
program.command("convert").description("Convert an exported VB low-code app (.uiapp) into a React + TypeScript coded app").argument("<file>", "The exported VB low-code app: a .uiapp file").option("--out <dir>", "Output directory for the coded app (default: ./<file name> in the current directory)").option("--force", "Convert into a non-empty directory (a re-conversion; uipath.json and node_modules are kept)").option("--refresh", "Bind every expression afresh instead of reusing the output directory's bind cache").examples(CONVERT_EXAMPLES).trackedAction(processContext, async (file, options) => {
|
|
20943
|
+
const [error, result] = await catchError(executeConvert({
|
|
20944
|
+
file,
|
|
20945
|
+
out: options.out,
|
|
20946
|
+
force: options.force,
|
|
20947
|
+
noCache: options.refresh === true
|
|
20948
|
+
}));
|
|
20949
|
+
if (error) {
|
|
20950
|
+
OutputFormatter.error({
|
|
20951
|
+
Result: RESULTS.Failure,
|
|
20952
|
+
Code: error instanceof ConvertError ? error.code : undefined,
|
|
20953
|
+
ErrorCode: getConvertErrorCode(error),
|
|
20954
|
+
Message: `Convert failed: ${error.message}`,
|
|
20955
|
+
Instructions: getConvertFailureInstructions(error)
|
|
20956
|
+
});
|
|
20957
|
+
processContext.exit(1);
|
|
20958
|
+
return;
|
|
20959
|
+
}
|
|
20960
|
+
const failure = convertFailure(result);
|
|
20961
|
+
if (failure) {
|
|
20962
|
+
OutputFormatter.error({
|
|
20963
|
+
Result: RESULTS.Failure,
|
|
20964
|
+
...failure,
|
|
20965
|
+
Data: pascalCaseDataKeys(result)
|
|
20966
|
+
});
|
|
20967
|
+
processContext.exit(1);
|
|
20968
|
+
return;
|
|
20969
|
+
}
|
|
20970
|
+
OutputFormatter.success({
|
|
20971
|
+
Result: RESULTS.Success,
|
|
20972
|
+
Code: result.outcome === "converted" ? "ConvertCompleted" : "ConvertCompletedWithGaps",
|
|
20973
|
+
Data: result
|
|
20974
|
+
});
|
|
20975
|
+
});
|
|
20682
20976
|
};
|
|
20683
20977
|
|
|
20684
20978
|
// ../../node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
@@ -21417,11 +21711,11 @@ var ACTION_SCHEMA_CONSTANTS = {
|
|
|
21417
21711
|
ACTION_SCHEMA_FILENAME: "action-schema.json"
|
|
21418
21712
|
};
|
|
21419
21713
|
var DEFAULT_APP_VERSION = "1.0.0";
|
|
21714
|
+
var MAX_CODED_APP_NAME_LENGTH = 64;
|
|
21420
21715
|
// src/constants/messages.ts
|
|
21421
21716
|
var MESSAGES = {
|
|
21422
21717
|
ERRORS: {
|
|
21423
21718
|
INVALID_DIST_DIRECTORY: "Invalid dist directory",
|
|
21424
|
-
MISSING_INDEX_HTML: "index.html not found at the root of the build directory. SSR frameworks (Next.js, Nuxt, Remix) are not supported — only static builds. Make sure you are pointing to the folder that contains index.html (e.g. for Angular: dist/<app-name>/browser/).",
|
|
21425
21719
|
PACKAGE_NAME_REQUIRED: "Package name is required",
|
|
21426
21720
|
ACTION_SCHEMA_REQUIRED: "❌ action-schema.json file not found in current working directory",
|
|
21427
21721
|
ACTION_SCHEMA_REQUIRED_REMOTE: "❌ This project is registered as a Coded Action app but action-schema.json was not found locally. Please add an action-schema.json file to your project root before pushing.",
|
|
@@ -21429,6 +21723,7 @@ var MESSAGES = {
|
|
|
21429
21723
|
ACCESS_DENIED: "Access denied. You may not have permission to access this tenant/organization",
|
|
21430
21724
|
API_ENDPOINT_NOT_FOUND: "API endpoint not found. Please check your UIPATH_BASE_URL configuration",
|
|
21431
21725
|
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'.",
|
|
21726
|
+
APPS_SERVICE_APP_TOKEN_READ_HINT: "The UiPath Apps service rejected this external application's token: it is missing the Apps.Read scope. Grant it to the external application (Admin > External Applications), then add it to 'uip login --scope'.",
|
|
21432
21727
|
SERVER_ERROR: "Server error occurred. Please try again later or contact UiPath support",
|
|
21433
21728
|
SERVICES_UNAVAILABLE: "UiPath services are temporarily unavailable. Please try again later",
|
|
21434
21729
|
RATE_LIMIT_EXCEEDED: "Rate limit exceeded. Please wait and try again",
|
|
@@ -21446,9 +21741,13 @@ var MESSAGES = {
|
|
|
21446
21741
|
FAILED_TO_FETCH_ORG_TENANT: "❌ Failed to fetch organization/tenant information",
|
|
21447
21742
|
APP_DEPLOYMENT_FAILED: "❌ App deployment failed",
|
|
21448
21743
|
APP_UPGRADE_FAILED: "❌ App upgrade failed",
|
|
21449
|
-
PERSONAL_WORKSPACE_FEED_MISSING: "❌ Could not resolve your Personal Workspace feed. Ensure Personal Workspaces are enabled for your account, or
|
|
21744
|
+
PERSONAL_WORKSPACE_FEED_MISSING: "❌ Could not resolve your Personal Workspace feed. Ensure Personal Workspaces are enabled for your account, or publish with --tenant-feed instead.",
|
|
21745
|
+
FEED_OPTIONS_CONFLICT: "❌ --tenant-feed, --personal-workspace, --folder-path, --folder-key and --feed-id each pick a feed to publish into. Pass only one of them.",
|
|
21746
|
+
FOLDER_NAME_REQUIRED: "❌ --folder-path needs a folder name or path.",
|
|
21747
|
+
FOLDER_KEY_EMPTY: "❌ The folder key is empty (--folder-key or UIPATH_FOLDER_KEY was set without a value). Pass a folder key, or unset both to pick a folder interactively.",
|
|
21748
|
+
NO_PUBLISHABLE_FEEDS: "❌ Orchestrator lists no package feed you can publish into. Ask an administrator for publish rights on the tenant feed or on a folder feed, or pass --tenant-feed to try the tenant feed anyway.",
|
|
21749
|
+
FEED_LIST_FAILED: "❌ Could not list the package feeds you can publish into. Answer the next question, or pass --tenant-feed or --personal-workspace, which need no listing.",
|
|
21450
21750
|
APP_NOT_PUBLISHED: '❌ App has not been published yet, or the published app is still being indexed. If publish just succeeded, wait a few seconds and rerun "uip codedapp deploy"; otherwise run "uip codedapp publish" first.',
|
|
21451
|
-
APP_NAME_ALREADY_EXISTS: "❌ This app name is already deployed in this folder. Please choose a different name.",
|
|
21452
21751
|
DEPLOY_VERSION_NOT_FOUND: "❌ Could not determine deploy version from the server. Please re-run publish first.",
|
|
21453
21752
|
DEPLOYMENT_ID_NOT_FOUND: "❌ Could not find deployment ID for the app",
|
|
21454
21753
|
ALL_REGISTERED_PORTS_IN_USE: "All registered ports are in use",
|
|
@@ -21466,7 +21765,8 @@ var MESSAGES = {
|
|
|
21466
21765
|
SCOPE_VALIDATION_ERROR: "Scope is required for OAuth client creation during deployment.",
|
|
21467
21766
|
UNKNOWN_FLAG: "✗ Error: Unknown flag",
|
|
21468
21767
|
UNKNOWN_COMMAND: "✗ Error: Unknown command",
|
|
21469
|
-
PUSH_PROJECT_ID_REQUIRED: "Project ID is required. Use: uip codedapp push
|
|
21768
|
+
PUSH_PROJECT_ID_REQUIRED: "Project ID is required. Use: uip codedapp push --project-id <id>, set UIPATH_PROJECT_ID in the .env file, or create a new solution with --solution-name <name> --project-name <name>",
|
|
21769
|
+
PUSH_NEW_SOLUTION_NAMES_REQUIRED: "Creating a new solution requires both --solution-name <name> and --project-name <name>.",
|
|
21470
21770
|
PUSH_VALIDATION_FAILED: "Validation failed",
|
|
21471
21771
|
PUSH_DISALLOWED_EXTENSIONS: "Push blocked: files with disallowed extensions found. Only web-related file types are allowed.",
|
|
21472
21772
|
PUSH_FILE_TOO_LARGE: "Push blocked: one or more files exceed the 10 MB size limit. Consider uploading large assets to cloud storage and referencing them in your code instead.",
|
|
@@ -21550,8 +21850,12 @@ var MESSAGES = {
|
|
|
21550
21850
|
PUBLISHING_PACKAGE: "Publishing package to UiPath Orchestrator...",
|
|
21551
21851
|
UPLOADING_PACKAGE: "Uploading package to Orchestrator...",
|
|
21552
21852
|
RESOLVING_PERSONAL_WORKSPACE_FEED: "Resolving Personal Workspace feed...",
|
|
21853
|
+
RESOLVING_FOLDER_FEED: "Resolving the folder's package feed...",
|
|
21854
|
+
LISTING_PACKAGE_FEEDS: "Listing package feeds...",
|
|
21855
|
+
FOLDER_USES_TENANT_FEED: "ℹ This folder reads packages from the tenant feed, so the package is published there.",
|
|
21553
21856
|
REGISTERING_CODED_APP: "Registering coded app...",
|
|
21554
21857
|
PACKAGE_ALREADY_EXISTS: "ℹ Package already exists in Orchestrator, proceeding to registration...",
|
|
21858
|
+
CODED_APP_ALREADY_REGISTERED: "ℹ This package version is already registered with the Apps service (the package-upload event registers it too). Verified it is the same app type and feed, continuing with that registration.",
|
|
21555
21859
|
FINDING_PORT: "Finding available port...",
|
|
21556
21860
|
STARTING_AUTH_PROCESS: "Starting authentication process...",
|
|
21557
21861
|
STARTING_AUTH_SERVER: "Starting local authentication server...",
|
|
@@ -21601,6 +21905,8 @@ var MESSAGES = {
|
|
|
21601
21905
|
PULL_OVERWRITE_CONFIRM: "This pull will overwrite one or more local files. Do you want to continue? (Y/n)",
|
|
21602
21906
|
PULL_CONTINUE_NOT_PROJECT_ROOT: "Continue anyway? (y/N)",
|
|
21603
21907
|
ENTER_APP_NAME: "Enter app name:",
|
|
21908
|
+
ENTER_NEW_SOLUTION_NAME: "Enter a name for the new solution (the Studio Web container for your app and its resources):",
|
|
21909
|
+
ENTER_NEW_CODED_APP_NAME: "Enter a name for the new Coded App (the app end users open):",
|
|
21604
21910
|
ENTER_PACKAGE_DESCRIPTION: "Enter package description:",
|
|
21605
21911
|
SELECT_PACKAGE_TO_PUBLISH: "Select package to publish:",
|
|
21606
21912
|
REAUTH_QUESTION: "Do you want to re-authenticate?",
|
|
@@ -21614,6 +21920,8 @@ var MESSAGES = {
|
|
|
21614
21920
|
},
|
|
21615
21921
|
VALIDATIONS: {
|
|
21616
21922
|
APP_NAME_REQUIRED: "App name is required",
|
|
21923
|
+
SOLUTION_NAME_EMPTY: "Solution name cannot be empty.",
|
|
21924
|
+
CODED_APP_NAME_EMPTY: "App name cannot be empty.",
|
|
21617
21925
|
PATH_NAME_REQUIRED: "A path name must contain at least one letter or digit",
|
|
21618
21926
|
APP_NAME_INVALID_CHARS: "App name can only contain lowercase letters, numbers, and hyphens (-). Please remove invalid special characters and try again.",
|
|
21619
21927
|
PACKAGE_NAME_REQUIRED: "Package name is required",
|
|
@@ -21626,6 +21934,8 @@ var MESSAGES = {
|
|
|
21626
21934
|
ERROR_CONTEXT: {
|
|
21627
21935
|
PACKAGE_PUBLISHING: "package publishing",
|
|
21628
21936
|
PERSONAL_WORKSPACE_LOOKUP: "Personal Workspace lookup",
|
|
21937
|
+
FOLDER_FEED_LOOKUP: "folder feed lookup",
|
|
21938
|
+
PACKAGE_FEEDS_LOOKUP: "package feeds lookup",
|
|
21629
21939
|
CLIENT_CREDENTIALS_AUTH: "client credentials authentication",
|
|
21630
21940
|
APP_DEPLOYMENT: "app deployment",
|
|
21631
21941
|
DEPLOYED_APP_LOOKUP: "deployed app lookup",
|
|
@@ -21639,9 +21949,33 @@ var MESSAGES = {
|
|
|
21639
21949
|
}
|
|
21640
21950
|
};
|
|
21641
21951
|
var MESSAGE_BUILDERS = {
|
|
21952
|
+
MISSING_INDEX_HTML: (distDir) => `No HTML entry point (index.html, main.html or app.html) in bundle ${distDir}. Build the app before packing, or point config.bundlePath in webAppManifest.json at its build output and pass that folder to codedapp pack. Only static builds are supported.`,
|
|
21953
|
+
CODED_APP_ALREADY_REGISTERED_OTHER_TYPE: (requested, actual) => `❌ This package version is already registered with the Apps service as a ${actual} app, but this publish is for a ${requested} app. The package-upload event registered it without the action schema. Publish a new version, or re-register after the existing one is removed.`,
|
|
21954
|
+
CODED_APP_ALREADY_REGISTERED_OTHER_FEED: (actual, requested) => `❌ This package version is already registered with the Apps service in ${actual}, but this publish targets ${requested}. Publish a new version into the intended feed.`,
|
|
21955
|
+
CODED_APP_ALREADY_REGISTERED_FEED_UNVERIFIABLE: (systemName) => `❌ The Apps service says this package version is already registered as ${systemName}, but which feed that registration is in could not be confirmed, so the publish is not recorded against it. Rerun the publish in a moment; if this keeps happening, pass --tenant-feed, --personal-workspace or --folder-key so the feed is known.`,
|
|
21956
|
+
CODED_APP_ALREADY_REGISTERED_UNVERIFIED: (systemName, version) => `❌ The Apps service says version ${version} is already registered as ${systemName}, but that app's versions do not list it yet, so its type and feed could not be checked. Rerun the publish in a moment.`,
|
|
21957
|
+
DEPLOYED_APP_IS_ANOTHER: (appName, deployedSystemName, registeredSystemName) => `❌ This folder already has a deployed app named ${appName} (${deployedSystemName}), but it is not the app this project registered (${registeredSystemName}); the same package name published into two feeds is two apps. Deploy into another folder, or remove the other app from this one first.`,
|
|
21958
|
+
APP_CONFIG_CHANGED_DURING_DEPLOY: (deployed, recorded) => `⚠️ .uipath/app.config.json now records ${recorded ?? "no systemName"}, but this deploy worked from ${deployed ?? "a record with no systemName"} (a publish ran in the meantime). The deployment succeeded; the record was left as the publish wrote it.`,
|
|
21959
|
+
APP_CONFIG_IS_ANOTHER_APP: (recorded, deployed) => `⚠️ .uipath/app.config.json records ${recorded}, not ${deployed}, so this deployment was not written into it.`,
|
|
21960
|
+
RECORDED_APP_NOT_FOUND: (systemName) => `❌ The published app this project registered (${systemName}, from .uipath/app.config.json) was not found. If "uip codedapp publish" just succeeded, wait a few seconds and rerun; if the app was deleted, run "uip codedapp publish" again so the record points at the new app.`,
|
|
21961
|
+
FEED_NOT_NUGET: (name, protocol) => `❌ Feed '${name}' is a ${protocol} feed. A coded app package is a .nupkg and can only be published into a NuGet feed.`,
|
|
21962
|
+
FEED_AMBIGUOUS: (feedId) => `❌ Orchestrator lists more than one tenant-level Processes feed, so ${feedId} cannot be told apart from the tenant feed. Use --tenant-feed for the tenant feed, or --folder-key <key> for a folder's feed.`,
|
|
21963
|
+
FEED_CLASSIFY_FAILED: (feedId) => `❌ Could not tell which kind of feed ${feedId} is: Orchestrator's feed listing failed, so deploy could not be told which folders fit. Retry, or pick the feed with --tenant-feed or --personal-workspace, which need no listing.`,
|
|
21964
|
+
FEED_OWNER_UNKNOWN: (feedId) => `❌ Orchestrator lists ${feedId} without a folder, and the folder lookups that tell the tenant feed from a folder's own feed failed. Retry, or pick the feed with --tenant-feed or --folder-key <key>.`,
|
|
21965
|
+
FEED_PERSONAL_CHECK_FAILED: (feedId) => `❌ Could not tell whether ${feedId} is your Personal Workspace feed: Orchestrator's current-user lookup failed. Retry, or pick the feed with --tenant-feed or --personal-workspace.`,
|
|
21966
|
+
FEED_OPTION_EMPTY: (flag) => `❌ ${flag} was given without a value. Pass a value, or omit the flag to choose a feed (the picker when interactive, the tenant feed otherwise).`,
|
|
21967
|
+
FOLDER_NOT_FOUND: (name) => `❌ Folder '${name}' not found. Pass a folder display name or fully qualified path (uip or folders list), or use --folder-key / --feed-id.`,
|
|
21968
|
+
FOLDER_NAME_AMBIGUOUS: (name, paths) => `❌ Folder name '${name}' matches ${paths.length} folders: ${paths.join(", ")}. Pass the fully qualified path or --folder-key.`,
|
|
21642
21969
|
APP_NAME_SANITIZED: (original, sanitized) => `⚠️ App name "${original}" contains invalid characters. Using sanitized name: "${sanitized}"`,
|
|
21643
21970
|
APP_NAME_TOO_LONG: (name, length, maxLength) => `App name '${name}' is ${length} characters; limit is ${maxLength}. Use --name with a shorter app name and try again.`,
|
|
21644
|
-
|
|
21971
|
+
PATH_NAME_TOO_LONG: (pathName, length, maxLength) => `Path name '${pathName}' is ${length} characters; limit is ${maxLength}. Pass a shorter --path-name.`,
|
|
21972
|
+
PATH_NAME_TAKEN: (pathName) => `❌ Path name '${pathName}' is already taken in this organization. Pass a different --path-name. To check whether a path name is free, run 'uip codedapp validate --path-name <name>'.`,
|
|
21973
|
+
PUSH_NEW_SOLUTION_WITH_PROJECT_ID: (source) => `--solution-name and --project-name create a new solution, but a project ID is already set by ${source}. Remove it to create a new solution, or run push without these flags to push to the existing project.`,
|
|
21974
|
+
MAIN_FILE_NOT_IN_BUNDLE: (mainFile, distDir) => `Main file "${mainFile}" is not a file in ${distDir}. The package's operate.json boots this file, so it has to be in the build output. Set --main-file or config.mainFile in webAppManifest.json to a file the build produces, or remove the selection to use the default HTML entry point.`,
|
|
21975
|
+
MAIN_FILE_OUTSIDE_BUNDLE: (mainFile) => `Main file "${mainFile}" points outside the build directory. Set --main-file or config.mainFile in webAppManifest.json to a path relative to the build directory, such as app.html.`,
|
|
21976
|
+
SDK_CONFIG_CREATED: (configPath) => `⚠️ uipath.json not found — created at ${configPath} with empty values.`,
|
|
21977
|
+
SYMLINK_IN_BUILD_DIRECTORY: (link) => `${link} in the build directory is part of a symlink loop or links to a folder that is already included, so pack cannot copy it. Remove the link and try again.`,
|
|
21978
|
+
PROJECT_FILES_IN_BUILD_DIRECTORY: (entry) => `${entry} found in the build directory. This usually means the project root was passed instead of the build output, or project files were copied into it. Point pack at the folder your build tool writes to (e.g. dist/), and make sure it only holds built files.`
|
|
21645
21979
|
};
|
|
21646
21980
|
var getHttpErrorMessage = (status, context) => {
|
|
21647
21981
|
switch (status) {
|
|
@@ -21802,7 +22136,11 @@ function buildAppUrl(params) {
|
|
|
21802
22136
|
}
|
|
21803
22137
|
|
|
21804
22138
|
// src/utils/error-handler.ts
|
|
21805
|
-
var
|
|
22139
|
+
var APPS_SCOPE = "Apps";
|
|
22140
|
+
var APPS_SCOPE_PREFIX = `${APPS_SCOPE}.`;
|
|
22141
|
+
function isAppsScope(scope) {
|
|
22142
|
+
return scope === APPS_SCOPE || scope.startsWith(APPS_SCOPE_PREFIX);
|
|
22143
|
+
}
|
|
21806
22144
|
function appsServiceHint(status, appsServiceToken) {
|
|
21807
22145
|
if (status !== 401 || !appsServiceToken)
|
|
21808
22146
|
return;
|
|
@@ -21810,7 +22148,7 @@ function appsServiceHint(status, appsServiceToken) {
|
|
|
21810
22148
|
return;
|
|
21811
22149
|
}
|
|
21812
22150
|
const scopes = readTokenScopes(appsServiceToken) ?? [];
|
|
21813
|
-
if (scopes.some(
|
|
22151
|
+
if (scopes.some(isAppsScope)) {
|
|
21814
22152
|
return;
|
|
21815
22153
|
}
|
|
21816
22154
|
return MESSAGES.ERRORS.APPS_SERVICE_APP_TOKEN_HINT;
|
|
@@ -21828,14 +22166,17 @@ HTTP ${response.status}: ${MESSAGES.ERRORS.NO_ERROR_DETAILS}`;
|
|
|
21828
22166
|
}
|
|
21829
22167
|
return fullMessage;
|
|
21830
22168
|
}
|
|
21831
|
-
async function
|
|
22169
|
+
async function createHttpError(response, context, appsServiceToken) {
|
|
21832
22170
|
const errorMessage = await createHttpErrorMessage(response, context, appsServiceToken);
|
|
21833
22171
|
const error = new Error(errorMessage);
|
|
21834
22172
|
if (appsServiceHint(response.status, appsServiceToken)) {
|
|
21835
22173
|
const errorCode = "permission_denied";
|
|
21836
22174
|
Object.assign(error, { errorCode });
|
|
21837
22175
|
}
|
|
21838
|
-
|
|
22176
|
+
return error;
|
|
22177
|
+
}
|
|
22178
|
+
async function handleHttpError(response, context, appsServiceToken) {
|
|
22179
|
+
throw await createHttpError(response, context, appsServiceToken);
|
|
21839
22180
|
}
|
|
21840
22181
|
|
|
21841
22182
|
// src/services/deployed-apps.ts
|
|
@@ -21885,8 +22226,8 @@ async function checkPathName(pathName, envConfig, errorContext = MESSAGES.ERROR_
|
|
|
21885
22226
|
})
|
|
21886
22227
|
});
|
|
21887
22228
|
if (!response.ok) {
|
|
21888
|
-
const
|
|
21889
|
-
throw Object.assign(
|
|
22229
|
+
const error = await createHttpError(response, errorContext, envConfig.accessToken);
|
|
22230
|
+
throw Object.assign(error, { status: response.status });
|
|
21890
22231
|
}
|
|
21891
22232
|
const data = await response.json();
|
|
21892
22233
|
return { available: data.isUnique, occupiedBy: data.occupiedBy ?? null };
|
|
@@ -28604,13 +28945,237 @@ async function saveAppConfig(config) {
|
|
|
28604
28945
|
await atomicWriteFile(configPath, config);
|
|
28605
28946
|
}
|
|
28606
28947
|
|
|
28948
|
+
// src/utils/feeds.ts
|
|
28949
|
+
var FOLDER_HIERARCHY_FEED_TYPE = "FolderHierarchy";
|
|
28950
|
+
var PERSONAL_WORKSPACE_PURPOSE = "PersonalWorkspace";
|
|
28951
|
+
var PROCESSES_PURPOSE = "Processes";
|
|
28952
|
+
function isTenantFeed(feed) {
|
|
28953
|
+
return feed.folderId === null && feed.purpose === PROCESSES_PURPOSE;
|
|
28954
|
+
}
|
|
28955
|
+
function isNuGetFeed(feed) {
|
|
28956
|
+
return !feed.protocol || feed.protocol === NUGET_PROTOCOL;
|
|
28957
|
+
}
|
|
28958
|
+
var NUGET_PROTOCOL = "NuGet";
|
|
28959
|
+
function isFolderHierarchyFeed(feed) {
|
|
28960
|
+
return feed.purpose === FOLDER_HIERARCHY_FEED_TYPE;
|
|
28961
|
+
}
|
|
28962
|
+
function isPersonalWorkspaceFeed(feed) {
|
|
28963
|
+
return feed.purpose === PERSONAL_WORKSPACE_PURPOSE;
|
|
28964
|
+
}
|
|
28965
|
+
var PROCESS_FEED_PURPOSES = new Set([
|
|
28966
|
+
"Processes",
|
|
28967
|
+
"PersonalWorkspace",
|
|
28968
|
+
"FolderHierarchy"
|
|
28969
|
+
]);
|
|
28970
|
+
async function loadSdk() {
|
|
28971
|
+
return import("./index-78bnpdqb.js");
|
|
28972
|
+
}
|
|
28973
|
+
function orchestratorConfig(sdk, connection) {
|
|
28974
|
+
let base = connection.baseUrl;
|
|
28975
|
+
while (base.endsWith("/"))
|
|
28976
|
+
base = base.slice(0, -1);
|
|
28977
|
+
const org = encodeURIComponent(connection.orgId);
|
|
28978
|
+
const tenant = encodeURIComponent(connection.tenant);
|
|
28979
|
+
return sdk.createOrchestratorConfigFromConnection({
|
|
28980
|
+
orchestratorUrl: `${base}/${org}/${tenant}/orchestrator_`,
|
|
28981
|
+
accessToken: connection.accessToken
|
|
28982
|
+
});
|
|
28983
|
+
}
|
|
28984
|
+
async function listPublishableProcessFeeds(connection) {
|
|
28985
|
+
const sdk = await loadSdk();
|
|
28986
|
+
const api2 = new sdk.PackageFeedsApi(orchestratorConfig(sdk, connection));
|
|
28987
|
+
const response = await api2.packageFeedsGetFeedsRaw({
|
|
28988
|
+
onlyPublishable: true
|
|
28989
|
+
});
|
|
28990
|
+
const text = (await response.raw.text()).trim();
|
|
28991
|
+
const body = text ? JSON.parse(text) : null;
|
|
28992
|
+
const feeds = Array.isArray(body) ? body.map(sdk.PackageFeedDtoFromJSON) : [];
|
|
28993
|
+
return feeds.map(toPackageFeed).filter((feed) => feed !== null && PROCESS_FEED_PURPOSES.has(feed.purpose));
|
|
28994
|
+
}
|
|
28995
|
+
async function getFolderFeedId(connection, folderKey) {
|
|
28996
|
+
const sdk = await loadSdk();
|
|
28997
|
+
const api2 = new sdk.PackageFeedsApi(orchestratorConfig(sdk, connection));
|
|
28998
|
+
const feedId = await api2.packageFeedsGetFolderFeedByKey({ folderKey });
|
|
28999
|
+
const value = typeof feedId === "string" ? feedId.trim() : "";
|
|
29000
|
+
return value === "" || value === "null" ? null : value;
|
|
29001
|
+
}
|
|
29002
|
+
var FOLDERS_PAGE_SIZE = 1000;
|
|
29003
|
+
var FOLDERS_MAX_PAGES = 50;
|
|
29004
|
+
async function fetchFolderFeedTypes(connection) {
|
|
29005
|
+
const sdk = await loadSdk();
|
|
29006
|
+
const api2 = new sdk.FoldersApi(orchestratorConfig(sdk, connection));
|
|
29007
|
+
const feedTypes = new Map;
|
|
29008
|
+
for (let page = 0;page < FOLDERS_MAX_PAGES; page++) {
|
|
29009
|
+
const result = await api2.foldersGet({
|
|
29010
|
+
$select: "Key,FeedType",
|
|
29011
|
+
$top: FOLDERS_PAGE_SIZE,
|
|
29012
|
+
$skip: page * FOLDERS_PAGE_SIZE
|
|
29013
|
+
});
|
|
29014
|
+
const rows = result?.value ?? [];
|
|
29015
|
+
let fresh = 0;
|
|
29016
|
+
for (const row of rows) {
|
|
29017
|
+
const key = (row.key ?? "").toLowerCase();
|
|
29018
|
+
if (!key || feedTypes.has(key))
|
|
29019
|
+
continue;
|
|
29020
|
+
feedTypes.set(key, String(row.feedType ?? ""));
|
|
29021
|
+
fresh++;
|
|
29022
|
+
}
|
|
29023
|
+
if (fresh === 0 || rows.length < FOLDERS_PAGE_SIZE)
|
|
29024
|
+
break;
|
|
29025
|
+
}
|
|
29026
|
+
return feedTypes;
|
|
29027
|
+
}
|
|
29028
|
+
function findFeedByFolderName(folderName, feeds) {
|
|
29029
|
+
const wanted = folderName.trim().toLowerCase();
|
|
29030
|
+
if (!wanted)
|
|
29031
|
+
return;
|
|
29032
|
+
const exact = feeds.filter((feed) => feed.name.toLowerCase() === wanted);
|
|
29033
|
+
if (exact.length > 0)
|
|
29034
|
+
return exact.length === 1 ? exact[0] : undefined;
|
|
29035
|
+
const core = feeds.filter((feed) => feedCoreName(feed.name) === wanted);
|
|
29036
|
+
return core.length === 1 ? core[0] : undefined;
|
|
29037
|
+
}
|
|
29038
|
+
var FEED_NAME_PREFIX = "orchestrator ";
|
|
29039
|
+
var FEED_NAME_SUFFIX = " feed";
|
|
29040
|
+
function feedCoreName(feedName) {
|
|
29041
|
+
let core = feedName.toLowerCase();
|
|
29042
|
+
if (core.startsWith(FEED_NAME_PREFIX)) {
|
|
29043
|
+
core = core.slice(FEED_NAME_PREFIX.length);
|
|
29044
|
+
}
|
|
29045
|
+
if (core.endsWith(FEED_NAME_SUFFIX)) {
|
|
29046
|
+
core = core.slice(0, -FEED_NAME_SUFFIX.length);
|
|
29047
|
+
}
|
|
29048
|
+
return core;
|
|
29049
|
+
}
|
|
29050
|
+
async function findFoldersByName(connection, name) {
|
|
29051
|
+
const sdk = await loadSdk();
|
|
29052
|
+
const api2 = new sdk.FoldersApi(orchestratorConfig(sdk, connection));
|
|
29053
|
+
return sdk.findFoldersByName(api2, name);
|
|
29054
|
+
}
|
|
29055
|
+
function sameFeedId(a, b) {
|
|
29056
|
+
if (!a || !b)
|
|
29057
|
+
return !a && !b;
|
|
29058
|
+
return a.toLowerCase() === b.toLowerCase();
|
|
29059
|
+
}
|
|
29060
|
+
function toPackageFeed(entry) {
|
|
29061
|
+
if (!entry.id)
|
|
29062
|
+
return null;
|
|
29063
|
+
return {
|
|
29064
|
+
id: entry.id,
|
|
29065
|
+
name: entry.name ?? entry.id,
|
|
29066
|
+
purpose: String(entry.purpose ?? ""),
|
|
29067
|
+
folderId: typeof entry.folderId === "number" ? entry.folderId : null,
|
|
29068
|
+
protocol: entry.protocol ?? null
|
|
29069
|
+
};
|
|
29070
|
+
}
|
|
29071
|
+
var NO_WORKSPACE_STATUSES = new Set([403, 404]);
|
|
29072
|
+
async function lookupPersonalWorkspaceFeedId(connection) {
|
|
29073
|
+
let base = connection.baseUrl;
|
|
29074
|
+
while (base.endsWith("/"))
|
|
29075
|
+
base = base.slice(0, -1);
|
|
29076
|
+
const org = encodeURIComponent(connection.orgId);
|
|
29077
|
+
const tenant = encodeURIComponent(connection.tenant);
|
|
29078
|
+
const url = appendQueryParams(`${base}/${org}/${tenant}${API_ENDPOINTS.ORCH_CURRENT_USER_EXTENDED}`, BASIC_ORIGIN_QUERY_PARAMS);
|
|
29079
|
+
const [requestError, response] = await catchError(fetch(url, {
|
|
29080
|
+
method: "GET",
|
|
29081
|
+
headers: createHeaders({
|
|
29082
|
+
bearerToken: connection.accessToken,
|
|
29083
|
+
tenantId: connection.tenant
|
|
29084
|
+
})
|
|
29085
|
+
}));
|
|
29086
|
+
if (requestError || !response)
|
|
29087
|
+
return;
|
|
29088
|
+
if (NO_WORKSPACE_STATUSES.has(response.status))
|
|
29089
|
+
return null;
|
|
29090
|
+
if (!response.ok)
|
|
29091
|
+
return;
|
|
29092
|
+
const [parseError, data] = await catchError(response.json());
|
|
29093
|
+
if (parseError)
|
|
29094
|
+
return;
|
|
29095
|
+
return data?.PersonalWorskpaceFeedId || null;
|
|
29096
|
+
}
|
|
29097
|
+
|
|
28607
29098
|
// src/utils/folder-selection.ts
|
|
28608
29099
|
var NON_INTERACTIVE_FOLDER_KEY_MESSAGE = "--folder-key is required when folder selection cannot be prompted in a non-interactive session. Run 'uip or folders list --output json' to find a folder key, then re-run with --folder-key <key>, or set UIPATH_FOLDER_KEY. Pass --interactive to enable prompts.";
|
|
28609
29100
|
function isPersonalFolder(folder) {
|
|
28610
29101
|
return folder.folderType === "Personal";
|
|
28611
29102
|
}
|
|
28612
|
-
function
|
|
28613
|
-
return
|
|
29103
|
+
function hasOwnFeed(folder) {
|
|
29104
|
+
return folder.feedType === FOLDER_HIERARCHY_FEED_TYPE;
|
|
29105
|
+
}
|
|
29106
|
+
function matchesFeedScope(folder, scope) {
|
|
29107
|
+
if (scope.personalWorkspace)
|
|
29108
|
+
return isPersonalFolder(folder);
|
|
29109
|
+
if (scope.folderFeed) {
|
|
29110
|
+
if (isPersonalFolder(folder))
|
|
29111
|
+
return true;
|
|
29112
|
+
return hasOwnFeed(folder) || folder.feedType === "";
|
|
29113
|
+
}
|
|
29114
|
+
if (isPersonalFolder(folder))
|
|
29115
|
+
return false;
|
|
29116
|
+
return !hasOwnFeed(folder);
|
|
29117
|
+
}
|
|
29118
|
+
function describeScope(scope) {
|
|
29119
|
+
if (scope.personalWorkspace)
|
|
29120
|
+
return "into your Personal Workspace";
|
|
29121
|
+
if (scope.folderFeed) {
|
|
29122
|
+
return scope.folderFeed.feedName ? `into the folder feed '${scope.folderFeed.feedName}'` : `into folder feed ${scope.folderFeed.feedId}`;
|
|
29123
|
+
}
|
|
29124
|
+
return "into the tenant feed";
|
|
29125
|
+
}
|
|
29126
|
+
function describeFolderFeed(folder) {
|
|
29127
|
+
if (isPersonalFolder(folder))
|
|
29128
|
+
return "a Personal Workspace folder";
|
|
29129
|
+
if (hasOwnFeed(folder))
|
|
29130
|
+
return "a folder with its own package feed";
|
|
29131
|
+
return "a shared tenant folder";
|
|
29132
|
+
}
|
|
29133
|
+
function fixHintFor(folder, scope) {
|
|
29134
|
+
if (scope.personalWorkspace) {
|
|
29135
|
+
return "Pass a Personal Workspace folder key, or re-publish with --tenant-feed.";
|
|
29136
|
+
}
|
|
29137
|
+
if (scope.folderFeed) {
|
|
29138
|
+
return "Pass a folder that reads from that feed, or re-publish with --tenant-feed to target the tenant feed.";
|
|
29139
|
+
}
|
|
29140
|
+
if (isPersonalFolder(folder)) {
|
|
29141
|
+
return "Pass a shared folder key, or re-publish with --personal-workspace.";
|
|
29142
|
+
}
|
|
29143
|
+
return `Re-publish with --folder-key ${folder.key} so the package lands in this folder's feed, or deploy into a folder that reads from the tenant feed.`;
|
|
29144
|
+
}
|
|
29145
|
+
function feedMismatchError(folder, scope) {
|
|
29146
|
+
return new Error(`Folder '${folder.displayName}' (${folder.fullyQualifiedName}) is ${describeFolderFeed(folder)}, but this app was published ${describeScope(scope)}. ${fixHintFor(folder, scope)}`);
|
|
29147
|
+
}
|
|
29148
|
+
async function checkFolderFeed(folderKey, scope, connection) {
|
|
29149
|
+
let personalFeedId = scope.personalFeedId;
|
|
29150
|
+
if (scope.personalWorkspace && !personalFeedId) {
|
|
29151
|
+
const pwFeedId = await lookupPersonalWorkspaceFeedId(connection);
|
|
29152
|
+
if (pwFeedId === undefined) {
|
|
29153
|
+
return `Could not confirm your Personal Workspace feed (GetCurrentUserExtended failed), so it is not known whether folder ${folderKey} matches the feed this app was published ${describeScope(scope)}. Retry, or re-publish so the record carries the feed id.`;
|
|
29154
|
+
}
|
|
29155
|
+
if (pwFeedId === null) {
|
|
29156
|
+
return `This identity has no Personal Workspace, but this app was published ${describeScope(scope)}. Deploy as the user who published it, or re-publish with --tenant-feed.`;
|
|
29157
|
+
}
|
|
29158
|
+
personalFeedId = pwFeedId;
|
|
29159
|
+
}
|
|
29160
|
+
const [lookupErr, folderFeedId] = await catchError(getFolderFeedId(connection, folderKey));
|
|
29161
|
+
if (lookupErr) {
|
|
29162
|
+
return `Could not confirm which package feed folder ${folderKey} reads from (GetFolderFeedByKey failed: ${lookupErr.message || "unknown error"}), so it is not known whether it matches the feed this app was published ${describeScope(scope)}. Retry, or deploy into a folder known to read from that feed.`;
|
|
29163
|
+
}
|
|
29164
|
+
if (scope.personalWorkspace) {
|
|
29165
|
+
if (sameFeedId(folderFeedId, personalFeedId))
|
|
29166
|
+
return null;
|
|
29167
|
+
const where = folderFeedId ? `another feed (${folderFeedId})` : "the tenant feed";
|
|
29168
|
+
return `Folder ${folderKey} reads packages from ${where}, but this app was published into your Personal Workspace feed. Deploy into your Personal Workspace folder, or re-publish with --tenant-feed.`;
|
|
29169
|
+
}
|
|
29170
|
+
if (scope.folderFeed) {
|
|
29171
|
+
if (sameFeedId(folderFeedId, scope.folderFeed.feedId))
|
|
29172
|
+
return null;
|
|
29173
|
+
const where = folderFeedId ? `another folder feed (${folderFeedId})` : "the tenant feed";
|
|
29174
|
+
return `Folder ${folderKey} reads packages from ${where}, but this app was published ${describeScope(scope)}. Pass a folder that reads from that feed, or re-publish with --folder-key ${folderKey}.`;
|
|
29175
|
+
}
|
|
29176
|
+
if (folderFeedId === null)
|
|
29177
|
+
return null;
|
|
29178
|
+
return `Folder ${folderKey} has its own package feed (${folderFeedId}), but this app was published into the tenant feed. The app would deploy but could not be added to a solution. Re-publish with --folder-key ${folderKey} so the package lands in this folder's feed, or deploy into a folder that reads from the tenant feed.`;
|
|
28614
29179
|
}
|
|
28615
29180
|
function sameFolderKey(a, b) {
|
|
28616
29181
|
return a.toLowerCase() === b.toLowerCase();
|
|
@@ -28633,12 +29198,30 @@ async function fetchFolderPage(baseUrl, accessToken, orgId, tenantName, skip) {
|
|
|
28633
29198
|
key: String(item.Key ?? item.key ?? ""),
|
|
28634
29199
|
displayName: String(item.DisplayName ?? item.displayName ?? ""),
|
|
28635
29200
|
fullyQualifiedName: String(item.FullyQualifiedName ?? item.fullyQualifiedName ?? ""),
|
|
28636
|
-
folderType: String(item.FolderType ?? item.folderType ?? "")
|
|
29201
|
+
folderType: String(item.FolderType ?? item.folderType ?? ""),
|
|
29202
|
+
feedType: String(item.FeedType ?? item.feedType ?? "")
|
|
28637
29203
|
})),
|
|
28638
29204
|
total: typeof count === "number" ? count : null
|
|
28639
29205
|
};
|
|
28640
29206
|
}
|
|
28641
|
-
async function fetchFolders(baseUrl, accessToken, orgId, tenantName, stopEarly) {
|
|
29207
|
+
async function fetchFolders(baseUrl, accessToken, orgId, tenantName, stopEarly, withFeedTypes = false) {
|
|
29208
|
+
const all = await fetchFolderPages(baseUrl, accessToken, orgId, tenantName, stopEarly);
|
|
29209
|
+
if (!withFeedTypes || all.length === 0)
|
|
29210
|
+
return all;
|
|
29211
|
+
const [typesErr, feedTypes] = await catchError(fetchFolderFeedTypes({
|
|
29212
|
+
baseUrl,
|
|
29213
|
+
orgId,
|
|
29214
|
+
tenant: tenantName,
|
|
29215
|
+
accessToken
|
|
29216
|
+
}));
|
|
29217
|
+
if (typesErr)
|
|
29218
|
+
return all;
|
|
29219
|
+
for (const folder of all) {
|
|
29220
|
+
folder.feedType = feedTypes.get(folder.key.toLowerCase()) ?? folder.feedType;
|
|
29221
|
+
}
|
|
29222
|
+
return all;
|
|
29223
|
+
}
|
|
29224
|
+
async function fetchFolderPages(baseUrl, accessToken, orgId, tenantName, stopEarly) {
|
|
28642
29225
|
const all = [];
|
|
28643
29226
|
for (let page = 0;page < FOLDER_PAGE_LIMIT; page++) {
|
|
28644
29227
|
const { folders, total } = await fetchFolderPage(baseUrl, accessToken, orgId, tenantName, all.length);
|
|
@@ -28656,14 +29239,44 @@ async function fetchFolders(baseUrl, accessToken, orgId, tenantName, stopEarly)
|
|
|
28656
29239
|
}
|
|
28657
29240
|
return all;
|
|
28658
29241
|
}
|
|
28659
|
-
|
|
28660
|
-
|
|
29242
|
+
var FEED_CONFIRMATION_CONCURRENCY = 5;
|
|
29243
|
+
async function confirmFolderFeeds(candidates, feedId, connection) {
|
|
29244
|
+
const verdicts = new Array(candidates.length).fill(false);
|
|
29245
|
+
for (let start = 0;start < candidates.length; start += FEED_CONFIRMATION_CONCURRENCY) {
|
|
29246
|
+
const batch = candidates.slice(start, start + FEED_CONFIRMATION_CONCURRENCY);
|
|
29247
|
+
const results = await Promise.all(batch.map(async (folder) => {
|
|
29248
|
+
const [lookupErr, owned] = await catchError(getFolderFeedId(connection, folder.key));
|
|
29249
|
+
return lookupErr ? true : sameFeedId(owned, feedId);
|
|
29250
|
+
}));
|
|
29251
|
+
results.forEach((verdict, offset) => {
|
|
29252
|
+
verdicts[start + offset] = verdict;
|
|
29253
|
+
});
|
|
29254
|
+
}
|
|
29255
|
+
return candidates.filter((_2, index) => verdicts[index]);
|
|
29256
|
+
}
|
|
29257
|
+
function folderPromptMessage(scope) {
|
|
29258
|
+
if (scope?.personalWorkspace === true) {
|
|
29259
|
+
return "Select a Personal Workspace folder:";
|
|
29260
|
+
}
|
|
29261
|
+
if (scope?.folderFeed) {
|
|
29262
|
+
return "Select a folder that reads from the feed this app was published into:";
|
|
29263
|
+
}
|
|
29264
|
+
if (scope?.personalWorkspace === false)
|
|
29265
|
+
return "Select a shared folder:";
|
|
29266
|
+
return "Select a folder:";
|
|
29267
|
+
}
|
|
29268
|
+
async function promptFolderSelection(folders, logger2, scope, connection) {
|
|
29269
|
+
const byType = scope === undefined ? folders : folders.filter((f) => matchesFeedScope(f, scope));
|
|
29270
|
+
const filtered = scope?.folderFeed ? await confirmFolderFeeds(byType, scope.folderFeed.feedId, connection) : byType;
|
|
28661
29271
|
if (filtered.length === 0) {
|
|
28662
|
-
if (personalWorkspace === true) {
|
|
28663
|
-
throw new Error("No Personal Workspace folders are accessible. Enable Personal Workspaces for your account, or re-publish this app
|
|
29272
|
+
if (scope?.personalWorkspace === true) {
|
|
29273
|
+
throw new Error("No Personal Workspace folders are accessible. Enable Personal Workspaces for your account, or re-publish this app with --tenant-feed to target the tenant feed.");
|
|
29274
|
+
}
|
|
29275
|
+
if (scope?.folderFeed) {
|
|
29276
|
+
throw new Error(`No accessible folder reads from the feed this app was published into (${describeScope(scope)}). Grant your account access to that folder, or re-publish with --tenant-feed to target the tenant feed.`);
|
|
28664
29277
|
}
|
|
28665
|
-
if (personalWorkspace === false) {
|
|
28666
|
-
throw new Error("No shared tenant folders are accessible. Grant your account access to a tenant folder, or re-publish this app with --personal-workspace
|
|
29278
|
+
if (scope?.personalWorkspace === false) {
|
|
29279
|
+
throw new Error("No shared tenant-feed folders are accessible. Grant your account access to a tenant folder, or re-publish this app with --personal-workspace (or --folder-key for a folder with its own feed).");
|
|
28667
29280
|
}
|
|
28668
29281
|
logger2.log(source_default.yellow("No folders found in this tenant."));
|
|
28669
29282
|
return null;
|
|
@@ -28675,7 +29288,7 @@ async function promptFolderSelection(folders, logger2, personalWorkspace) {
|
|
|
28675
29288
|
if (!canPrompt()) {
|
|
28676
29289
|
throw new Error(NON_INTERACTIVE_FOLDER_KEY_MESSAGE);
|
|
28677
29290
|
}
|
|
28678
|
-
const promptMessage =
|
|
29291
|
+
const promptMessage = folderPromptMessage(scope);
|
|
28679
29292
|
const { selection } = await esm_default15.prompt([
|
|
28680
29293
|
{
|
|
28681
29294
|
type: "list",
|
|
@@ -28700,43 +29313,53 @@ async function promptFolderSelection(folders, logger2, personalWorkspace) {
|
|
|
28700
29313
|
}
|
|
28701
29314
|
return selection;
|
|
28702
29315
|
}
|
|
28703
|
-
async function validateExplicitFolderKey(folderKey,
|
|
28704
|
-
const [fetchErr, folders] = await catchError(fetchFolders(baseUrl, accessToken, orgId, tenantName, (gathered) => gathered.some((f) => sameFolderKey(f.key, folderKey))));
|
|
29316
|
+
async function validateExplicitFolderKey(folderKey, scope, baseUrl, accessToken, orgId, tenantName) {
|
|
29317
|
+
const [fetchErr, folders] = await catchError(fetchFolders(baseUrl, accessToken, orgId, tenantName, (gathered) => gathered.some((f) => sameFolderKey(f.key, folderKey)), false));
|
|
28705
29318
|
if (fetchErr)
|
|
28706
29319
|
return;
|
|
28707
29320
|
const match = folders.find((f) => sameFolderKey(f.key, folderKey));
|
|
28708
|
-
if (
|
|
28709
|
-
|
|
28710
|
-
if (!matchesWorkspace(match, personalWorkspace)) {
|
|
28711
|
-
const folderKind = isPersonalFolder(match) ? "a Personal Workspace" : "a shared tenant";
|
|
28712
|
-
const publishedAs = personalWorkspace ? "into your Personal Workspace" : "into the tenant feed";
|
|
28713
|
-
const fixHint = personalWorkspace ? "Pass a Personal Workspace folder key, or re-publish without --personal-workspace." : "Pass a shared folder key, or re-publish with --personal-workspace.";
|
|
28714
|
-
throw new Error(`Folder '${match.displayName}' (${match.fullyQualifiedName}) is ${folderKind} folder, but this app was published ${publishedAs}. ${fixHint}`);
|
|
28715
|
-
}
|
|
28716
|
-
}
|
|
28717
|
-
async function ensureFolderKey(logger2, explicitFolderKey, personalWorkspace) {
|
|
28718
|
-
const baseUrl = process.env.UIPATH_BASE_URL;
|
|
28719
|
-
const accessToken = process.env.UIPATH_ACCESS_TOKEN;
|
|
28720
|
-
const orgId = process.env.UIPATH_ORG_ID;
|
|
28721
|
-
const tenantName = process.env.UIPATH_TENANT_NAME;
|
|
28722
|
-
if (explicitFolderKey !== undefined) {
|
|
28723
|
-
if (personalWorkspace !== undefined && baseUrl && accessToken && orgId && tenantName) {
|
|
28724
|
-
await validateExplicitFolderKey(explicitFolderKey, personalWorkspace, baseUrl, accessToken, orgId, tenantName);
|
|
28725
|
-
}
|
|
28726
|
-
process.env.UIPATH_FOLDER_KEY = explicitFolderKey;
|
|
28727
|
-
return;
|
|
29321
|
+
if (match && personalAxisMismatch(match, scope)) {
|
|
29322
|
+
throw feedMismatchError(match, scope);
|
|
28728
29323
|
}
|
|
28729
|
-
|
|
29324
|
+
}
|
|
29325
|
+
function personalAxisMismatch(folder, scope) {
|
|
29326
|
+
if (scope.personalWorkspace)
|
|
29327
|
+
return !isPersonalFolder(folder);
|
|
29328
|
+
if (scope.folderFeed)
|
|
29329
|
+
return false;
|
|
29330
|
+
return isPersonalFolder(folder);
|
|
29331
|
+
}
|
|
29332
|
+
async function ensureFolderKey(logger2, explicitFolderKey, personalWorkspace, folderFeed, connection) {
|
|
29333
|
+
const baseUrl = connection?.baseUrl ?? process.env.UIPATH_BASE_URL;
|
|
29334
|
+
const accessToken = connection?.accessToken ?? process.env.UIPATH_ACCESS_TOKEN;
|
|
29335
|
+
const orgId = connection?.orgId ?? process.env.UIPATH_ORG_ID;
|
|
29336
|
+
const tenantName = connection?.tenant ?? process.env.UIPATH_TENANT_NAME;
|
|
29337
|
+
const scope = personalWorkspace === undefined && folderFeed === undefined ? undefined : { personalWorkspace, folderFeed };
|
|
29338
|
+
const givenFolderKey = explicitFolderKey ?? process.env.UIPATH_FOLDER_KEY;
|
|
29339
|
+
if (givenFolderKey !== undefined && givenFolderKey.trim() === "") {
|
|
29340
|
+
throw new Error(MESSAGES.ERRORS.FOLDER_KEY_EMPTY);
|
|
29341
|
+
}
|
|
29342
|
+
if (givenFolderKey) {
|
|
29343
|
+
if (scope && baseUrl && accessToken && orgId && tenantName) {
|
|
29344
|
+
await validateExplicitFolderKey(givenFolderKey, scope, baseUrl, accessToken, orgId, tenantName);
|
|
29345
|
+
}
|
|
29346
|
+
process.env.UIPATH_FOLDER_KEY = givenFolderKey;
|
|
28730
29347
|
return;
|
|
29348
|
+
}
|
|
28731
29349
|
if (!baseUrl || !accessToken || !orgId || !tenantName)
|
|
28732
29350
|
return;
|
|
28733
|
-
const [fetchErr, folders] = await catchError(fetchFolders(baseUrl, accessToken, orgId, tenantName));
|
|
29351
|
+
const [fetchErr, folders] = await catchError(fetchFolders(baseUrl, accessToken, orgId, tenantName, undefined, scope !== undefined));
|
|
28734
29352
|
if (fetchErr) {
|
|
28735
29353
|
logger2.log(source_default.yellow(`Could not fetch folders: ${fetchErr.message || "Unknown error"}`));
|
|
28736
29354
|
logger2.log(source_default.yellow("You can provide --folder-key manually or set UIPATH_FOLDER_KEY in your .env."));
|
|
28737
29355
|
return;
|
|
28738
29356
|
}
|
|
28739
|
-
const folderKey = await promptFolderSelection(folders, logger2,
|
|
29357
|
+
const folderKey = await promptFolderSelection(folders, logger2, scope, {
|
|
29358
|
+
baseUrl,
|
|
29359
|
+
orgId,
|
|
29360
|
+
tenant: tenantName,
|
|
29361
|
+
accessToken
|
|
29362
|
+
});
|
|
28740
29363
|
if (folderKey) {
|
|
28741
29364
|
process.env.UIPATH_FOLDER_KEY = folderKey;
|
|
28742
29365
|
}
|
|
@@ -28781,7 +29404,10 @@ async function getDeployedApp(appName, envConfig, legacyAppName) {
|
|
|
28781
29404
|
}
|
|
28782
29405
|
return null;
|
|
28783
29406
|
}
|
|
28784
|
-
async function getPublishedApp(appNames, envConfig, version) {
|
|
29407
|
+
async function getPublishedApp(appNames, envConfig, version, requiredSystemName) {
|
|
29408
|
+
if (requiredSystemName) {
|
|
29409
|
+
return getRecordedPublishedApp(requiredSystemName, envConfig, version);
|
|
29410
|
+
}
|
|
28785
29411
|
for (const appName of appNames) {
|
|
28786
29412
|
const match = await getPublishedAppByName(appName, envConfig, version);
|
|
28787
29413
|
if (match)
|
|
@@ -28789,6 +29415,21 @@ async function getPublishedApp(appNames, envConfig, version) {
|
|
|
28789
29415
|
}
|
|
28790
29416
|
return null;
|
|
28791
29417
|
}
|
|
29418
|
+
async function getRecordedPublishedApp(systemName, envConfig, version) {
|
|
29419
|
+
const listed = await getAllPublishedVersions(systemName, envConfig, {
|
|
29420
|
+
notFoundAsEmpty: true
|
|
29421
|
+
});
|
|
29422
|
+
const versions = listed.filter((app) => app.systemName === systemName);
|
|
29423
|
+
if (versions.length === 0)
|
|
29424
|
+
return null;
|
|
29425
|
+
if (version) {
|
|
29426
|
+
return versions.find((app) => app.definition?.codedAppMetadata?.packageVersion === version) ?? null;
|
|
29427
|
+
}
|
|
29428
|
+
return pickCurrentVersion(versions);
|
|
29429
|
+
}
|
|
29430
|
+
function pickCurrentVersion(apps) {
|
|
29431
|
+
return apps.find((app) => app.latestInFeed === true) ?? pickNewestLineage(apps) ?? apps[0];
|
|
29432
|
+
}
|
|
28792
29433
|
function pickNewestLineage(apps) {
|
|
28793
29434
|
let newest = null;
|
|
28794
29435
|
for (const app of apps) {
|
|
@@ -28833,10 +29474,10 @@ async function getPublishedAppByName(appName, envConfig, version) {
|
|
|
28833
29474
|
}
|
|
28834
29475
|
return null;
|
|
28835
29476
|
}
|
|
28836
|
-
return
|
|
29477
|
+
return pickCurrentVersion(matches);
|
|
28837
29478
|
}
|
|
28838
|
-
async function getAllPublishedVersions(systemName, envConfig) {
|
|
28839
|
-
const endpoint = API_ENDPOINTS.PUBLISHED_APP_VERSIONS.replace("{systemName}", systemName).replace("{tenantId}", envConfig.tenantId);
|
|
29479
|
+
async function getAllPublishedVersions(systemName, envConfig, options = {}) {
|
|
29480
|
+
const endpoint = API_ENDPOINTS.PUBLISHED_APP_VERSIONS.replace("{systemName}", encodeURIComponent(systemName)).replace("{tenantId}", envConfig.tenantId);
|
|
28840
29481
|
const url = appendQueryParams(`${envConfig.baseUrl}/${envConfig.orgId}${endpoint}?top=1000`, BASIC_ORIGIN_QUERY_PARAMS);
|
|
28841
29482
|
const response = await fetch(url, {
|
|
28842
29483
|
method: "GET",
|
|
@@ -28846,26 +29487,30 @@ async function getAllPublishedVersions(systemName, envConfig) {
|
|
|
28846
29487
|
folderKey: envConfig.folderKey
|
|
28847
29488
|
})
|
|
28848
29489
|
});
|
|
29490
|
+
if (response.status === 404 && options.notFoundAsEmpty)
|
|
29491
|
+
return [];
|
|
28849
29492
|
if (!response.ok)
|
|
28850
29493
|
await handleHttpError(response, MESSAGES.ERROR_CONTEXT.APP_DEPLOYMENT, envConfig.accessToken);
|
|
28851
29494
|
const data = await response.json();
|
|
28852
29495
|
return data.value;
|
|
28853
29496
|
}
|
|
28854
|
-
async function getPublishedAppWithRetry(appNames, envConfig, version, onRetry) {
|
|
28855
|
-
let publishedApp = await getPublishedApp(appNames, envConfig, version);
|
|
29497
|
+
async function getPublishedAppWithRetry(appNames, envConfig, version, onRetry, preferredSystemName) {
|
|
29498
|
+
let publishedApp = await getPublishedApp(appNames, envConfig, version, preferredSystemName);
|
|
28856
29499
|
for (const delayMs of PUBLISHED_APP_LOOKUP_RETRY_DELAYS_MS) {
|
|
28857
29500
|
if (publishedApp)
|
|
28858
29501
|
return publishedApp;
|
|
28859
29502
|
onRetry(delayMs);
|
|
28860
29503
|
await sleep(delayMs);
|
|
28861
|
-
publishedApp = await getPublishedApp(appNames, envConfig, version);
|
|
29504
|
+
publishedApp = await getPublishedApp(appNames, envConfig, version, preferredSystemName);
|
|
29505
|
+
}
|
|
29506
|
+
if (!publishedApp && preferredSystemName) {
|
|
29507
|
+
throw new Error(MESSAGE_BUILDERS.RECORDED_APP_NOT_FOUND(preferredSystemName));
|
|
28862
29508
|
}
|
|
28863
29509
|
return publishedApp;
|
|
28864
29510
|
}
|
|
28865
29511
|
function sleep(delayMs) {
|
|
28866
29512
|
return new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
28867
29513
|
}
|
|
28868
|
-
var MAX_CODED_APP_NAME_LENGTH = 32;
|
|
28869
29514
|
function validateAppNameLength(name) {
|
|
28870
29515
|
if (name.length <= MAX_CODED_APP_NAME_LENGTH)
|
|
28871
29516
|
return;
|
|
@@ -28874,11 +29519,11 @@ function validateAppNameLength(name) {
|
|
|
28874
29519
|
async function checkAppNameUniqueness(appName, envConfig) {
|
|
28875
29520
|
const { available } = await checkPathName(appName, envConfig, MESSAGES.ERROR_CONTEXT.APP_DEPLOYMENT);
|
|
28876
29521
|
if (!available) {
|
|
28877
|
-
throw new Error(
|
|
29522
|
+
throw new Error(MESSAGE_BUILDERS.PATH_NAME_TAKEN(appName));
|
|
28878
29523
|
}
|
|
28879
29524
|
}
|
|
28880
29525
|
async function deployNewApp(appName, routingName, systemName, deployVersion, envConfig, tags, clientId) {
|
|
28881
|
-
const endpoint = API_ENDPOINTS.DEPLOY_APP.replace("{systemName}", systemName).replace("{deployVersion}", String(deployVersion));
|
|
29526
|
+
const endpoint = API_ENDPOINTS.DEPLOY_APP.replace("{systemName}", encodeURIComponent(systemName)).replace("{deployVersion}", String(deployVersion));
|
|
28882
29527
|
const url = appendQueryParams(`${envConfig.baseUrl}/${envConfig.orgId}${endpoint}`, BASIC_ORIGIN_QUERY_PARAMS);
|
|
28883
29528
|
const body = { title: appName, routingName };
|
|
28884
29529
|
if (tags?.length) {
|
|
@@ -28982,12 +29627,21 @@ async function upgradeApp(params) {
|
|
|
28982
29627
|
await handleHttpError(response, MESSAGES.ERROR_CONTEXT.APP_UPGRADE, params.envConfig.accessToken);
|
|
28983
29628
|
return [];
|
|
28984
29629
|
}
|
|
28985
|
-
|
|
29630
|
+
function describeRecord(record) {
|
|
29631
|
+
if (!record.systemName)
|
|
29632
|
+
return;
|
|
29633
|
+
return record.appVersion ? `${record.systemName} ${record.appVersion}` : record.systemName;
|
|
29634
|
+
}
|
|
29635
|
+
async function updateAppConfig(update, logger2, recorded) {
|
|
28986
29636
|
const fsys = getFileSystem();
|
|
28987
29637
|
const configDir = fsys.path.join(fsys.env.cwd(), AUTH_CONSTANTS.FILES.UIPATH_DIR);
|
|
28988
29638
|
const configPath = fsys.path.join(configDir, AUTH_CONSTANTS.FILES.APP_CONFIG);
|
|
28989
29639
|
const [error2] = await catchError((async () => {
|
|
28990
29640
|
const config = await loadAppConfig(logger2) ?? {};
|
|
29641
|
+
if (config.systemName !== recorded.systemName || config.appVersion !== recorded.appVersion) {
|
|
29642
|
+
logger2.log(source_default.yellow(MESSAGE_BUILDERS.APP_CONFIG_CHANGED_DURING_DEPLOY(describeRecord(recorded), describeRecord(config))));
|
|
29643
|
+
return;
|
|
29644
|
+
}
|
|
28991
29645
|
if (update.deploymentId !== undefined) {
|
|
28992
29646
|
config.deploymentId = update.deploymentId;
|
|
28993
29647
|
}
|
|
@@ -29019,13 +29673,76 @@ function logDeployDetails(logger2, displayTitle, version, appUrl) {
|
|
|
29019
29673
|
}
|
|
29020
29674
|
logger2.log(` ${source_default.cyan("App URL:")} ${source_default.green(appUrl)}`);
|
|
29021
29675
|
}
|
|
29676
|
+
var FOLDER_PICKER_ENV_VARS = [
|
|
29677
|
+
AUTH_CONSTANTS.ENV_CONFIG.BASE_URL.envVar,
|
|
29678
|
+
AUTH_CONSTANTS.ENV_CONFIG.ORG_ID.envVar,
|
|
29679
|
+
AUTH_CONSTANTS.ENV_CONFIG.TENANT_ID.envVar,
|
|
29680
|
+
AUTH_CONSTANTS.ENV_CONFIG.ACCESS_TOKEN.envVar
|
|
29681
|
+
];
|
|
29682
|
+
function resolveFolderConnection(options) {
|
|
29683
|
+
const silent = { log: () => {
|
|
29684
|
+
return;
|
|
29685
|
+
} };
|
|
29686
|
+
const result = validateEnvironment(FOLDER_PICKER_ENV_VARS, silent, {
|
|
29687
|
+
baseUrl: options.baseUrl,
|
|
29688
|
+
orgId: options.orgId,
|
|
29689
|
+
orgName: options.orgName,
|
|
29690
|
+
tenantId: options.tenantId,
|
|
29691
|
+
accessToken: options.accessToken
|
|
29692
|
+
});
|
|
29693
|
+
const config = result.isValid ? result.config : undefined;
|
|
29694
|
+
if (!config?.baseUrl || !config.orgId || !config.accessToken) {
|
|
29695
|
+
return;
|
|
29696
|
+
}
|
|
29697
|
+
const tenant = config.tenantId || config.tenantName;
|
|
29698
|
+
if (!tenant)
|
|
29699
|
+
return;
|
|
29700
|
+
return {
|
|
29701
|
+
baseUrl: config.baseUrl,
|
|
29702
|
+
orgId: config.orgId,
|
|
29703
|
+
tenant,
|
|
29704
|
+
accessToken: config.accessToken
|
|
29705
|
+
};
|
|
29706
|
+
}
|
|
29707
|
+
function toFeedConnection(envConfig) {
|
|
29708
|
+
return {
|
|
29709
|
+
baseUrl: envConfig.baseUrl,
|
|
29710
|
+
orgId: envConfig.orgId,
|
|
29711
|
+
tenant: envConfig.tenantId,
|
|
29712
|
+
accessToken: envConfig.accessToken
|
|
29713
|
+
};
|
|
29714
|
+
}
|
|
29715
|
+
function savedRecordApplies(savedConfig, requestedName) {
|
|
29716
|
+
if (!savedConfig?.appName || requestedName === undefined)
|
|
29717
|
+
return true;
|
|
29718
|
+
const { sanitized } = sanitizeAppName(requestedName);
|
|
29719
|
+
return savedConfig.appName === sanitized || savedConfig.appName === legacySanitizedAppName(requestedName);
|
|
29720
|
+
}
|
|
29721
|
+
function feedScopeFromConfig(savedConfig) {
|
|
29722
|
+
if (!savedConfig)
|
|
29723
|
+
return;
|
|
29724
|
+
if (savedConfig.feedKind === "tenant") {
|
|
29725
|
+
return { personalWorkspace: false };
|
|
29726
|
+
}
|
|
29727
|
+
if (savedConfig.personalWorkspace === undefined && savedConfig.feedId === undefined) {
|
|
29728
|
+
return;
|
|
29729
|
+
}
|
|
29730
|
+
return {
|
|
29731
|
+
personalWorkspace: savedConfig.personalWorkspace,
|
|
29732
|
+
personalFeedId: savedConfig.personalWorkspace ? savedConfig.feedId : undefined,
|
|
29733
|
+
folderFeed: savedConfig.feedId && !savedConfig.personalWorkspace ? { feedId: savedConfig.feedId, feedName: savedConfig.feedName } : undefined
|
|
29734
|
+
};
|
|
29735
|
+
}
|
|
29022
29736
|
async function executeDeploy(options) {
|
|
29023
29737
|
const logger2 = options.logger ?? {
|
|
29024
29738
|
log: (msg) => logger.info(msg)
|
|
29025
29739
|
};
|
|
29026
29740
|
logger2.log(source_default.blue(MESSAGES.INFO.APP_DEPLOYMENT));
|
|
29027
29741
|
const savedConfig = await loadAppConfig(logger2);
|
|
29028
|
-
|
|
29742
|
+
const recordApplies = savedRecordApplies(savedConfig, options.packageName);
|
|
29743
|
+
const feedScope = recordApplies ? feedScopeFromConfig(savedConfig) : undefined;
|
|
29744
|
+
const folderConnection = resolveFolderConnection(options);
|
|
29745
|
+
await ensureFolderKey(logger2, options.folderKey, feedScope?.personalWorkspace, feedScope?.folderFeed, folderConnection);
|
|
29029
29746
|
const envConfig = getEnvironmentConfig(AUTH_CONSTANTS.REQUIRED_ENV_VARS.DEPLOY, logger2, {
|
|
29030
29747
|
baseUrl: options.baseUrl,
|
|
29031
29748
|
orgId: options.orgId,
|
|
@@ -29044,10 +29761,11 @@ async function executeDeploy(options) {
|
|
|
29044
29761
|
options.packageName = sanitized;
|
|
29045
29762
|
}
|
|
29046
29763
|
}
|
|
29047
|
-
const appName = options.packageName ?? await getAppName(logger2);
|
|
29764
|
+
const appName = options.packageName ?? await getAppName(savedConfig, logger2);
|
|
29048
29765
|
if (!appName)
|
|
29049
29766
|
throw new Error(MESSAGES.VALIDATIONS.APP_NAME_REQUIRED);
|
|
29050
|
-
const appConfig =
|
|
29767
|
+
const appConfig = recordApplies ? savedConfig : null;
|
|
29768
|
+
const registeredSystemName = appConfig?.systemName;
|
|
29051
29769
|
const displayTitle = options.displayName?.trim() || appConfig?.displayName || originalName || appName;
|
|
29052
29770
|
const deploymentTitleOverride = options.displayName?.trim() || undefined;
|
|
29053
29771
|
const legacyName = legacySanitizedAppName(originalName ?? appName);
|
|
@@ -29069,12 +29787,27 @@ async function executeDeploy(options) {
|
|
|
29069
29787
|
let spinner = ora(MESSAGES.INFO.CHECKING_DEPLOYMENT_STATUS).start();
|
|
29070
29788
|
const [deployError, deployResult] = await catchError((async () => {
|
|
29071
29789
|
const deployedApp = await getDeployedApp(appName, envConfig, legacyAppName);
|
|
29790
|
+
if (deployedApp && registeredSystemName && deployedApp.systemName !== registeredSystemName) {
|
|
29791
|
+
const message = MESSAGE_BUILDERS.DEPLOYED_APP_IS_ANOTHER(appName, deployedApp.systemName, registeredSystemName);
|
|
29792
|
+
spinner.fail(source_default.red(message));
|
|
29793
|
+
throw new Error(message);
|
|
29794
|
+
}
|
|
29795
|
+
if (feedScope && envConfig.folderKey) {
|
|
29796
|
+
const feedProblem = await checkFolderFeed(envConfig.folderKey, feedScope, toFeedConnection(envConfig));
|
|
29797
|
+
if (feedProblem) {
|
|
29798
|
+
if (!deployedApp) {
|
|
29799
|
+
spinner.fail(source_default.red(feedProblem));
|
|
29800
|
+
throw new Error(feedProblem);
|
|
29801
|
+
}
|
|
29802
|
+
logger2.log(source_default.yellow(`⚠️ ${feedProblem}`));
|
|
29803
|
+
}
|
|
29804
|
+
}
|
|
29072
29805
|
let operationResult;
|
|
29073
29806
|
if (deployedApp) {
|
|
29074
29807
|
spinner.text = MESSAGES.INFO.UPGRADING_APP;
|
|
29075
29808
|
const publishedApp = await getPublishedAppWithRetry(publishedLookupNames, envConfig, options.version, () => {
|
|
29076
29809
|
spinner.text = MESSAGES.INFO.WAITING_FOR_PUBLISHED_APP;
|
|
29077
|
-
});
|
|
29810
|
+
}, registeredSystemName);
|
|
29078
29811
|
if (!publishedApp) {
|
|
29079
29812
|
const notFoundMsg = buildNotPublishedMessage(options.version);
|
|
29080
29813
|
spinner.fail(source_default.red(notFoundMsg));
|
|
@@ -29100,8 +29833,7 @@ async function executeDeploy(options) {
|
|
|
29100
29833
|
});
|
|
29101
29834
|
spinner.succeed(source_default.green(MESSAGES.SUCCESS.APP_UPGRADED_SUCCESS));
|
|
29102
29835
|
logPlatformWarnings(upgradeWarnings, logger2);
|
|
29103
|
-
const
|
|
29104
|
-
const version = publishedApp.definition?.codedAppMetadata?.packageVersion ?? appConfig3?.appVersion ?? deployedApp.semVersion;
|
|
29836
|
+
const version = publishedApp.definition?.codedAppMetadata?.packageVersion ?? appConfig?.appVersion ?? deployedApp.semVersion;
|
|
29105
29837
|
operationResult = {
|
|
29106
29838
|
version,
|
|
29107
29839
|
deploymentId: deployedApp.id,
|
|
@@ -29119,7 +29851,7 @@ async function executeDeploy(options) {
|
|
|
29119
29851
|
spinner = ora(MESSAGES.INFO.DEPLOYING_APP).start();
|
|
29120
29852
|
const publishedApp = await getPublishedAppWithRetry(publishedLookupNames, envConfig, options.version, () => {
|
|
29121
29853
|
spinner.text = MESSAGES.INFO.WAITING_FOR_PUBLISHED_APP;
|
|
29122
|
-
});
|
|
29854
|
+
}, registeredSystemName);
|
|
29123
29855
|
if (!publishedApp) {
|
|
29124
29856
|
const notFoundMsg = buildNotPublishedMessage(options.version);
|
|
29125
29857
|
spinner.fail(source_default.red(notFoundMsg));
|
|
@@ -29132,8 +29864,7 @@ async function executeDeploy(options) {
|
|
|
29132
29864
|
const { id: deploymentId, warnings: deployWarnings } = await deployNewApp(displayTitle, routingName, publishedApp.systemName, publishedApp.deployVersion, envConfig, options.tags, options.clientId);
|
|
29133
29865
|
spinner.succeed(source_default.green(MESSAGES.SUCCESS.APP_DEPLOYED_SUCCESS));
|
|
29134
29866
|
logPlatformWarnings(deployWarnings, logger2);
|
|
29135
|
-
const
|
|
29136
|
-
const version = publishedApp.definition?.codedAppMetadata?.packageVersion ?? appConfig3?.appVersion ?? "1.0.0";
|
|
29867
|
+
const version = publishedApp.definition?.codedAppMetadata?.packageVersion ?? appConfig?.appVersion ?? "1.0.0";
|
|
29137
29868
|
operationResult = {
|
|
29138
29869
|
version,
|
|
29139
29870
|
deploymentId,
|
|
@@ -29145,21 +29876,27 @@ async function executeDeploy(options) {
|
|
|
29145
29876
|
Operation: "fresh_deploy"
|
|
29146
29877
|
});
|
|
29147
29878
|
}
|
|
29148
|
-
const
|
|
29149
|
-
const
|
|
29150
|
-
const
|
|
29151
|
-
const appUrl = isActionApp ? null : keepRecordedUrl || buildAppUrl({
|
|
29879
|
+
const isActionApp2 = appConfig?.appType === "Action" /* Action */;
|
|
29880
|
+
const keepRecordedUrl = operationResult.operation === "upgrade" && !options.pathName && appConfig?.appUrl;
|
|
29881
|
+
const appUrl = isActionApp2 ? null : keepRecordedUrl || buildAppUrl({
|
|
29152
29882
|
baseUrl: envConfig.baseUrl,
|
|
29153
29883
|
orgName: envConfig.orgName,
|
|
29154
29884
|
folderKey: envConfig.folderKey,
|
|
29155
|
-
systemName: operationResult.systemName ??
|
|
29885
|
+
systemName: operationResult.systemName ?? appConfig?.systemName,
|
|
29156
29886
|
routingName
|
|
29157
29887
|
});
|
|
29158
|
-
|
|
29159
|
-
|
|
29160
|
-
|
|
29161
|
-
|
|
29162
|
-
|
|
29888
|
+
if (recordApplies) {
|
|
29889
|
+
await updateAppConfig({
|
|
29890
|
+
deploymentId: operationResult.operation === "deploy" ? operationResult.deploymentId : undefined,
|
|
29891
|
+
displayName: options.displayName?.trim() || undefined,
|
|
29892
|
+
appUrl
|
|
29893
|
+
}, logger2, {
|
|
29894
|
+
systemName: registeredSystemName,
|
|
29895
|
+
appVersion: appConfig?.appVersion
|
|
29896
|
+
});
|
|
29897
|
+
} else {
|
|
29898
|
+
logger2.log(source_default.yellow(MESSAGE_BUILDERS.APP_CONFIG_IS_ANOTHER_APP(savedConfig?.appName ?? "another app", appName)));
|
|
29899
|
+
}
|
|
29163
29900
|
logDeployDetails(logger2, displayTitle, operationResult.version, appUrl);
|
|
29164
29901
|
return {
|
|
29165
29902
|
appName: displayTitle,
|
|
@@ -29178,8 +29915,7 @@ async function executeDeploy(options) {
|
|
|
29178
29915
|
}
|
|
29179
29916
|
return deployResult;
|
|
29180
29917
|
}
|
|
29181
|
-
async function getAppName(logger2) {
|
|
29182
|
-
const appConfig = await loadAppConfig(logger2);
|
|
29918
|
+
async function getAppName(appConfig, logger2) {
|
|
29183
29919
|
if (appConfig?.appName)
|
|
29184
29920
|
return appConfig.appName;
|
|
29185
29921
|
if (!canPrompt())
|
|
@@ -29522,7 +30258,7 @@ var package_default2 = {
|
|
|
29522
30258
|
name: "@uipath/solution-sdk",
|
|
29523
30259
|
author: "UiPath",
|
|
29524
30260
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
29525
|
-
version: "1.
|
|
30261
|
+
version: "1.205.0-preview.256",
|
|
29526
30262
|
repository: {
|
|
29527
30263
|
type: "git",
|
|
29528
30264
|
url: "https://github.com/UiPath/cli.git",
|
|
@@ -29551,6 +30287,14 @@ var package_default2 = {
|
|
|
29551
30287
|
"./auth": {
|
|
29552
30288
|
types: "./dist/src/solution-auth.d.ts",
|
|
29553
30289
|
default: "./dist/solution-auth.js"
|
|
30290
|
+
},
|
|
30291
|
+
"./deployments": {
|
|
30292
|
+
types: "./dist/src/deployment-search.d.ts",
|
|
30293
|
+
default: "./dist/deployment-search.js"
|
|
30294
|
+
},
|
|
30295
|
+
"./packages": {
|
|
30296
|
+
types: "./dist/src/package-search.d.ts",
|
|
30297
|
+
default: "./dist/package-search.js"
|
|
29554
30298
|
}
|
|
29555
30299
|
},
|
|
29556
30300
|
bin: {
|
|
@@ -29561,7 +30305,7 @@ var package_default2 = {
|
|
|
29561
30305
|
],
|
|
29562
30306
|
private: false,
|
|
29563
30307
|
scripts: {
|
|
29564
|
-
build: "bun build ./src/index.ts ./src/resources/index.ts ./src/solution-auth.ts --outdir dist --format esm --target node --splitting --sourcemap=linked && bun build ./src/scripts/generate-sdk.ts --outdir dist/scripts --format esm --target node --sourcemap=linked && tsc -p tsconfig.build.json --noCheck",
|
|
30308
|
+
build: "bun build ./src/index.ts ./src/resources/index.ts ./src/solution-auth.ts ./src/deployment-search.ts ./src/package-search.ts --outdir dist --format esm --target node --splitting --sourcemap=linked && bun build ./src/scripts/generate-sdk.ts --outdir dist/scripts --format esm --target node --sourcemap=linked && tsc -p tsconfig.build.json --noCheck",
|
|
29565
30309
|
generate: "bun run src/scripts/generate-sdk.ts",
|
|
29566
30310
|
lint: "biome check .",
|
|
29567
30311
|
test: "vitest run",
|
|
@@ -29573,7 +30317,8 @@ var package_default2 = {
|
|
|
29573
30317
|
"@uipath/common": "workspace:*",
|
|
29574
30318
|
"@uipath/filesystem": "workspace:*",
|
|
29575
30319
|
"@uipath/orchestrator-sdk": "workspace:*",
|
|
29576
|
-
"@uipath/
|
|
30320
|
+
"@uipath/pipelines-sdk": "workspace:*",
|
|
30321
|
+
"@uipath/resource-builder-sdk": "2025.11.0-alpha6584-4367",
|
|
29577
30322
|
"@uipath/solutionpackager-tool-core": "workspace:*",
|
|
29578
30323
|
"@uipath/studioweb-sdk": "workspace:*",
|
|
29579
30324
|
"@types/node": "^25.5.2",
|
|
@@ -29817,14 +30562,15 @@ var DEFAULT_EXCLUDED_DIR_NAMES = new Set([
|
|
|
29817
30562
|
"__pycache__",
|
|
29818
30563
|
".git",
|
|
29819
30564
|
".local",
|
|
29820
|
-
".flow-sdk"
|
|
30565
|
+
".flow-sdk",
|
|
30566
|
+
".flow-debug"
|
|
29821
30567
|
]);
|
|
29822
30568
|
// ../solution-sdk/src/project-debug-status.ts
|
|
29823
30569
|
var SUCCEEDED = "creationsucceeded";
|
|
29824
30570
|
var TERMINAL = new Set([SUCCEEDED, "creationfailed", "validationfailed"]);
|
|
29825
30571
|
// src/services/project-artifacts.ts
|
|
29826
30572
|
async function ensureProjectArtifacts(args) {
|
|
29827
|
-
const { addProjectArtifactsToSolutionAsync } = await import("./index-
|
|
30573
|
+
const { addProjectArtifactsToSolutionAsync } = await import("./index-0k30knwv.js");
|
|
29828
30574
|
return addProjectArtifactsToSolutionAsync(args);
|
|
29829
30575
|
}
|
|
29830
30576
|
|
|
@@ -29840,12 +30586,14 @@ var INIT_ERROR = {
|
|
|
29840
30586
|
TEMPLATE_INVALID: "INIT_TEMPLATE_INVALID",
|
|
29841
30587
|
TYPE_INVALID: "INIT_TYPE_INVALID",
|
|
29842
30588
|
DIR_NOT_EMPTY: "INIT_DIR_NOT_EMPTY",
|
|
29843
|
-
NOT_A_DIRECTORY: "INIT_NOT_A_DIRECTORY"
|
|
30589
|
+
NOT_A_DIRECTORY: "INIT_NOT_A_DIRECTORY",
|
|
30590
|
+
FILE_INVALID: "INIT_FILE_INVALID"
|
|
29844
30591
|
};
|
|
29845
30592
|
var DEFAULT_TEMPLATE = "form";
|
|
29846
30593
|
var PROJECT_UIPROJ_FILE = "project.uiproj";
|
|
29847
30594
|
var WEB_APP_MANIFEST_FILE = "webAppManifest.json";
|
|
29848
30595
|
var PACKAGE_JSON_FILE = "package.json";
|
|
30596
|
+
var ACTION_SCHEMA_FILE = "action-schema.json";
|
|
29849
30597
|
var UIPATH_SDK_PACKAGE = "@uipath/uipath-typescript";
|
|
29850
30598
|
var UIPATH_SDK_FALLBACK = "latest";
|
|
29851
30599
|
var SOURCE_DIR = "source";
|
|
@@ -29901,6 +30649,33 @@ function normalizeInitOptions(options) {
|
|
|
29901
30649
|
}
|
|
29902
30650
|
return { targetPath, name, template, isAction };
|
|
29903
30651
|
}
|
|
30652
|
+
function createActionSchema() {
|
|
30653
|
+
return `${JSON.stringify({
|
|
30654
|
+
inputs: {
|
|
30655
|
+
type: "object",
|
|
30656
|
+
properties: {
|
|
30657
|
+
input1: { type: "string" }
|
|
30658
|
+
}
|
|
30659
|
+
},
|
|
30660
|
+
outputs: {
|
|
30661
|
+
type: "object",
|
|
30662
|
+
properties: {
|
|
30663
|
+
output1: { type: "string" }
|
|
30664
|
+
}
|
|
30665
|
+
},
|
|
30666
|
+
inOuts: {
|
|
30667
|
+
type: "object",
|
|
30668
|
+
properties: {}
|
|
30669
|
+
},
|
|
30670
|
+
outcomes: {
|
|
30671
|
+
type: "object",
|
|
30672
|
+
properties: {
|
|
30673
|
+
Done: {}
|
|
30674
|
+
}
|
|
30675
|
+
}
|
|
30676
|
+
}, null, 2)}
|
|
30677
|
+
`;
|
|
30678
|
+
}
|
|
29904
30679
|
function createProjectUiproj(name) {
|
|
29905
30680
|
return `${JSON.stringify({
|
|
29906
30681
|
ProjectType: "AppV2" /* AppV2 */,
|
|
@@ -29911,14 +30686,17 @@ function createProjectUiproj(name) {
|
|
|
29911
30686
|
}, null, 2)}
|
|
29912
30687
|
`;
|
|
29913
30688
|
}
|
|
29914
|
-
function createWebAppManifest(isAction,
|
|
30689
|
+
function createWebAppManifest(isAction, bundlePath, existing) {
|
|
30690
|
+
const existingConfig = existing && typeof existing.config === "object" && existing.config ? existing.config : {};
|
|
29915
30691
|
const manifest = {
|
|
30692
|
+
...existing ?? {},
|
|
29916
30693
|
type: "Coded",
|
|
29917
30694
|
solutionResourceSubType: isAction ? "CodedAction" : "Coded",
|
|
29918
30695
|
config: {
|
|
30696
|
+
...existingConfig,
|
|
29919
30697
|
isCompiled: true,
|
|
29920
30698
|
isActionApp: isAction,
|
|
29921
|
-
bundlePath
|
|
30699
|
+
bundlePath
|
|
29922
30700
|
}
|
|
29923
30701
|
};
|
|
29924
30702
|
return `${JSON.stringify(manifest, null, 2)}
|
|
@@ -29955,6 +30733,11 @@ function createPackageJson(name, sdkVersion) {
|
|
|
29955
30733
|
function escapeHtml(value) {
|
|
29956
30734
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
29957
30735
|
}
|
|
30736
|
+
var STARTER_BODIES = {
|
|
30737
|
+
form: '<form><label>Name <input name="name" /></label><button type="submit">Submit</button></form>',
|
|
30738
|
+
dashboard: "<section><h2>Metrics</h2><p>Connect your data and publish this dashboard.</p></section>",
|
|
30739
|
+
"inline-automation": "<section><h2>Automation</h2><p>Trigger an inline automation from this starter app.</p></section>"
|
|
30740
|
+
};
|
|
29958
30741
|
function createIndexHtml(name, template) {
|
|
29959
30742
|
const escapedName = escapeHtml(name);
|
|
29960
30743
|
const heading = {
|
|
@@ -29962,11 +30745,7 @@ function createIndexHtml(name, template) {
|
|
|
29962
30745
|
dashboard: `${escapedName} Dashboard`,
|
|
29963
30746
|
"inline-automation": `${escapedName} Inline Automation`
|
|
29964
30747
|
}[template];
|
|
29965
|
-
const body =
|
|
29966
|
-
form: '<form><label>Name <input name="name" /></label><button type="submit">Submit</button></form>',
|
|
29967
|
-
dashboard: "<section><h2>Metrics</h2><p>Connect your data and publish this dashboard.</p></section>",
|
|
29968
|
-
"inline-automation": "<section><h2>Automation</h2><p>Trigger an inline automation from this starter app.</p></section>"
|
|
29969
|
-
}[template];
|
|
30748
|
+
const body = STARTER_BODIES[template];
|
|
29970
30749
|
return `<!doctype html>
|
|
29971
30750
|
<html lang="en">
|
|
29972
30751
|
<head>
|
|
@@ -29983,6 +30762,113 @@ function createIndexHtml(name, template) {
|
|
|
29983
30762
|
</html>
|
|
29984
30763
|
`;
|
|
29985
30764
|
}
|
|
30765
|
+
var BUILD_OUTPUT_CANDIDATES = [DIST_DIR, "build", "out"];
|
|
30766
|
+
async function holdsEntryPoint(folder) {
|
|
30767
|
+
const fs = getFileSystem();
|
|
30768
|
+
for (const candidate of HTML_ENTRY_POINT_CANDIDATES) {
|
|
30769
|
+
const stat = await fs.stat(fs.path.join(folder, candidate));
|
|
30770
|
+
if (stat?.isFile()) {
|
|
30771
|
+
return true;
|
|
30772
|
+
}
|
|
30773
|
+
}
|
|
30774
|
+
return false;
|
|
30775
|
+
}
|
|
30776
|
+
async function readJsonObject(path2) {
|
|
30777
|
+
const fs = getFileSystem();
|
|
30778
|
+
const raw = await fs.readFile(path2, "utf-8");
|
|
30779
|
+
if (raw === null) {
|
|
30780
|
+
return null;
|
|
30781
|
+
}
|
|
30782
|
+
const [parseError, parsed] = catchError(() => JSON.parse(raw));
|
|
30783
|
+
if (parseError) {
|
|
30784
|
+
throw new InitError(INIT_ERROR.FILE_INVALID, `${path2} is not valid JSON: ${parseError.message}`);
|
|
30785
|
+
}
|
|
30786
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
30787
|
+
throw new InitError(INIT_ERROR.FILE_INVALID, `${path2} must hold a JSON object.`);
|
|
30788
|
+
}
|
|
30789
|
+
return parsed;
|
|
30790
|
+
}
|
|
30791
|
+
async function hasRootBuildScript(targetPath) {
|
|
30792
|
+
const fs = getFileSystem();
|
|
30793
|
+
const pkg = await readJsonObject(fs.path.join(targetPath, PACKAGE_JSON_FILE));
|
|
30794
|
+
const scripts = pkg?.scripts;
|
|
30795
|
+
if (typeof scripts !== "object" || scripts === null) {
|
|
30796
|
+
return false;
|
|
30797
|
+
}
|
|
30798
|
+
const build = scripts.build;
|
|
30799
|
+
return typeof build === "string" && build.trim().length > 0;
|
|
30800
|
+
}
|
|
30801
|
+
function manifestDeclaresActionApp(manifest) {
|
|
30802
|
+
return isActionApp(manifest);
|
|
30803
|
+
}
|
|
30804
|
+
async function hasScaffoldedStarter(targetPath) {
|
|
30805
|
+
const fs = getFileSystem();
|
|
30806
|
+
const placeholder = fs.path.join(targetPath, SOURCE_DIR, DIST_DIR, "index.html");
|
|
30807
|
+
const stat = await fs.stat(placeholder);
|
|
30808
|
+
if (!stat?.isFile()) {
|
|
30809
|
+
return false;
|
|
30810
|
+
}
|
|
30811
|
+
const markup = await fs.readFile(placeholder, "utf-8");
|
|
30812
|
+
if (markup === null) {
|
|
30813
|
+
return false;
|
|
30814
|
+
}
|
|
30815
|
+
if (!Object.values(STARTER_BODIES).some((body) => markup.includes(body))) {
|
|
30816
|
+
return false;
|
|
30817
|
+
}
|
|
30818
|
+
return !/<script\b|<link\b/i.test(markup);
|
|
30819
|
+
}
|
|
30820
|
+
function readManifestBundlePath(manifest) {
|
|
30821
|
+
const config = manifest?.config;
|
|
30822
|
+
if (typeof config !== "object" || config === null) {
|
|
30823
|
+
return null;
|
|
30824
|
+
}
|
|
30825
|
+
const bundlePath = config.bundlePath;
|
|
30826
|
+
return typeof bundlePath === "string" && bundlePath.trim().length > 0 ? bundlePath : null;
|
|
30827
|
+
}
|
|
30828
|
+
async function detectExistingApp(targetPath, existingManifest) {
|
|
30829
|
+
const fs = getFileSystem();
|
|
30830
|
+
if (!await holdsEntryPoint(targetPath) && !await hasRootBuildScript(targetPath)) {
|
|
30831
|
+
return null;
|
|
30832
|
+
}
|
|
30833
|
+
const declared = readManifestBundlePath(existingManifest);
|
|
30834
|
+
if (declared !== null && (!isBundleRelativePath(declared) || !await isCanonicalBundleChild(fs, targetPath, declared))) {
|
|
30835
|
+
throw new InitError(INIT_ERROR.FILE_INVALID, `config.bundlePath "${declared}" must name a build output folder inside the project, not the project root or a parent folder.`);
|
|
30836
|
+
}
|
|
30837
|
+
const declaredIsLeftoverStarter = declared === IN_SOLUTION_BUNDLE_PATH && await hasScaffoldedStarter(targetPath);
|
|
30838
|
+
if (declared && !declaredIsLeftoverStarter) {
|
|
30839
|
+
return {
|
|
30840
|
+
bundlePath: declared,
|
|
30841
|
+
bundlePathSource: "existing-manifest"
|
|
30842
|
+
};
|
|
30843
|
+
}
|
|
30844
|
+
const leftoverNote = declaredIsLeftoverStarter ? ` A '${IN_SOLUTION_BUNDLE_PATH}' starter left by an earlier 'uip codedapp init --force' was ignored — it is not this app's build output. Delete '${SOURCE_DIR}/' once a pack looks right.` : "";
|
|
30845
|
+
const existingDirs = [];
|
|
30846
|
+
for (const candidate of BUILD_OUTPUT_CANDIDATES) {
|
|
30847
|
+
const candidatePath = fs.path.join(targetPath, candidate);
|
|
30848
|
+
const stat = await fs.stat(candidatePath);
|
|
30849
|
+
if (!stat?.isDirectory()) {
|
|
30850
|
+
continue;
|
|
30851
|
+
}
|
|
30852
|
+
if (!await isCanonicalBundleChild(fs, targetPath, candidate)) {
|
|
30853
|
+
throw new InitError(INIT_ERROR.FILE_INVALID, `Build output folder "${candidate}" resolves to the project root or outside the project. Use a child build output folder inside the project.`);
|
|
30854
|
+
}
|
|
30855
|
+
if (await holdsEntryPoint(candidatePath)) {
|
|
30856
|
+
return {
|
|
30857
|
+
bundlePath: candidate,
|
|
30858
|
+
bundlePathSource: "build-output",
|
|
30859
|
+
...leftoverNote ? { nextSteps: leftoverNote.trim() } : {}
|
|
30860
|
+
};
|
|
30861
|
+
}
|
|
30862
|
+
existingDirs.push(candidate);
|
|
30863
|
+
}
|
|
30864
|
+
const guess = existingDirs[0] ?? DIST_DIR;
|
|
30865
|
+
const advice = await hasRootBuildScript(targetPath) ? `Build the app, then set config.bundlePath in ${WEB_APP_MANIFEST_FILE} if it writes somewhere else.` : `This project declares no build script, so '${guess}' will not appear on its own: set config.bundlePath in ${WEB_APP_MANIFEST_FILE} to the folder holding the files to serve.`;
|
|
30866
|
+
return {
|
|
30867
|
+
bundlePath: guess,
|
|
30868
|
+
bundlePathSource: "default",
|
|
30869
|
+
nextSteps: `No built output was found, so bundlePath defaults to '${guess}'. ${advice}${leftoverNote}`
|
|
30870
|
+
};
|
|
30871
|
+
}
|
|
29986
30872
|
async function ensureWritableTarget(targetPath, force) {
|
|
29987
30873
|
const fs = getFileSystem();
|
|
29988
30874
|
const stat = await fs.stat(targetPath);
|
|
@@ -30000,7 +30886,12 @@ async function ensureWritableTarget(targetPath, force) {
|
|
|
30000
30886
|
}
|
|
30001
30887
|
async function executeInit(options) {
|
|
30002
30888
|
const fs = getFileSystem();
|
|
30003
|
-
const {
|
|
30889
|
+
const {
|
|
30890
|
+
targetPath,
|
|
30891
|
+
name,
|
|
30892
|
+
template,
|
|
30893
|
+
isAction: requestedIsAction
|
|
30894
|
+
} = normalizeInitOptions(options);
|
|
30004
30895
|
const skipSolutionRegistration = options.skipSolutionRegistration === true;
|
|
30005
30896
|
const inSolution = !skipSolutionRegistration && (await findNearestParentUipxFile(fs, targetPath)).status === "found";
|
|
30006
30897
|
const distParent = inSolution ? fs.path.join(targetPath, SOURCE_DIR) : targetPath;
|
|
@@ -30010,16 +30901,31 @@ async function executeInit(options) {
|
|
|
30010
30901
|
const packageJsonPath = fs.path.join(distParent, PACKAGE_JSON_FILE);
|
|
30011
30902
|
const projectPath = fs.path.join(targetPath, PROJECT_UIPROJ_FILE);
|
|
30012
30903
|
const webAppManifestPath = fs.path.join(targetPath, WEB_APP_MANIFEST_FILE);
|
|
30904
|
+
const actionSchemaPath = fs.path.join(targetPath, ACTION_SCHEMA_FILE);
|
|
30013
30905
|
await ensureWritableTarget(targetPath, options.force === true);
|
|
30014
|
-
|
|
30015
|
-
|
|
30906
|
+
const existingManifest = await readJsonObject(webAppManifestPath);
|
|
30907
|
+
const isAction = requestedIsAction || manifestDeclaresActionApp(existingManifest);
|
|
30908
|
+
const adoptedApp = await detectExistingApp(targetPath, existingManifest);
|
|
30909
|
+
const writtenFiles = [];
|
|
30910
|
+
if (!adoptedApp) {
|
|
30911
|
+
if (!await fs.exists(distPath)) {
|
|
30912
|
+
await fs.mkdir(distPath);
|
|
30913
|
+
}
|
|
30914
|
+
const sdkVersion = await resolveSdkVersion();
|
|
30915
|
+
await fs.writeFile(indexPath, createIndexHtml(name, template));
|
|
30916
|
+
await fs.writeFile(configPath, JSON.stringify(EMPTY_SDK_CONFIG, null, 2));
|
|
30917
|
+
await fs.writeFile(packageJsonPath, createPackageJson(name, sdkVersion));
|
|
30918
|
+
const relSource = (file) => inSolution ? `${SOURCE_DIR}/${file}` : file;
|
|
30919
|
+
writtenFiles.push(relSource(`${DIST_DIR}/index.html`), relSource(AUTH_CONSTANTS.FILES.SDK_CONFIG), relSource(PACKAGE_JSON_FILE));
|
|
30016
30920
|
}
|
|
30017
|
-
const sdkVersion = await resolveSdkVersion();
|
|
30018
|
-
await fs.writeFile(indexPath, createIndexHtml(name, template));
|
|
30019
|
-
await fs.writeFile(configPath, JSON.stringify(EMPTY_SDK_CONFIG, null, 2));
|
|
30020
|
-
await fs.writeFile(packageJsonPath, createPackageJson(name, sdkVersion));
|
|
30021
30921
|
await fs.writeFile(projectPath, createProjectUiproj(name));
|
|
30022
|
-
|
|
30922
|
+
const bundlePath = adoptedApp?.bundlePath ?? (inSolution ? IN_SOLUTION_BUNDLE_PATH : STANDALONE_BUNDLE_PATH);
|
|
30923
|
+
await fs.writeFile(webAppManifestPath, createWebAppManifest(isAction, bundlePath, existingManifest));
|
|
30924
|
+
writtenFiles.push(PROJECT_UIPROJ_FILE, WEB_APP_MANIFEST_FILE);
|
|
30925
|
+
if (isAction && !await fs.exists(actionSchemaPath)) {
|
|
30926
|
+
await fs.writeFile(actionSchemaPath, createActionSchema());
|
|
30927
|
+
writtenFiles.push(ACTION_SCHEMA_FILE);
|
|
30928
|
+
}
|
|
30023
30929
|
const solutionRegistration = await tryRegisterProjectInParentSolution(fs, targetPath, { skipRegistration: skipSolutionRegistration });
|
|
30024
30930
|
let projectArtifacts;
|
|
30025
30931
|
if ((solutionRegistration.Status === "Registered" || solutionRegistration.Status === "AlreadyRegistered") && solutionRegistration.Solution && solutionRegistration.ProjectId) {
|
|
@@ -30031,23 +30937,17 @@ async function executeInit(options) {
|
|
|
30031
30937
|
projectSubType: isAction ? "CodedAction" : "Coded"
|
|
30032
30938
|
});
|
|
30033
30939
|
}
|
|
30034
|
-
const relDist = inSolution ? `${SOURCE_DIR}/${DIST_DIR}/index.html` : `${DIST_DIR}/index.html`;
|
|
30035
|
-
const relConfig = inSolution ? `${SOURCE_DIR}/${AUTH_CONSTANTS.FILES.SDK_CONFIG}` : AUTH_CONSTANTS.FILES.SDK_CONFIG;
|
|
30036
|
-
const relPackageJson = inSolution ? `${SOURCE_DIR}/${PACKAGE_JSON_FILE}` : PACKAGE_JSON_FILE;
|
|
30037
30940
|
const result = {
|
|
30038
30941
|
path: targetPath,
|
|
30039
30942
|
name,
|
|
30040
30943
|
template,
|
|
30041
30944
|
isAction,
|
|
30042
|
-
files:
|
|
30043
|
-
relDist,
|
|
30044
|
-
relConfig,
|
|
30045
|
-
relPackageJson,
|
|
30046
|
-
PROJECT_UIPROJ_FILE,
|
|
30047
|
-
WEB_APP_MANIFEST_FILE
|
|
30048
|
-
],
|
|
30945
|
+
files: writtenFiles,
|
|
30049
30946
|
SolutionRegistration: solutionRegistration
|
|
30050
30947
|
};
|
|
30948
|
+
if (adoptedApp) {
|
|
30949
|
+
result.AdoptedApp = adoptedApp;
|
|
30950
|
+
}
|
|
30051
30951
|
if (projectArtifacts) {
|
|
30052
30952
|
result.ProjectArtifacts = projectArtifacts;
|
|
30053
30953
|
}
|
|
@@ -30116,7 +31016,8 @@ var INIT_FAILURE_INSTRUCTIONS = {
|
|
|
30116
31016
|
[INIT_ERROR.TEMPLATE_INVALID]: "Use --template form, --template dashboard, or --template inline-automation.",
|
|
30117
31017
|
[INIT_ERROR.TYPE_INVALID]: "Omit --type for a regular coded app, or pass --type Action for a coded Action app.",
|
|
30118
31018
|
[INIT_ERROR.DIR_NOT_EMPTY]: "Choose an empty directory or rerun with --force to write the starter files into the existing directory.",
|
|
30119
|
-
[INIT_ERROR.NOT_A_DIRECTORY]: "Choose a target directory path instead of an existing file path."
|
|
31019
|
+
[INIT_ERROR.NOT_A_DIRECTORY]: "Choose a target directory path instead of an existing file path.",
|
|
31020
|
+
[INIT_ERROR.FILE_INVALID]: "Fix the reported file so it holds a JSON object, then re-run. Init stops rather than overwrite a file it cannot read — rewriting webAppManifest.json would drop the projectId that keeps the packed app's identity stable."
|
|
30120
31021
|
};
|
|
30121
31022
|
function getInitFailureInstructions(error2) {
|
|
30122
31023
|
if (error2 instanceof InitError) {
|
|
@@ -30153,17 +31054,54 @@ var registerInitCommand = (program) => {
|
|
|
30153
31054
|
async function validateDistDirectory(distDir) {
|
|
30154
31055
|
const fs = getFileSystem();
|
|
30155
31056
|
const stat = await fs.stat(distDir);
|
|
30156
|
-
|
|
30157
|
-
return false;
|
|
30158
|
-
const entries = await fs.readdir(distDir);
|
|
30159
|
-
return entries.length > 0;
|
|
31057
|
+
return stat?.isDirectory() === true;
|
|
30160
31058
|
}
|
|
30161
|
-
|
|
31059
|
+
var PROJECT_FOLDERS = [
|
|
31060
|
+
"node_modules",
|
|
31061
|
+
"bower_components",
|
|
31062
|
+
"jspm_packages",
|
|
31063
|
+
".next",
|
|
31064
|
+
".nuxt",
|
|
31065
|
+
".svelte-kit",
|
|
31066
|
+
".angular"
|
|
31067
|
+
];
|
|
31068
|
+
var PROJECT_ROOT_FILES = ["package.json"];
|
|
31069
|
+
async function findProjectEntry(distDir) {
|
|
30162
31070
|
const fs = getFileSystem();
|
|
30163
|
-
const
|
|
30164
|
-
|
|
30165
|
-
|
|
30166
|
-
|
|
31071
|
+
const topEntries = await fs.readdir(distDir);
|
|
31072
|
+
const topMatch = [...PROJECT_FOLDERS, ...PROJECT_ROOT_FILES].find((name) => topEntries.includes(name));
|
|
31073
|
+
if (topMatch)
|
|
31074
|
+
return topMatch;
|
|
31075
|
+
const visited = new Set;
|
|
31076
|
+
const queue = [""];
|
|
31077
|
+
while (queue.length > 0) {
|
|
31078
|
+
const relativeDir = queue.shift();
|
|
31079
|
+
const dir = relativeDir ? fs.path.join(distDir, relativeDir) : distDir;
|
|
31080
|
+
const realDir = await fs.realpath(dir).catch(() => dir);
|
|
31081
|
+
if (visited.has(realDir)) {
|
|
31082
|
+
throw new Error(MESSAGE_BUILDERS.SYMLINK_IN_BUILD_DIRECTORY(relativeDir));
|
|
31083
|
+
}
|
|
31084
|
+
visited.add(realDir);
|
|
31085
|
+
const entries = relativeDir ? await fs.readdir(dir) : topEntries;
|
|
31086
|
+
for (const entry of entries) {
|
|
31087
|
+
const relativePath = relativeDir ? `${relativeDir}/${entry}` : entry;
|
|
31088
|
+
if (PROJECT_FOLDERS.includes(entry))
|
|
31089
|
+
return relativePath;
|
|
31090
|
+
const stat = await fs.stat(fs.path.join(distDir, relativePath)).catch((err) => {
|
|
31091
|
+
if (err.code !== "ELOOP")
|
|
31092
|
+
throw err;
|
|
31093
|
+
throw new Error(MESSAGE_BUILDERS.SYMLINK_IN_BUILD_DIRECTORY(relativePath));
|
|
31094
|
+
});
|
|
31095
|
+
if (stat?.isDirectory())
|
|
31096
|
+
queue.push(relativePath);
|
|
31097
|
+
}
|
|
31098
|
+
}
|
|
31099
|
+
return;
|
|
31100
|
+
}
|
|
31101
|
+
async function hasAbsoluteAssetPaths(distDir, entryPoint) {
|
|
31102
|
+
const fs = getFileSystem();
|
|
31103
|
+
const entryPath = fs.path.join(distDir, entryPoint);
|
|
31104
|
+
const html = await fs.readFile(entryPath, "utf-8");
|
|
30167
31105
|
if (!html)
|
|
30168
31106
|
return false;
|
|
30169
31107
|
const attrPattern = /(?:src|href)\s*=\s*["']\/(?!\/|https?:|data:)[^"']*["']/gi;
|
|
@@ -30219,27 +31157,32 @@ function createToolLogger(logger2) {
|
|
|
30219
31157
|
logMessage: noop
|
|
30220
31158
|
};
|
|
30221
31159
|
}
|
|
31160
|
+
async function readPackManifest() {
|
|
31161
|
+
const fs = getFileSystem();
|
|
31162
|
+
const path2 = fs.path.join(fs.env.cwd(), WEBAPP_MANIFEST_FILE_NAME);
|
|
31163
|
+
if (!await fs.exists(path2))
|
|
31164
|
+
return null;
|
|
31165
|
+
const content = await fs.readFile(path2, "utf-8");
|
|
31166
|
+
if (content === null)
|
|
31167
|
+
return null;
|
|
31168
|
+
const parsed = JSON.parse(content);
|
|
31169
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
31170
|
+
throw new Error(`Invalid ${WEBAPP_MANIFEST_FILE_NAME}: expected an object.`);
|
|
31171
|
+
}
|
|
31172
|
+
return parsed;
|
|
31173
|
+
}
|
|
30222
31174
|
async function packageWithFactory(config, logger2) {
|
|
30223
31175
|
const fs = getFileSystem();
|
|
30224
31176
|
const cwd = fs.env.cwd();
|
|
30225
31177
|
const distAbs = fs.path.resolve(config.distDir);
|
|
30226
31178
|
const bundlePath = fs.path.relative(cwd, distAbs) || ".";
|
|
30227
|
-
const manifest = {
|
|
30228
|
-
type: "Coded" /* Coded */,
|
|
30229
|
-
solutionResourceSubType: "Coded" /* Coded */,
|
|
30230
|
-
config: { isCompiled: true, bundlePath }
|
|
30231
|
-
};
|
|
30232
|
-
const manifestPath = fs.path.join(cwd, WEBAPP_MANIFEST_FILE_NAME);
|
|
30233
|
-
const manifestPreExisted = await fs.exists(manifestPath);
|
|
30234
|
-
if (!manifestPreExisted) {
|
|
30235
|
-
await fs.writeFile(manifestPath, JSON.stringify(manifest, null, 2));
|
|
30236
|
-
}
|
|
30237
31179
|
const factory = new WebAppToolFactory;
|
|
30238
31180
|
let tool;
|
|
30239
31181
|
try {
|
|
30240
31182
|
tool = await factory.createAsync(createToolLogger(logger2), fs);
|
|
30241
31183
|
const result = await tool.packAsync({
|
|
30242
31184
|
projectPath: cwd,
|
|
31185
|
+
codedBundle: { bundlePath, mainFile: config.mainFile },
|
|
30243
31186
|
outputPath: config.outputDir,
|
|
30244
31187
|
projectType: "AppV2" /* AppV2 */,
|
|
30245
31188
|
package: {
|
|
@@ -30266,12 +31209,6 @@ async function packageWithFactory(config, logger2) {
|
|
|
30266
31209
|
if (tool) {
|
|
30267
31210
|
await tool.dispose();
|
|
30268
31211
|
}
|
|
30269
|
-
if (!manifestPreExisted) {
|
|
30270
|
-
const [rmError] = await catchError(fs.rm(manifestPath));
|
|
30271
|
-
if (rmError) {
|
|
30272
|
-
logger2.log(source_default.yellow(`Failed to remove temporary ${WEBAPP_MANIFEST_FILE_NAME}: ${rmError.message}`));
|
|
30273
|
-
}
|
|
30274
|
-
}
|
|
30275
31212
|
}
|
|
30276
31213
|
}
|
|
30277
31214
|
async function handleMetadataJson(config) {
|
|
@@ -30307,12 +31244,43 @@ async function executePack(options) {
|
|
|
30307
31244
|
if (!await validateDistDirectory(distDir)) {
|
|
30308
31245
|
throw new Error(`${MESSAGES.ERRORS.INVALID_DIST_DIRECTORY}: ${distDir}`);
|
|
30309
31246
|
}
|
|
31247
|
+
const projectEntry = await findProjectEntry(distDir);
|
|
31248
|
+
if (projectEntry) {
|
|
31249
|
+
throw new Error(MESSAGE_BUILDERS.PROJECT_FILES_IN_BUILD_DIRECTORY(projectEntry));
|
|
31250
|
+
}
|
|
30310
31251
|
const fs = getFileSystem();
|
|
30311
|
-
const
|
|
30312
|
-
|
|
30313
|
-
|
|
31252
|
+
const manifest = await readPackManifest();
|
|
31253
|
+
const declaredMainFile = options.mainFile ?? manifest?.config?.mainFile;
|
|
31254
|
+
let entryPoint = null;
|
|
31255
|
+
if (declaredMainFile !== undefined) {
|
|
31256
|
+
if (typeof declaredMainFile !== "string") {
|
|
31257
|
+
throw new Error(ERROR_MESSAGES.MAIN_FILE_INVALID_TYPE);
|
|
31258
|
+
}
|
|
31259
|
+
const mainFile = normalizeBundlePath(declaredMainFile);
|
|
31260
|
+
if (!isBundleRelativePath(mainFile)) {
|
|
31261
|
+
throw new Error(MESSAGE_BUILDERS.MAIN_FILE_OUTSIDE_BUNDLE(mainFile));
|
|
31262
|
+
}
|
|
31263
|
+
if (!isHtmlEntryPointPath(mainFile)) {
|
|
31264
|
+
throw new Error(`Main file "${mainFile}" must be an HTML file inside ${distDir}.`);
|
|
31265
|
+
}
|
|
31266
|
+
const resolved = await resolveHtmlEntryPoint(fs, distDir, mainFile);
|
|
31267
|
+
if (resolved === null) {
|
|
31268
|
+
throw new Error(MESSAGE_BUILDERS.MAIN_FILE_NOT_IN_BUNDLE(mainFile, distDir));
|
|
31269
|
+
}
|
|
31270
|
+
entryPoint = resolved;
|
|
31271
|
+
} else {
|
|
31272
|
+
for (const candidate of HTML_ENTRY_POINT_CANDIDATES) {
|
|
31273
|
+
const resolved = await resolveHtmlEntryPoint(fs, distDir, candidate);
|
|
31274
|
+
if (resolved !== null) {
|
|
31275
|
+
entryPoint = resolved;
|
|
31276
|
+
break;
|
|
31277
|
+
}
|
|
31278
|
+
}
|
|
31279
|
+
if (entryPoint === null) {
|
|
31280
|
+
throw new Error(MESSAGE_BUILDERS.MISSING_INDEX_HTML(distDir));
|
|
31281
|
+
}
|
|
30314
31282
|
}
|
|
30315
|
-
if (await hasAbsoluteAssetPaths(distDir)) {
|
|
31283
|
+
if (await hasAbsoluteAssetPaths(distDir, entryPoint)) {
|
|
30316
31284
|
logger2.log(source_default.yellow(MESSAGES.INFO.ABSOLUTE_ASSET_PATHS_DETECTED));
|
|
30317
31285
|
}
|
|
30318
31286
|
let packageName = options.name;
|
|
@@ -30355,7 +31323,7 @@ async function executePack(options) {
|
|
|
30355
31323
|
version,
|
|
30356
31324
|
author: options.author ?? "UiPath Developer",
|
|
30357
31325
|
description,
|
|
30358
|
-
mainFile:
|
|
31326
|
+
mainFile: entryPoint,
|
|
30359
31327
|
contentType: options.contentType ?? "webapp",
|
|
30360
31328
|
outputDir: options.output ?? "./.uipath",
|
|
30361
31329
|
sdkConfig,
|
|
@@ -30507,7 +31475,7 @@ var buildSuccessEnvelope = (result) => {
|
|
|
30507
31475
|
};
|
|
30508
31476
|
};
|
|
30509
31477
|
var registerPackCommand = (program) => {
|
|
30510
|
-
const command = program.command("pack").description("Pack a coded app project into a .nupkg file").argument("<dist>", "Path to the dist folder containing the built application").option("-n, --name <name>", "Package name").option("--display-name <name>", "Human-readable app title shown in UiPath (defaults to --name as typed)").option("-v, --version <version>", "Package version", "1.0.0").option("--output-dir <dir>", "Output directory for the .nupkg").addOption(new Option("-o, --output <dir>", "Deprecated alias for --output-dir").hideHelp()).option("--main-file <file>", "Main entry file
|
|
31478
|
+
const command = program.command("pack").description("Pack a coded app project into a .nupkg file").argument("<dist>", "Path to the dist folder containing the built application").option("-n, --name <name>", "Package name").option("--display-name <name>", "Human-readable app title shown in UiPath (defaults to --name as typed)").option("-v, --version <version>", "Package version", "1.0.0").option("--output-dir <dir>", "Output directory for the .nupkg").addOption(new Option("-o, --output <dir>", "Deprecated alias for --output-dir").hideHelp()).option("--main-file <file>", "Main entry file (defaults to the HTML entry point found in the bundle)").option("--content-type <type>", "Content type (webapp, library, process)", "webapp").option("--dry-run", "Show what would be packaged without creating the package");
|
|
30511
31479
|
registerPackageMetadataOptions(command).examples(PACK_EXAMPLES).trackedAction(processContext, async (dist, options) => {
|
|
30512
31480
|
if (options.outputDir !== undefined && options.output !== undefined) {
|
|
30513
31481
|
OutputFormatter.error({
|
|
@@ -30568,6 +31536,53 @@ async function readActionSchemaFile() {
|
|
|
30568
31536
|
}
|
|
30569
31537
|
|
|
30570
31538
|
// src/actions/publish.ts
|
|
31539
|
+
var TENANT_FEED = { kind: "tenant" };
|
|
31540
|
+
function wireFeedId(target) {
|
|
31541
|
+
if (target.kind !== "tenant" || target.explicit)
|
|
31542
|
+
return target.feedId;
|
|
31543
|
+
return;
|
|
31544
|
+
}
|
|
31545
|
+
var TENANT_FEED_CORE_NAME = "tenant processes";
|
|
31546
|
+
function isNamedAsTenantFeed(feed) {
|
|
31547
|
+
return feedCoreName(feed.name) === TENANT_FEED_CORE_NAME;
|
|
31548
|
+
}
|
|
31549
|
+
async function tenantFeedTarget(envConfig, knownFeeds) {
|
|
31550
|
+
let feeds = knownFeeds;
|
|
31551
|
+
if (!feeds) {
|
|
31552
|
+
const [listError, listed] = await catchError(listPublishableProcessFeeds(toFeedConnection2(envConfig)));
|
|
31553
|
+
feeds = listError || !listed ? [] : listed;
|
|
31554
|
+
}
|
|
31555
|
+
const { status, candidate } = await resolveTenantCandidate(feeds, envConfig);
|
|
31556
|
+
if (status !== "tenant" || !candidate)
|
|
31557
|
+
return TENANT_FEED;
|
|
31558
|
+
return { kind: "tenant", feedId: candidate.id, name: candidate.name };
|
|
31559
|
+
}
|
|
31560
|
+
async function ownedByFolder(feed, connection) {
|
|
31561
|
+
const folderName = feedCoreName(feed.name);
|
|
31562
|
+
if (!folderName)
|
|
31563
|
+
return false;
|
|
31564
|
+
const [listError, folders] = await catchError(findFoldersByName(connection, folderName));
|
|
31565
|
+
if (listError || !folders)
|
|
31566
|
+
return;
|
|
31567
|
+
let unanswered = false;
|
|
31568
|
+
for (const folder of folders) {
|
|
31569
|
+
const [feedError, owned] = await catchError(getFolderFeedId(connection, folder.key));
|
|
31570
|
+
if (feedError) {
|
|
31571
|
+
unanswered = true;
|
|
31572
|
+
continue;
|
|
31573
|
+
}
|
|
31574
|
+
if (sameFeedId(owned, feed.id))
|
|
31575
|
+
return true;
|
|
31576
|
+
}
|
|
31577
|
+
return unanswered ? undefined : false;
|
|
31578
|
+
}
|
|
31579
|
+
function nuGetFeeds(feeds) {
|
|
31580
|
+
return feeds.filter(isNuGetFeed);
|
|
31581
|
+
}
|
|
31582
|
+
function tenantFeedOf(feeds, personalFeedId) {
|
|
31583
|
+
const candidates = nuGetFeeds(feeds).filter((feed) => isTenantFeed(feed) && isNamedAsTenantFeed(feed) && !(personalFeedId && sameFeedId(feed.id, personalFeedId)));
|
|
31584
|
+
return candidates.length === 1 ? candidates[0] : undefined;
|
|
31585
|
+
}
|
|
30571
31586
|
function extractPackageMetadata(packagePath) {
|
|
30572
31587
|
const filename = getFileSystem().path.basename(packagePath, ".nupkg");
|
|
30573
31588
|
const parts = filename.split(".");
|
|
@@ -30597,15 +31612,18 @@ async function readDisplayName(uipathDir) {
|
|
|
30597
31612
|
return;
|
|
30598
31613
|
return parsed.displayName;
|
|
30599
31614
|
}
|
|
30600
|
-
|
|
31615
|
+
function fetchCurrentUserExtended(envConfig) {
|
|
30601
31616
|
const url = appendQueryParams(`${envConfig.baseUrl}/${envConfig.orgId}/${envConfig.tenantId}${API_ENDPOINTS.ORCH_CURRENT_USER_EXTENDED}`, BASIC_ORIGIN_QUERY_PARAMS);
|
|
30602
|
-
|
|
31617
|
+
return fetch(url, {
|
|
30603
31618
|
method: "GET",
|
|
30604
31619
|
headers: createHeaders({
|
|
30605
31620
|
bearerToken: envConfig.accessToken,
|
|
30606
31621
|
tenantId: envConfig.tenantId
|
|
30607
31622
|
})
|
|
30608
31623
|
});
|
|
31624
|
+
}
|
|
31625
|
+
async function getPersonalWorkspaceFeedId(envConfig) {
|
|
31626
|
+
const response = await fetchCurrentUserExtended(envConfig);
|
|
30609
31627
|
if (!response.ok) {
|
|
30610
31628
|
await handleHttpError(response, MESSAGES.ERROR_CONTEXT.PERSONAL_WORKSPACE_LOOKUP);
|
|
30611
31629
|
}
|
|
@@ -30653,11 +31671,12 @@ async function uploadPackage(packagePath, envConfig, spinner, feedId) {
|
|
|
30653
31671
|
throw new Error(`${MESSAGES.ERRORS.PACKAGE_UPLOAD_FAILED} ${responseText}`);
|
|
30654
31672
|
}
|
|
30655
31673
|
}
|
|
30656
|
-
async function registerCodedApp(metadata, envConfig,
|
|
31674
|
+
async function registerCodedApp(metadata, envConfig, isActionApp2, feedTarget, logger2) {
|
|
30657
31675
|
const url = appendQueryParams(`${envConfig.baseUrl}/${envConfig.orgId}${API_ENDPOINTS.PUBLISH_CODED_APP}`, BASIC_ORIGIN_QUERY_PARAMS);
|
|
31676
|
+
const feedId = wireFeedId(feedTarget);
|
|
30658
31677
|
let actionSchema = {};
|
|
30659
|
-
if (
|
|
30660
|
-
const appName = feedId ? `${metadata.packageName}@${feedId}` : metadata.packageName;
|
|
31678
|
+
if (isActionApp2) {
|
|
31679
|
+
const appName = feedTarget.kind !== "tenant" && feedId ? `${metadata.packageName}@${feedId}` : metadata.packageName;
|
|
30661
31680
|
const [schemaError, parsedSchema] = await catchError(readAndParseActionSchema(appName));
|
|
30662
31681
|
if (schemaError) {
|
|
30663
31682
|
logger2.log("");
|
|
@@ -30685,10 +31704,69 @@ async function registerCodedApp(metadata, envConfig, isActionApp, feedId, logger
|
|
|
30685
31704
|
body: JSON.stringify(payload)
|
|
30686
31705
|
});
|
|
30687
31706
|
if (!response.ok) {
|
|
31707
|
+
const existing = await readAlreadyRegistered(response, metadata);
|
|
31708
|
+
if (existing) {
|
|
31709
|
+
await verifyExistingRegistration(existing, metadata, envConfig, isActionApp2, feedTarget, logger2);
|
|
31710
|
+
return existing;
|
|
31711
|
+
}
|
|
30688
31712
|
await handleHttpError(response, MESSAGES.ERROR_CONTEXT.CODED_APP_REGISTRATION, envConfig.accessToken);
|
|
30689
31713
|
}
|
|
30690
31714
|
return await response.json();
|
|
30691
31715
|
}
|
|
31716
|
+
var APP_USAGE_TYPE_ACTION = 1;
|
|
31717
|
+
async function verifyExistingRegistration(existing, metadata, envConfig, isActionApp2, feedTarget, logger2) {
|
|
31718
|
+
const feedId = feedTarget.feedId;
|
|
31719
|
+
const systemName = existing.definition.systemName;
|
|
31720
|
+
const endpoint = API_ENDPOINTS.PUBLISHED_APP_VERSIONS.replace("{systemName}", encodeURIComponent(systemName)).replace("{tenantId}", encodeURIComponent(envConfig.tenantId));
|
|
31721
|
+
const url = appendQueryParams(`${envConfig.baseUrl}/${encodeURIComponent(envConfig.orgId)}${endpoint}?top=1000`, BASIC_ORIGIN_QUERY_PARAMS);
|
|
31722
|
+
const response = await fetch(url, {
|
|
31723
|
+
method: "GET",
|
|
31724
|
+
headers: createHeaders({
|
|
31725
|
+
bearerToken: envConfig.accessToken,
|
|
31726
|
+
tenantId: envConfig.tenantId
|
|
31727
|
+
})
|
|
31728
|
+
});
|
|
31729
|
+
if (!response.ok) {
|
|
31730
|
+
await handleHttpError(response, MESSAGES.ERROR_CONTEXT.CODED_APP_REGISTRATION, envConfig.accessToken);
|
|
31731
|
+
}
|
|
31732
|
+
const versions = await response.json();
|
|
31733
|
+
const row = versions.value?.find((v) => v.definition?.codedAppMetadata?.packageVersion === metadata.packageVersion);
|
|
31734
|
+
if (!row) {
|
|
31735
|
+
throw new Error(MESSAGE_BUILDERS.CODED_APP_ALREADY_REGISTERED_UNVERIFIED(systemName, metadata.packageVersion));
|
|
31736
|
+
}
|
|
31737
|
+
if (row.appUsageType === undefined) {
|
|
31738
|
+
throw new Error(MESSAGE_BUILDERS.CODED_APP_ALREADY_REGISTERED_UNVERIFIED(systemName, metadata.packageVersion));
|
|
31739
|
+
}
|
|
31740
|
+
const registeredAsAction = row.appUsageType === APP_USAGE_TYPE_ACTION;
|
|
31741
|
+
if (registeredAsAction !== isActionApp2) {
|
|
31742
|
+
throw new Error(MESSAGE_BUILDERS.CODED_APP_ALREADY_REGISTERED_OTHER_TYPE(isActionApp2 ? "Action" : "Web", registeredAsAction ? "Action" : "Web"));
|
|
31743
|
+
}
|
|
31744
|
+
const registeredFeedId = row.feed?.feedId ?? undefined;
|
|
31745
|
+
const cannotCompare = !row.feed || feedTarget.kind === "tenant" && !feedId && Boolean(registeredFeedId);
|
|
31746
|
+
if (cannotCompare) {
|
|
31747
|
+
throw new Error(MESSAGE_BUILDERS.CODED_APP_ALREADY_REGISTERED_FEED_UNVERIFIABLE(systemName));
|
|
31748
|
+
}
|
|
31749
|
+
const sameFeed = sameFeedId(registeredFeedId, feedId) || feedTarget.kind === "tenant" && !registeredFeedId;
|
|
31750
|
+
if (!sameFeed) {
|
|
31751
|
+
throw new Error(MESSAGE_BUILDERS.CODED_APP_ALREADY_REGISTERED_OTHER_FEED(registeredFeedId ? `feed ${registeredFeedId}` : "the tenant feed", feedTarget.kind === "tenant" || !feedId ? "the tenant feed" : `feed ${feedId}`));
|
|
31752
|
+
}
|
|
31753
|
+
logger2.log(source_default.yellow(MESSAGES.INFO.CODED_APP_ALREADY_REGISTERED));
|
|
31754
|
+
}
|
|
31755
|
+
async function readAlreadyRegistered(response, metadata) {
|
|
31756
|
+
if (response.status !== 400)
|
|
31757
|
+
return;
|
|
31758
|
+
const [parseError, body] = await catchError(response.clone().json());
|
|
31759
|
+
if (parseError || !body?.appId)
|
|
31760
|
+
return;
|
|
31761
|
+
const message = body.errorMessageV2 ?? "";
|
|
31762
|
+
const sameVersion = message.includes("already exists") && message.includes(`'${metadata.packageName}'`) && message.includes(`'${metadata.packageVersion}'`);
|
|
31763
|
+
if (!sameVersion)
|
|
31764
|
+
return;
|
|
31765
|
+
return {
|
|
31766
|
+
definition: { systemName: body.appId },
|
|
31767
|
+
deployVersion: body.deployVersion
|
|
31768
|
+
};
|
|
31769
|
+
}
|
|
30692
31770
|
async function resolveAppType(explicit, logger2) {
|
|
30693
31771
|
if (explicit !== undefined)
|
|
30694
31772
|
return explicit;
|
|
@@ -30713,20 +31791,247 @@ async function resolveAppType(explicit, logger2) {
|
|
|
30713
31791
|
]);
|
|
30714
31792
|
return asAction ? "Action" /* Action */ : "Web" /* Web */;
|
|
30715
31793
|
}
|
|
30716
|
-
|
|
30717
|
-
|
|
30718
|
-
|
|
30719
|
-
|
|
30720
|
-
|
|
30721
|
-
|
|
31794
|
+
function toFeedConnection2(envConfig) {
|
|
31795
|
+
return {
|
|
31796
|
+
baseUrl: envConfig.baseUrl,
|
|
31797
|
+
orgId: envConfig.orgId,
|
|
31798
|
+
tenant: envConfig.tenantId,
|
|
31799
|
+
accessToken: envConfig.accessToken
|
|
31800
|
+
};
|
|
31801
|
+
}
|
|
31802
|
+
async function resolveFeedTarget(options, envConfig, logger2) {
|
|
31803
|
+
const wantsPersonal = options.personalWorkspace === true;
|
|
31804
|
+
const picked = [
|
|
31805
|
+
options.tenantFeed === true,
|
|
31806
|
+
wantsPersonal,
|
|
31807
|
+
options.folderPath !== undefined,
|
|
31808
|
+
options.folderKey !== undefined,
|
|
31809
|
+
options.feedId !== undefined
|
|
31810
|
+
].filter(Boolean).length;
|
|
31811
|
+
if (picked > 1) {
|
|
31812
|
+
throw new Error(MESSAGES.ERRORS.FEED_OPTIONS_CONFLICT);
|
|
31813
|
+
}
|
|
31814
|
+
const folderPath = requireValue(options.folderPath, "--folder-path");
|
|
31815
|
+
const folderKey = requireValue(options.folderKey, "--folder-key");
|
|
31816
|
+
const feedId = requireValue(options.feedId, "--feed-id");
|
|
31817
|
+
if (options.tenantFeed) {
|
|
31818
|
+
return tenantFeedTarget(envConfig);
|
|
31819
|
+
}
|
|
31820
|
+
if (feedId !== undefined) {
|
|
31821
|
+
return classifyExplicitFeed(feedId, envConfig, logger2);
|
|
31822
|
+
}
|
|
31823
|
+
if (folderPath !== undefined) {
|
|
31824
|
+
return resolveFolderFeedByName(folderPath, envConfig, logger2);
|
|
31825
|
+
}
|
|
31826
|
+
if (folderKey !== undefined) {
|
|
31827
|
+
logger2.log(source_default.dim(MESSAGES.INFO.RESOLVING_FOLDER_FEED));
|
|
31828
|
+
const resolved = await getFolderFeedId(toFeedConnection2(envConfig), folderKey);
|
|
31829
|
+
if (!resolved) {
|
|
31830
|
+
logger2.log(source_default.yellow(MESSAGES.INFO.FOLDER_USES_TENANT_FEED));
|
|
31831
|
+
return tenantFeedTarget(envConfig);
|
|
31832
|
+
}
|
|
31833
|
+
return classifyFeed(resolved, envConfig, logger2, undefined, true);
|
|
31834
|
+
}
|
|
31835
|
+
if (wantsPersonal) {
|
|
31836
|
+
logger2.log(source_default.dim(MESSAGES.INFO.RESOLVING_PERSONAL_WORKSPACE_FEED));
|
|
31837
|
+
const pwFeedId = await getPersonalWorkspaceFeedId(envConfig);
|
|
31838
|
+
return {
|
|
31839
|
+
kind: "personal",
|
|
31840
|
+
feedId: pwFeedId,
|
|
31841
|
+
name: "Personal Workspace"
|
|
31842
|
+
};
|
|
31843
|
+
}
|
|
31844
|
+
if (options.personalWorkspace === false || !canPrompt()) {
|
|
31845
|
+
return tenantFeedTarget(envConfig);
|
|
31846
|
+
}
|
|
31847
|
+
return promptFeedTarget(envConfig, logger2);
|
|
31848
|
+
}
|
|
31849
|
+
function requireValue(value, flag) {
|
|
31850
|
+
if (value === undefined)
|
|
31851
|
+
return;
|
|
31852
|
+
const trimmed = value.trim();
|
|
31853
|
+
if (!trimmed)
|
|
31854
|
+
throw new Error(MESSAGE_BUILDERS.FEED_OPTION_EMPTY(flag));
|
|
31855
|
+
return trimmed;
|
|
31856
|
+
}
|
|
31857
|
+
async function classifyFeed(feedId, envConfig, logger2, knownFeeds, knownNotTenant = false) {
|
|
31858
|
+
const connection = toFeedConnection2(envConfig);
|
|
31859
|
+
let feeds = knownFeeds;
|
|
31860
|
+
let listingFailed = false;
|
|
31861
|
+
if (!feeds) {
|
|
31862
|
+
const [listError, listed] = await catchError(listPublishableProcessFeeds(connection));
|
|
31863
|
+
listingFailed = Boolean(listError) || !listed;
|
|
31864
|
+
feeds = listingFailed ? [] : listed ?? [];
|
|
31865
|
+
}
|
|
31866
|
+
const match = feeds.find((feed) => sameFeedId(feed.id, feedId));
|
|
31867
|
+
if (match && !isNuGetFeed(match)) {
|
|
31868
|
+
throw new Error(MESSAGE_BUILDERS.FEED_NOT_NUGET(match.name, match.protocol ?? ""));
|
|
31869
|
+
}
|
|
31870
|
+
if (match && isPersonalWorkspaceFeed(match)) {
|
|
31871
|
+
logger2.log(source_default.dim(`Using feed: ${match.name}`));
|
|
31872
|
+
return { kind: "personal", feedId: match.id, name: match.name };
|
|
31873
|
+
}
|
|
31874
|
+
if (match && isFolderHierarchyFeed(match)) {
|
|
31875
|
+
logger2.log(source_default.dim(`Using feed: ${match.name}`));
|
|
31876
|
+
return { kind: "folder", feedId: match.id, name: match.name };
|
|
31877
|
+
}
|
|
31878
|
+
const pwFeedId = await lookupPersonalWorkspaceFeedId(connection);
|
|
31879
|
+
if (pwFeedId && sameFeedId(pwFeedId, feedId)) {
|
|
31880
|
+
return {
|
|
31881
|
+
kind: "personal",
|
|
31882
|
+
feedId: pwFeedId,
|
|
31883
|
+
name: match?.name ?? "Personal Workspace"
|
|
31884
|
+
};
|
|
31885
|
+
}
|
|
31886
|
+
if (pwFeedId === undefined) {
|
|
31887
|
+
throw new Error(listingFailed ? MESSAGE_BUILDERS.FEED_CLASSIFY_FAILED(feedId) : MESSAGE_BUILDERS.FEED_PERSONAL_CHECK_FAILED(feedId));
|
|
31888
|
+
}
|
|
31889
|
+
if (!knownNotTenant && match && isTenantFeed(match)) {
|
|
31890
|
+
if (!isNamedAsTenantFeed(match)) {
|
|
31891
|
+
logger2.log(source_default.dim(`Using feed: ${match.name}`));
|
|
31892
|
+
return { kind: "folder", feedId: match.id, name: match.name };
|
|
31893
|
+
}
|
|
31894
|
+
const owned = await ownedByFolder(match, connection);
|
|
31895
|
+
if (owned) {
|
|
31896
|
+
logger2.log(source_default.dim(`Using feed: ${match.name}`));
|
|
31897
|
+
return { kind: "folder", feedId: match.id, name: match.name };
|
|
31898
|
+
}
|
|
31899
|
+
if (owned === undefined) {
|
|
31900
|
+
throw new Error(MESSAGE_BUILDERS.FEED_OWNER_UNKNOWN(feedId));
|
|
31901
|
+
}
|
|
31902
|
+
if (tenantFeedOf(feeds, pwFeedId) !== match) {
|
|
31903
|
+
throw new Error(MESSAGE_BUILDERS.FEED_AMBIGUOUS(feedId));
|
|
31904
|
+
}
|
|
31905
|
+
logger2.log(source_default.dim(`Using feed: ${match.name}`));
|
|
31906
|
+
return { kind: "tenant", feedId: match.id, name: match.name };
|
|
31907
|
+
}
|
|
31908
|
+
if (match) {
|
|
31909
|
+
logger2.log(source_default.dim(`Using feed: ${match.name}`));
|
|
31910
|
+
return { kind: "folder", feedId: match.id, name: match.name };
|
|
31911
|
+
}
|
|
31912
|
+
if (listingFailed && !knownNotTenant) {
|
|
31913
|
+
throw new Error(MESSAGE_BUILDERS.FEED_CLASSIFY_FAILED(feedId));
|
|
31914
|
+
}
|
|
31915
|
+
return { kind: "folder", feedId: feedId.toLowerCase() };
|
|
31916
|
+
}
|
|
31917
|
+
async function classifyExplicitFeed(feedId, envConfig, logger2) {
|
|
31918
|
+
const target = await classifyFeed(feedId, envConfig, logger2);
|
|
31919
|
+
return { ...target, explicit: true };
|
|
31920
|
+
}
|
|
31921
|
+
async function resolveFolderFeedByName(folderName, envConfig, logger2) {
|
|
31922
|
+
const name = folderName.trim();
|
|
31923
|
+
if (!name)
|
|
31924
|
+
throw new Error(MESSAGES.ERRORS.FOLDER_NAME_REQUIRED);
|
|
31925
|
+
const connection = toFeedConnection2(envConfig);
|
|
31926
|
+
logger2.log(source_default.dim(MESSAGES.INFO.RESOLVING_FOLDER_FEED));
|
|
31927
|
+
const folders = await findFoldersByName(connection, name);
|
|
31928
|
+
if (folders.length > 1) {
|
|
31929
|
+
throw new Error(MESSAGE_BUILDERS.FOLDER_NAME_AMBIGUOUS(name, folders.map((folder) => folder.fullyQualifiedName)));
|
|
31930
|
+
}
|
|
31931
|
+
if (folders.length === 1) {
|
|
31932
|
+
const feedId = await getFolderFeedId(connection, folders[0].key);
|
|
31933
|
+
const [listError, listed2] = await catchError(listPublishableProcessFeeds(connection));
|
|
31934
|
+
const known = listError ? undefined : listed2;
|
|
31935
|
+
if (!feedId) {
|
|
31936
|
+
logger2.log(source_default.yellow(MESSAGES.INFO.FOLDER_USES_TENANT_FEED));
|
|
31937
|
+
return tenantFeedTarget(envConfig, known);
|
|
31938
|
+
}
|
|
31939
|
+
return classifyFeed(feedId, envConfig, logger2, known, true);
|
|
31940
|
+
}
|
|
31941
|
+
logger2.log(source_default.dim(MESSAGES.INFO.LISTING_PACKAGE_FEEDS));
|
|
31942
|
+
const listed = await listPublishableProcessFeeds(connection);
|
|
31943
|
+
const feeds = nuGetFeeds(listed);
|
|
31944
|
+
const byFeedName = findFeedByFolderName(name, feeds) ?? findFeedByFolderName(name, listed);
|
|
31945
|
+
if (byFeedName && !isNuGetFeed(byFeedName)) {
|
|
31946
|
+
throw new Error(MESSAGE_BUILDERS.FEED_NOT_NUGET(byFeedName.name, byFeedName.protocol ?? ""));
|
|
31947
|
+
}
|
|
31948
|
+
if (!byFeedName) {
|
|
31949
|
+
const available = feeds.map((feed) => feed.name).join(", ");
|
|
31950
|
+
throw new Error(`${MESSAGE_BUILDERS.FOLDER_NOT_FOUND(name)} Available feeds: ${available || "none"}.`);
|
|
31951
|
+
}
|
|
31952
|
+
if (isTenantFeed(byFeedName)) {
|
|
31953
|
+
const target = await classifyFeed(byFeedName.id, envConfig, logger2, listed);
|
|
31954
|
+
return target.kind === "tenant" ? { ...target, explicit: true } : target;
|
|
31955
|
+
}
|
|
31956
|
+
return classifyFeed(byFeedName.id, envConfig, logger2, listed, true);
|
|
31957
|
+
}
|
|
31958
|
+
async function resolveTenantCandidate(feeds, envConfig) {
|
|
31959
|
+
const noFolderRows = nuGetFeeds(feeds).filter(isTenantFeed);
|
|
31960
|
+
if (noFolderRows.length === 0)
|
|
31961
|
+
return { status: "not-tenant" };
|
|
31962
|
+
const connection = toFeedConnection2(envConfig);
|
|
31963
|
+
const pwFeedId = await lookupPersonalWorkspaceFeedId(connection);
|
|
31964
|
+
if (pwFeedId === undefined) {
|
|
31965
|
+
return {
|
|
31966
|
+
status: "unknown",
|
|
31967
|
+
candidate: noFolderRows.length === 1 ? noFolderRows[0] : undefined
|
|
31968
|
+
};
|
|
31969
|
+
}
|
|
31970
|
+
const candidate = tenantFeedOf(feeds, pwFeedId);
|
|
31971
|
+
if (!candidate)
|
|
31972
|
+
return { status: "not-tenant" };
|
|
31973
|
+
const owned = await ownedByFolder(candidate, connection);
|
|
31974
|
+
if (owned === undefined)
|
|
31975
|
+
return { status: "unknown", candidate };
|
|
31976
|
+
return { status: owned ? "not-tenant" : "tenant", candidate };
|
|
31977
|
+
}
|
|
31978
|
+
async function promptFeedTarget(envConfig, logger2) {
|
|
31979
|
+
logger2.log(source_default.dim(MESSAGES.INFO.LISTING_PACKAGE_FEEDS));
|
|
31980
|
+
const [listError, listed] = await catchError(listPublishableProcessFeeds(toFeedConnection2(envConfig)));
|
|
31981
|
+
if (listError || !listed) {
|
|
31982
|
+
logger2.log(source_default.yellow(MESSAGES.ERRORS.FEED_LIST_FAILED));
|
|
31983
|
+
return promptPersonalWorkspaceFallback(envConfig, []);
|
|
31984
|
+
}
|
|
31985
|
+
const feeds = nuGetFeeds(listed);
|
|
31986
|
+
if (feeds.length === 0) {
|
|
31987
|
+
throw new Error(MESSAGES.ERRORS.NO_PUBLISHABLE_FEEDS);
|
|
31988
|
+
}
|
|
31989
|
+
const { status, candidate } = await resolveTenantCandidate(feeds, envConfig);
|
|
31990
|
+
const tenantFeed = status === "tenant" ? candidate : undefined;
|
|
31991
|
+
const ownerUnknown = status === "unknown";
|
|
31992
|
+
const folderFeeds = feeds.filter((feed) => feed !== tenantFeed && !(ownerUnknown && feed === candidate));
|
|
31993
|
+
if (folderFeeds.length === 0) {
|
|
31994
|
+
return promptPersonalWorkspaceFallback(envConfig, feeds);
|
|
31995
|
+
}
|
|
31996
|
+
const offerTenant = tenantFeed !== undefined || ownerUnknown;
|
|
31997
|
+
const { selection } = await esm_default15.prompt([
|
|
31998
|
+
{
|
|
31999
|
+
type: "list",
|
|
32000
|
+
name: "selection",
|
|
32001
|
+
message: "Select the package feed to publish into:",
|
|
32002
|
+
choices: [
|
|
32003
|
+
...offerTenant ? [
|
|
32004
|
+
{
|
|
32005
|
+
name: tenantFeed ? `Tenant feed (default) — ${tenantFeed.name}` : "Tenant feed (default)",
|
|
32006
|
+
value: "__tenant__"
|
|
32007
|
+
}
|
|
32008
|
+
] : [],
|
|
32009
|
+
...folderFeeds.map((feed) => ({
|
|
32010
|
+
name: feed.name,
|
|
32011
|
+
value: feed.id
|
|
32012
|
+
}))
|
|
32013
|
+
],
|
|
32014
|
+
default: offerTenant ? "__tenant__" : folderFeeds[0].id,
|
|
32015
|
+
pageSize: 10
|
|
32016
|
+
}
|
|
32017
|
+
]);
|
|
32018
|
+
if (selection === "__tenant__")
|
|
32019
|
+
return tenantFeedTarget(envConfig, listed);
|
|
32020
|
+
return classifyFeed(selection, envConfig, logger2, listed, tenantFeed !== undefined);
|
|
32021
|
+
}
|
|
32022
|
+
async function promptPersonalWorkspaceFallback(envConfig, knownFeeds) {
|
|
32023
|
+
const { tenantFeed } = await esm_default15.prompt([
|
|
30722
32024
|
{
|
|
30723
32025
|
type: "confirm",
|
|
30724
|
-
name: "
|
|
30725
|
-
message: "Publish into
|
|
30726
|
-
default:
|
|
32026
|
+
name: "tenantFeed",
|
|
32027
|
+
message: "Publish into the tenant feed? (No = your Personal Workspace feed)",
|
|
32028
|
+
default: true
|
|
30727
32029
|
}
|
|
30728
32030
|
]);
|
|
30729
|
-
|
|
32031
|
+
if (tenantFeed !== false)
|
|
32032
|
+
return tenantFeedTarget(envConfig, knownFeeds);
|
|
32033
|
+
const feedId = await getPersonalWorkspaceFeedId(envConfig);
|
|
32034
|
+
return { kind: "personal", feedId, name: "Personal Workspace" };
|
|
30730
32035
|
}
|
|
30731
32036
|
function findPackageByVersion(nupkgFiles, packageLookupNames, version) {
|
|
30732
32037
|
return nupkgFiles.find((file) => {
|
|
@@ -30850,19 +32155,15 @@ function logPublishedDetails(metadata, registerResponse, logger2) {
|
|
|
30850
32155
|
logger2.log("");
|
|
30851
32156
|
logger2.log(source_default.blue(MESSAGES.INFO.PACKAGE_AVAILABLE));
|
|
30852
32157
|
}
|
|
30853
|
-
async function publishSelectedPackage(selectedPackage, uipathDir, envConfig,
|
|
32158
|
+
async function publishSelectedPackage(selectedPackage, uipathDir, envConfig, isActionApp2, feedTarget, spinner, logger2) {
|
|
30854
32159
|
const metadata = extractPackageMetadata(selectedPackage);
|
|
30855
32160
|
metadata.displayName = await readDisplayName(uipathDir);
|
|
30856
|
-
|
|
30857
|
-
if (personalWorkspace) {
|
|
30858
|
-
spinner.text = MESSAGES.INFO.RESOLVING_PERSONAL_WORKSPACE_FEED;
|
|
30859
|
-
feedId = await getPersonalWorkspaceFeedId(envConfig);
|
|
30860
|
-
}
|
|
32161
|
+
const feedId = wireFeedId(feedTarget);
|
|
30861
32162
|
spinner.text = MESSAGES.INFO.UPLOADING_PACKAGE;
|
|
30862
32163
|
await uploadPackage(selectedPackage, envConfig, spinner, feedId);
|
|
30863
32164
|
spinner.succeed(source_default.green(MESSAGES.SUCCESS.PACKAGE_UPLOADED_SUCCESS));
|
|
30864
32165
|
spinner.start(MESSAGES.INFO.REGISTERING_CODED_APP);
|
|
30865
|
-
const registerResponse = await registerCodedApp(metadata, envConfig,
|
|
32166
|
+
const registerResponse = await registerCodedApp(metadata, envConfig, isActionApp2, feedTarget, logger2);
|
|
30866
32167
|
spinner.succeed(source_default.green(MESSAGES.SUCCESS.CODED_APP_REGISTERED_SUCCESS));
|
|
30867
32168
|
const [saveError] = await catchError(saveAppConfig({
|
|
30868
32169
|
appName: metadata.packageName,
|
|
@@ -30871,8 +32172,11 @@ async function publishSelectedPackage(selectedPackage, uipathDir, envConfig, isA
|
|
|
30871
32172
|
systemName: registerResponse.definition.systemName,
|
|
30872
32173
|
appUrl: null,
|
|
30873
32174
|
registeredAt: new Date().toISOString(),
|
|
30874
|
-
appType:
|
|
30875
|
-
personalWorkspace
|
|
32175
|
+
appType: isActionApp2 ? "Action" /* Action */ : "Web" /* Web */,
|
|
32176
|
+
personalWorkspace: feedTarget.kind === "personal",
|
|
32177
|
+
feedKind: feedTarget.kind,
|
|
32178
|
+
...feedTarget.feedId ? { feedId: feedTarget.feedId } : {},
|
|
32179
|
+
...feedTarget.name ? { feedName: feedTarget.name } : {}
|
|
30876
32180
|
}));
|
|
30877
32181
|
if (saveError) {
|
|
30878
32182
|
logger2.log(source_default.yellow(`${MESSAGES.ERRORS.FAILED_TO_SAVE_APP_CONFIG} ${saveError instanceof Error ? saveError.message : MESSAGES.ERRORS.UNKNOWN_ERROR}`));
|
|
@@ -30883,8 +32187,9 @@ async function publishSelectedPackage(selectedPackage, uipathDir, envConfig, isA
|
|
|
30883
32187
|
packageVersion: metadata.packageVersion,
|
|
30884
32188
|
systemName: registerResponse.definition.systemName,
|
|
30885
32189
|
deployVersion: registerResponse.deployVersion,
|
|
30886
|
-
personalWorkspace,
|
|
30887
|
-
|
|
32190
|
+
personalWorkspace: feedTarget.kind === "personal",
|
|
32191
|
+
feedTarget: feedTarget.kind,
|
|
32192
|
+
appType: isActionApp2 ? "Action" /* Action */ : "Web" /* Web */
|
|
30888
32193
|
};
|
|
30889
32194
|
}
|
|
30890
32195
|
async function executePublish(options) {
|
|
@@ -30905,11 +32210,11 @@ async function executePublish(options) {
|
|
|
30905
32210
|
if (!envConfig)
|
|
30906
32211
|
throw new Error("Missing required configuration");
|
|
30907
32212
|
const appType = await resolveAppType(options.type, logger2);
|
|
30908
|
-
const
|
|
30909
|
-
const
|
|
32213
|
+
const isActionApp2 = appType === "Action" /* Action */;
|
|
32214
|
+
const feedTarget = await resolveFeedTarget(options, envConfig, logger2);
|
|
30910
32215
|
const cwd = fs.env.cwd();
|
|
30911
32216
|
const actionSchemaPath = fs.path.join(cwd, ACTION_SCHEMA_CONSTANTS.ACTION_SCHEMA_FILENAME);
|
|
30912
|
-
if (
|
|
32217
|
+
if (isActionApp2 && !await fs.exists(actionSchemaPath)) {
|
|
30913
32218
|
throw new Error(MESSAGES.ERRORS.ACTION_SCHEMA_REQUIRED);
|
|
30914
32219
|
}
|
|
30915
32220
|
const { packageName, packageLookupNames } = resolvePackageLookup(options, logger2);
|
|
@@ -30918,7 +32223,7 @@ async function executePublish(options) {
|
|
|
30918
32223
|
const [publishError, publishResult] = await catchError((async () => {
|
|
30919
32224
|
const nupkgFiles = await listNupkgFiles(uipathDir, spinner, logger2);
|
|
30920
32225
|
const selectedPackage = await selectPackage(nupkgFiles, packageLookupNames, packageName, options, spinner, logger2);
|
|
30921
|
-
return publishSelectedPackage(selectedPackage, uipathDir, envConfig,
|
|
32226
|
+
return publishSelectedPackage(selectedPackage, uipathDir, envConfig, isActionApp2, feedTarget, spinner, logger2);
|
|
30922
32227
|
})());
|
|
30923
32228
|
if (publishError) {
|
|
30924
32229
|
if (spinner.isSpinning) {
|
|
@@ -30943,8 +32248,38 @@ var parseAppType = (value) => {
|
|
|
30943
32248
|
};
|
|
30944
32249
|
var PUBLISH_EXAMPLES = [
|
|
30945
32250
|
{
|
|
30946
|
-
Description: "Publish a packaged .nupkg to UiPath",
|
|
30947
|
-
Command: 'uip codedapp publish --name "MyApp" --version "1.0.0"',
|
|
32251
|
+
Description: "Publish a packaged .nupkg to UiPath's tenant feed (interactive runs offer a feed picker when no feed option is given)",
|
|
32252
|
+
Command: 'uip codedapp publish --name "MyApp" --version "1.0.0" --tenant-feed',
|
|
32253
|
+
Output: {
|
|
32254
|
+
Code: "PublishCompleted",
|
|
32255
|
+
Data: {
|
|
32256
|
+
message: "Package published successfully."
|
|
32257
|
+
}
|
|
32258
|
+
}
|
|
32259
|
+
},
|
|
32260
|
+
{
|
|
32261
|
+
Description: "Publish into the package feed of a folder by name, so the app can be deployed there and added to a solution",
|
|
32262
|
+
Command: 'uip codedapp publish --name "MyApp" --version "1.0.0" --folder-path HIMS',
|
|
32263
|
+
Output: {
|
|
32264
|
+
Code: "PublishCompleted",
|
|
32265
|
+
Data: {
|
|
32266
|
+
message: "Package published successfully."
|
|
32267
|
+
}
|
|
32268
|
+
}
|
|
32269
|
+
},
|
|
32270
|
+
{
|
|
32271
|
+
Description: "Publish into the package feed of a folder that has its own feed, by folder key",
|
|
32272
|
+
Command: 'uip codedapp publish --name "MyApp" --version "1.0.0" --folder-key 8890a2fe-e58d-4d99-9379-c491196d40c1',
|
|
32273
|
+
Output: {
|
|
32274
|
+
Code: "PublishCompleted",
|
|
32275
|
+
Data: {
|
|
32276
|
+
message: "Package published successfully."
|
|
32277
|
+
}
|
|
32278
|
+
}
|
|
32279
|
+
},
|
|
32280
|
+
{
|
|
32281
|
+
Description: "Publish into a specific feed id — no prompt; the id is still checked against the feed listing (CI use)",
|
|
32282
|
+
Command: 'uip codedapp publish --name "MyApp" --version "1.0.0" --feed-id 9b2c1d4e-0f3a-4c6b-8d7e-1a2b3c4d5e6f',
|
|
30948
32283
|
Output: {
|
|
30949
32284
|
Code: "PublishCompleted",
|
|
30950
32285
|
Data: {
|
|
@@ -30953,8 +32288,13 @@ var PUBLISH_EXAMPLES = [
|
|
|
30953
32288
|
}
|
|
30954
32289
|
}
|
|
30955
32290
|
];
|
|
32291
|
+
var FEED_TARGET_TELEMETRY = {
|
|
32292
|
+
tenant: "tenant_coded_app_feed",
|
|
32293
|
+
personal: "personal_workspace_coded_app_feed",
|
|
32294
|
+
folder: "folder_coded_app_feed"
|
|
32295
|
+
};
|
|
30956
32296
|
var registerPublishCommand = (program) => {
|
|
30957
|
-
program.command("publish").description("Publish .nupkg to UiPath and register coded app").option("-n, --name <name>", "Package name (non-interactive)").option("-v, --version <version>", "Package version (requires --name)").option("-t, --type <type>", "App type (Web, Action). If omitted, auto-detected from action-schema.json in the current directory (Action when present, Web otherwise). Interactive sessions get a confirm before switching to Action.", parseAppType).option("--personal-workspace", "Publish the package into the current user's Personal Workspace feed instead of the tenant feed.").option("--uipath-dir <dir>", "UiPath directory containing packages", "./.uipath").option("--base-url <url>", "UiPath base URL").option("--org-id <id>", "Organization ID").option("--org-name <name>", "Organization name (used in place of --org-id when the ID is not provided)").option("--tenant-id <id>", "Tenant ID").option("--tenant-name <name>", "Tenant name").option("--access-token <token>", "Access token").examples(PUBLISH_EXAMPLES).trackedAction(processContext, async (options) => {
|
|
32297
|
+
program.command("publish").description("Publish .nupkg to UiPath and register coded app").option("-n, --name <name>", "Package name (non-interactive)").option("-v, --version <version>", "Package version (requires --name)").option("-t, --type <type>", "App type (Web, Action). If omitted, auto-detected from action-schema.json in the current directory (Action when present, Web otherwise). Interactive sessions get a confirm before switching to Action.", parseAppType).option("--tenant-feed", "Publish the package into the tenant package feed. Without any feed option an interactive run offers a feed picker; a non-interactive run takes the tenant feed.").option("--personal-workspace", "Publish the package into the current user's Personal Workspace feed instead of the tenant feed.").option("--folder-path <path>", "Folder (display name or fully qualified path) whose package feed to publish into. Skips the interactive feed picker. A folder with its own feed resolves to that feed; one on the tenant feed resolves to the tenant feed.").option("--folder-key <key>", "Publish the package into the feed of this folder. Use it for a folder that has its own package feed; a folder on the tenant feed publishes to the tenant feed. The app must then be deployed into a folder using that feed.").option("--feed-id <id>", "Publish the package into this exact Orchestrator feed id — skips the interactive feed picker (CI use). List feeds with 'uip or feeds list'.").option("--uipath-dir <dir>", "UiPath directory containing packages", "./.uipath").option("--base-url <url>", "UiPath base URL").option("--org-id <id>", "Organization ID").option("--org-name <name>", "Organization name (used in place of --org-id when the ID is not provided)").option("--tenant-id <id>", "Tenant ID").option("--tenant-name <name>", "Tenant name").option("--access-token <token>", "Access token").examples(PUBLISH_EXAMPLES).trackedAction(processContext, async (options) => {
|
|
30958
32298
|
const logger2 = {
|
|
30959
32299
|
log: (msg) => getOutputSink().writeErr(`${msg}
|
|
30960
32300
|
`)
|
|
@@ -30964,6 +32304,10 @@ var registerPublishCommand = (program) => {
|
|
|
30964
32304
|
version: options.version,
|
|
30965
32305
|
type: options.type,
|
|
30966
32306
|
personalWorkspace: options.personalWorkspace,
|
|
32307
|
+
tenantFeed: options.tenantFeed,
|
|
32308
|
+
folderPath: options.folderPath,
|
|
32309
|
+
folderKey: options.folderKey,
|
|
32310
|
+
feedId: options.feedId,
|
|
30967
32311
|
uipathDir: options.uipathDir,
|
|
30968
32312
|
baseUrl: options.baseUrl,
|
|
30969
32313
|
orgId: options.orgId,
|
|
@@ -30994,7 +32338,7 @@ var registerPublishCommand = (program) => {
|
|
|
30994
32338
|
if (result) {
|
|
30995
32339
|
trackShipSucceeded({
|
|
30996
32340
|
[ShipDimensions.ShipKind]: "publish",
|
|
30997
|
-
[ShipDimensions.Target]: result.
|
|
32341
|
+
[ShipDimensions.Target]: FEED_TARGET_TELEMETRY[result.feedTarget],
|
|
30998
32342
|
[ShipDimensions.ProjectType]: "coded_app",
|
|
30999
32343
|
[CommandDimensions.CommandName]: "uip codedapp publish",
|
|
31000
32344
|
[ShipDimensions.ArtifactCorrelationKey]: `${result.systemName}:${result.packageVersion}`,
|
|
@@ -31706,7 +33050,7 @@ function normalizeFolderPath(p) {
|
|
|
31706
33050
|
}
|
|
31707
33051
|
var PUSH_METADATA_REMOTE_PATH = `${REMOTE_SOURCE_FOLDER_NAME}/push_metadata.json`;
|
|
31708
33052
|
var WEB_APP_MANIFEST_FILENAME = "webAppManifest.json";
|
|
31709
|
-
function
|
|
33053
|
+
function normalizeBundlePath2(bundlePath) {
|
|
31710
33054
|
let s = bundlePath.split("\\").join("/");
|
|
31711
33055
|
while (s.length > 0 && s.startsWith("/"))
|
|
31712
33056
|
s = s.slice(1);
|
|
@@ -31715,12 +33059,12 @@ function normalizeBundlePath(bundlePath) {
|
|
|
31715
33059
|
return s || bundlePath;
|
|
31716
33060
|
}
|
|
31717
33061
|
function getRemoteContentRoot(bundlePath) {
|
|
31718
|
-
const name =
|
|
33062
|
+
const name = normalizeBundlePath2(bundlePath);
|
|
31719
33063
|
return name ? `${REMOTE_SOURCE_FOLDER_NAME}/${name}` : REMOTE_SOURCE_FOLDER_NAME;
|
|
31720
33064
|
}
|
|
31721
33065
|
function localPathToRemotePath(localPath, bundlePath, remoteContentRoot) {
|
|
31722
33066
|
const normalized = localPath.replace(/\\/g, "/");
|
|
31723
|
-
const buildDirNorm =
|
|
33067
|
+
const buildDirNorm = normalizeBundlePath2(bundlePath);
|
|
31724
33068
|
const prefix = buildDirNorm ? `${buildDirNorm}/` : "";
|
|
31725
33069
|
if (buildDirNorm && normalized.startsWith(prefix)) {
|
|
31726
33070
|
return `${remoteContentRoot}/${normalized.slice(prefix.length)}`;
|
|
@@ -31736,7 +33080,7 @@ function sourceLocalPathToRemotePath(localPath) {
|
|
|
31736
33080
|
}
|
|
31737
33081
|
function getRemotePathForLocalPath(localPath, bundlePath, remoteContentRoot) {
|
|
31738
33082
|
const normalized = localPath.replace(/\\/g, "/");
|
|
31739
|
-
const buildDirNorm =
|
|
33083
|
+
const buildDirNorm = normalizeBundlePath2(bundlePath);
|
|
31740
33084
|
const prefix = buildDirNorm ? `${buildDirNorm}/` : "";
|
|
31741
33085
|
if (buildDirNorm && (normalized === buildDirNorm || normalized.startsWith(prefix))) {
|
|
31742
33086
|
return localPathToRemotePath(localPath, bundlePath, remoteContentRoot);
|
|
@@ -32042,7 +33386,7 @@ function getLocalRelativePath(relativePath) {
|
|
|
32042
33386
|
function isPathUnderBuildDir(relativePath, buildDir) {
|
|
32043
33387
|
if (!buildDir)
|
|
32044
33388
|
return false;
|
|
32045
|
-
const norm =
|
|
33389
|
+
const norm = normalizeBundlePath2(buildDir);
|
|
32046
33390
|
if (!norm)
|
|
32047
33391
|
return false;
|
|
32048
33392
|
return relativePath === norm || relativePath.startsWith(`${norm}/`);
|
|
@@ -32669,7 +34013,7 @@ async function updateRemoteWebAppManifest(config, bundlePath, fullRemoteFiles, l
|
|
|
32669
34013
|
const parsed = JSON.parse(content.toString());
|
|
32670
34014
|
if (typeof parsed !== "object" || parsed === null)
|
|
32671
34015
|
return;
|
|
32672
|
-
const buildDirName =
|
|
34016
|
+
const buildDirName = normalizeBundlePath2(bundlePath);
|
|
32673
34017
|
const configObj = parsed.config ?? {};
|
|
32674
34018
|
parsed.config = {
|
|
32675
34019
|
...configObj,
|
|
@@ -33743,14 +35087,14 @@ async function fetchSolutions(envConfig) {
|
|
|
33743
35087
|
}
|
|
33744
35088
|
return allSolutions;
|
|
33745
35089
|
}
|
|
33746
|
-
function buildCreateProjectForm(appName,
|
|
33747
|
-
const solutionResourceSubType =
|
|
35090
|
+
function buildCreateProjectForm(appName, isActionApp2) {
|
|
35091
|
+
const solutionResourceSubType = isActionApp2 ? "CodedAction" : "Coded";
|
|
33748
35092
|
const webAppManifest = JSON.stringify({
|
|
33749
35093
|
type: "Coded",
|
|
33750
35094
|
solutionResourceSubType,
|
|
33751
35095
|
config: {
|
|
33752
35096
|
isCompiled: true,
|
|
33753
|
-
isActionApp
|
|
35097
|
+
isActionApp: isActionApp2
|
|
33754
35098
|
}
|
|
33755
35099
|
});
|
|
33756
35100
|
const form = new FormData;
|
|
@@ -33771,9 +35115,9 @@ function buildCreateProjectForm(appName, isActionApp) {
|
|
|
33771
35115
|
form.append("createDefaultProjectCommand.IsMain", "false");
|
|
33772
35116
|
return form;
|
|
33773
35117
|
}
|
|
33774
|
-
async function createProjectInSolution(envConfig, solutionId, appName,
|
|
35118
|
+
async function createProjectInSolution(envConfig, solutionId, appName, isActionApp2, logger2) {
|
|
33775
35119
|
const url = appendQueryParams(`${envConfig.baseUrl}/${envConfig.orgId}/studio_/backend/api/Solution/${solutionId}/Projects`, BASIC_ORIGIN_QUERY_PARAMS);
|
|
33776
|
-
const form = buildCreateProjectForm(appName,
|
|
35120
|
+
const form = buildCreateProjectForm(appName, isActionApp2);
|
|
33777
35121
|
const response = await fetch(url, {
|
|
33778
35122
|
method: "POST",
|
|
33779
35123
|
headers: {
|
|
@@ -33793,30 +35137,47 @@ async function createProjectInSolution(envConfig, solutionId, appName, isActionA
|
|
|
33793
35137
|
logger2.log(source_default.green(`Created coded app project "${appName}" in solution with ID: ${projectId}`));
|
|
33794
35138
|
return projectId;
|
|
33795
35139
|
}
|
|
33796
|
-
async function
|
|
35140
|
+
async function getDefaultName() {
|
|
35141
|
+
const fs = getFileSystem();
|
|
35142
|
+
const folderName = fs.path.basename(fs.env.cwd()).trim();
|
|
35143
|
+
if (folderName)
|
|
35144
|
+
return folderName;
|
|
35145
|
+
const [, raw] = await catchError(fs.readFile(fs.path.join(fs.env.cwd(), PACKAGE_JSON_FILENAME), "utf-8"));
|
|
35146
|
+
const [, pkg] = catchError(() => raw ? JSON.parse(raw) : undefined);
|
|
35147
|
+
const pkgName = typeof pkg?.name === "string" ? pkg.name.replace(/^@[^/]+\//, "").trim() : "";
|
|
35148
|
+
return pkgName || "App";
|
|
35149
|
+
}
|
|
35150
|
+
function validateName(emptyMessage) {
|
|
35151
|
+
return (value) => value.trim().length > 0 || emptyMessage;
|
|
35152
|
+
}
|
|
35153
|
+
async function resolveIsActionApp() {
|
|
33797
35154
|
const fs = getFileSystem();
|
|
35155
|
+
const schemaExists = await fs.exists(fs.path.join(fs.env.cwd(), ACTION_SCHEMA_CONSTANTS.ACTION_SCHEMA_FILENAME));
|
|
35156
|
+
if (!schemaExists)
|
|
35157
|
+
return false;
|
|
35158
|
+
if (!canPrompt())
|
|
35159
|
+
return true;
|
|
35160
|
+
const { confirmAction } = await esm_default15.prompt([
|
|
35161
|
+
{
|
|
35162
|
+
type: "confirm",
|
|
35163
|
+
name: "confirmAction",
|
|
35164
|
+
message: "action-schema.json detected. Push as a Coded Action app?",
|
|
35165
|
+
default: true
|
|
35166
|
+
}
|
|
35167
|
+
]);
|
|
35168
|
+
return confirmAction;
|
|
35169
|
+
}
|
|
35170
|
+
async function promptNewProjectInSolution(envConfig, solutionId, logger2) {
|
|
33798
35171
|
const { appName } = await esm_default15.prompt([
|
|
33799
35172
|
{
|
|
33800
35173
|
type: "input",
|
|
33801
35174
|
name: "appName",
|
|
33802
|
-
message:
|
|
33803
|
-
default:
|
|
35175
|
+
message: MESSAGES.PROMPTS.ENTER_NEW_CODED_APP_NAME,
|
|
35176
|
+
default: await getDefaultName(),
|
|
35177
|
+
validate: validateName(MESSAGES.VALIDATIONS.CODED_APP_NAME_EMPTY)
|
|
33804
35178
|
}
|
|
33805
35179
|
]);
|
|
33806
|
-
|
|
33807
|
-
let isActionApp = false;
|
|
33808
|
-
if (schemaExists) {
|
|
33809
|
-
const { confirmAction } = await esm_default15.prompt([
|
|
33810
|
-
{
|
|
33811
|
-
type: "confirm",
|
|
33812
|
-
name: "confirmAction",
|
|
33813
|
-
message: "action-schema.json detected. Push as a Coded Action app?",
|
|
33814
|
-
default: true
|
|
33815
|
-
}
|
|
33816
|
-
]);
|
|
33817
|
-
isActionApp = confirmAction;
|
|
33818
|
-
}
|
|
33819
|
-
return createProjectInSolution(envConfig, solutionId, appName, isActionApp, logger2);
|
|
35180
|
+
return createProjectInSolution(envConfig, solutionId, appName.trim(), await resolveIsActionApp(), logger2);
|
|
33820
35181
|
}
|
|
33821
35182
|
async function promptSelectExistingSolution(envConfig, logger2) {
|
|
33822
35183
|
const solutions = await fetchSolutions(envConfig);
|
|
@@ -33865,10 +35226,10 @@ async function promptSelectExistingSolution(envConfig, logger2) {
|
|
|
33865
35226
|
logger2.log(source_default.gray(`Using project "${selectedProject?.name}" from solution "${selectedSolution.name}"`));
|
|
33866
35227
|
return chosen;
|
|
33867
35228
|
}
|
|
33868
|
-
async function createCodedAppProject(envConfig, appName,
|
|
35229
|
+
async function createCodedAppProject(envConfig, solutionName, appName, isActionApp2, logger2) {
|
|
33869
35230
|
const url = appendQueryParams(`${envConfig.baseUrl}/${envConfig.orgId}/studio_/backend/api/Solution`, BASIC_ORIGIN_QUERY_PARAMS);
|
|
33870
|
-
const form = buildCreateProjectForm(appName,
|
|
33871
|
-
form.append("name",
|
|
35231
|
+
const form = buildCreateProjectForm(appName, isActionApp2);
|
|
35232
|
+
form.append("name", solutionName);
|
|
33872
35233
|
const response = await fetch(url, {
|
|
33873
35234
|
method: "POST",
|
|
33874
35235
|
headers: {
|
|
@@ -33885,42 +35246,44 @@ async function createCodedAppProject(envConfig, appName, isActionApp, logger2) {
|
|
|
33885
35246
|
if (!projectId) {
|
|
33886
35247
|
throw new Error("Solution created but could not extract projectId from response");
|
|
33887
35248
|
}
|
|
33888
|
-
logger2.log(source_default.green(`Created coded app project "${appName}"
|
|
35249
|
+
logger2.log(source_default.green(`Created solution "${solutionName}" with coded app project "${appName}" (ID: ${projectId})`));
|
|
33889
35250
|
return projectId;
|
|
33890
35251
|
}
|
|
33891
|
-
async function
|
|
33892
|
-
|
|
33893
|
-
|
|
33894
|
-
|
|
33895
|
-
|
|
33896
|
-
|
|
33897
|
-
message: "Enter a name for the new Coded App:",
|
|
33898
|
-
default: "App"
|
|
33899
|
-
}
|
|
33900
|
-
]);
|
|
33901
|
-
const schemaExists = await fs.exists(fs.path.join(fs.env.cwd(), ACTION_SCHEMA_CONSTANTS.ACTION_SCHEMA_FILENAME));
|
|
33902
|
-
let isActionApp = false;
|
|
33903
|
-
if (schemaExists) {
|
|
33904
|
-
const { confirmAction } = await esm_default15.prompt([
|
|
35252
|
+
async function createNewSolution(envConfig, options, logger2) {
|
|
35253
|
+
let solutionName = options.solutionName?.trim();
|
|
35254
|
+
let projectName = options.projectName?.trim();
|
|
35255
|
+
if (!solutionName || !projectName) {
|
|
35256
|
+
const defaultName = await getDefaultName();
|
|
35257
|
+
const answers = await esm_default15.prompt([
|
|
33905
35258
|
{
|
|
33906
|
-
type: "
|
|
33907
|
-
name: "
|
|
33908
|
-
message:
|
|
33909
|
-
default:
|
|
35259
|
+
type: "input",
|
|
35260
|
+
name: "solutionName",
|
|
35261
|
+
message: MESSAGES.PROMPTS.ENTER_NEW_SOLUTION_NAME,
|
|
35262
|
+
default: defaultName,
|
|
35263
|
+
validate: validateName(MESSAGES.VALIDATIONS.SOLUTION_NAME_EMPTY),
|
|
35264
|
+
when: !solutionName
|
|
35265
|
+
},
|
|
35266
|
+
{
|
|
35267
|
+
type: "input",
|
|
35268
|
+
name: "projectName",
|
|
35269
|
+
message: MESSAGES.PROMPTS.ENTER_NEW_CODED_APP_NAME,
|
|
35270
|
+
default: defaultName,
|
|
35271
|
+
validate: validateName(MESSAGES.VALIDATIONS.CODED_APP_NAME_EMPTY),
|
|
35272
|
+
when: !projectName
|
|
33910
35273
|
}
|
|
33911
35274
|
]);
|
|
33912
|
-
|
|
35275
|
+
solutionName ||= answers.solutionName?.trim();
|
|
35276
|
+
projectName ||= answers.projectName?.trim();
|
|
33913
35277
|
}
|
|
33914
|
-
|
|
33915
|
-
|
|
33916
|
-
throw new Error("Failed to create project — no project ID returned");
|
|
35278
|
+
if (!solutionName || !projectName) {
|
|
35279
|
+
throw new Error(MESSAGES.ERRORS.PUSH_NEW_SOLUTION_NAMES_REQUIRED);
|
|
33917
35280
|
}
|
|
33918
|
-
return
|
|
35281
|
+
return createCodedAppProject(envConfig, solutionName, projectName, await resolveIsActionApp(), logger2);
|
|
33919
35282
|
}
|
|
33920
35283
|
async function persistProjectId(projectId, logger2) {
|
|
33921
35284
|
const fs = getFileSystem();
|
|
33922
35285
|
const [saveErr] = await catchError((async () => {
|
|
33923
|
-
const { saveEnvFileAsync } = await import("./index-
|
|
35286
|
+
const { saveEnvFileAsync } = await import("./index-wbp18pm0.js");
|
|
33924
35287
|
const localEnvPath = fs.path.join(fs.env.cwd(), ".env");
|
|
33925
35288
|
await saveEnvFileAsync({
|
|
33926
35289
|
envPath: localEnvPath,
|
|
@@ -33933,22 +35296,32 @@ async function persistProjectId(projectId, logger2) {
|
|
|
33933
35296
|
logger2.log(source_default.yellow(`Could not save UIPATH_PROJECT_ID to .env: ${saveErr.message}`));
|
|
33934
35297
|
}
|
|
33935
35298
|
}
|
|
33936
|
-
|
|
35299
|
+
function hasNewSolutionNames(options) {
|
|
35300
|
+
return options.solutionName !== undefined || options.projectName !== undefined;
|
|
35301
|
+
}
|
|
35302
|
+
async function resolveProjectId(envConfig, options, logger2) {
|
|
35303
|
+
const namesGiven = hasNewSolutionNames(options);
|
|
33937
35304
|
if (!canPrompt()) {
|
|
33938
|
-
|
|
33939
|
-
|
|
33940
|
-
|
|
33941
|
-
{
|
|
33942
|
-
type: "list",
|
|
33943
|
-
name: "action",
|
|
33944
|
-
message: "No project ID found. Would you like to create a new solution or use an existing one?",
|
|
33945
|
-
choices: [
|
|
33946
|
-
{ name: "Create a new solution", value: "new" },
|
|
33947
|
-
{ name: "Use an existing solution", value: "existing" }
|
|
33948
|
-
]
|
|
35305
|
+
const complete = options.solutionName?.trim() && options.projectName?.trim();
|
|
35306
|
+
if (!complete) {
|
|
35307
|
+
throw new Error(namesGiven ? MESSAGES.ERRORS.PUSH_NEW_SOLUTION_NAMES_REQUIRED : MESSAGES.ERRORS.PUSH_PROJECT_ID_REQUIRED);
|
|
33949
35308
|
}
|
|
33950
|
-
|
|
33951
|
-
|
|
35309
|
+
}
|
|
35310
|
+
let action = "new";
|
|
35311
|
+
if (!namesGiven) {
|
|
35312
|
+
({ action } = await esm_default15.prompt([
|
|
35313
|
+
{
|
|
35314
|
+
type: "list",
|
|
35315
|
+
name: "action",
|
|
35316
|
+
message: "No project ID found. Would you like to create a new solution or use an existing one?",
|
|
35317
|
+
choices: [
|
|
35318
|
+
{ name: "Create a new solution", value: "new" },
|
|
35319
|
+
{ name: "Use an existing solution", value: "existing" }
|
|
35320
|
+
]
|
|
35321
|
+
}
|
|
35322
|
+
]));
|
|
35323
|
+
}
|
|
35324
|
+
const projectId = action === "existing" ? await promptSelectExistingSolution(envConfig, logger2) : await createNewSolution(envConfig, options, logger2);
|
|
33952
35325
|
await persistProjectId(projectId, logger2);
|
|
33953
35326
|
return projectId;
|
|
33954
35327
|
}
|
|
@@ -33976,6 +35349,26 @@ async function validateRemoteActionSchema(config, logger2) {
|
|
|
33976
35349
|
}
|
|
33977
35350
|
}
|
|
33978
35351
|
}
|
|
35352
|
+
async function findExistingProjectId(projectIdFlag, newSolutionRequested) {
|
|
35353
|
+
const sources = [
|
|
35354
|
+
["--project-id", async () => projectIdFlag],
|
|
35355
|
+
[
|
|
35356
|
+
"the UIPATH_PROJECT_ID environment variable",
|
|
35357
|
+
async () => process.env.UIPATH_PROJECT_ID
|
|
35358
|
+
],
|
|
35359
|
+
["UIPATH_PROJECT_ID in the .env file", loadProjectIdFromEnvFile]
|
|
35360
|
+
];
|
|
35361
|
+
for (const [source, read] of sources) {
|
|
35362
|
+
const projectId = await read();
|
|
35363
|
+
if (!projectId)
|
|
35364
|
+
continue;
|
|
35365
|
+
if (newSolutionRequested) {
|
|
35366
|
+
throw new Error(MESSAGE_BUILDERS.PUSH_NEW_SOLUTION_WITH_PROJECT_ID(source));
|
|
35367
|
+
}
|
|
35368
|
+
return projectId;
|
|
35369
|
+
}
|
|
35370
|
+
return;
|
|
35371
|
+
}
|
|
33979
35372
|
async function executePush(options) {
|
|
33980
35373
|
const logger2 = options.logger ?? {
|
|
33981
35374
|
log: (msg) => logger.info(msg)
|
|
@@ -33990,12 +35383,13 @@ async function executePush(options) {
|
|
|
33990
35383
|
if (!envConfig)
|
|
33991
35384
|
throw new Error("Missing required configuration");
|
|
33992
35385
|
const fs = getFileSystem();
|
|
33993
|
-
|
|
33994
|
-
|
|
33995
|
-
|
|
33996
|
-
}
|
|
35386
|
+
const newSolution = {
|
|
35387
|
+
solutionName: options.solutionName,
|
|
35388
|
+
projectName: options.projectName
|
|
35389
|
+
};
|
|
35390
|
+
let projectId = await findExistingProjectId(options.projectId, hasNewSolutionNames(newSolution));
|
|
33997
35391
|
if (!projectId) {
|
|
33998
|
-
projectId = await resolveProjectId(envConfig, logger2);
|
|
35392
|
+
projectId = await resolveProjectId(envConfig, newSolution, logger2);
|
|
33999
35393
|
}
|
|
34000
35394
|
logger2.startSpinner?.("Pushing...");
|
|
34001
35395
|
const rootDir = fs.env.cwd();
|
|
@@ -34038,10 +35432,20 @@ var PUSH_EXAMPLES = [
|
|
|
34038
35432
|
message: "Push completed successfully."
|
|
34039
35433
|
}
|
|
34040
35434
|
}
|
|
35435
|
+
},
|
|
35436
|
+
{
|
|
35437
|
+
Description: "Create a new solution and Coded App on first push, without prompts",
|
|
35438
|
+
Command: 'uip codedapp push --solution-name "Product Announcements" --project-name "Announcements Portal"',
|
|
35439
|
+
Output: {
|
|
35440
|
+
Code: "PushCompleted",
|
|
35441
|
+
Data: {
|
|
35442
|
+
message: "Push completed successfully."
|
|
35443
|
+
}
|
|
35444
|
+
}
|
|
34041
35445
|
}
|
|
34042
35446
|
];
|
|
34043
35447
|
var registerPushCommand = (program) => {
|
|
34044
|
-
program.command("push").description("Push local source code to Studio Web").option("--project-id <id>", "WebApp Project ID").option("--build-dir <dir>", "Build output directory", "dist").option("--ignore-resources", "Skip importing referenced resources").option("--allow-large-files", "Allow pushing files between 2 MB and 10 MB").option("-v, --version <version>", "Set an explicit code version (e.g. 2.0.0)").option("--verbose", "Show detailed progress logs").option("--base-url <url>", "UiPath base URL").option("--org-id <id>", "Organization ID").option("--tenant-id <id>", "Tenant ID").option("--access-token <token>", "Access token").examples(PUSH_EXAMPLES).trackedAction(processContext, async (options) => {
|
|
35448
|
+
program.command("push").description("Push local source code to Studio Web").option("--project-id <id>", "WebApp Project ID").option("--solution-name <name>", "Name of the Studio Web solution to create when no project ID is set").option("--project-name <name>", "Name of the Coded App project to create when no project ID is set").option("--build-dir <dir>", "Build output directory", "dist").option("--ignore-resources", "Skip importing referenced resources").option("--allow-large-files", "Allow pushing files between 2 MB and 10 MB").option("-v, --version <version>", "Set an explicit code version (e.g. 2.0.0)").option("--verbose", "Show detailed progress logs").option("--base-url <url>", "UiPath base URL").option("--org-id <id>", "Organization ID").option("--tenant-id <id>", "Tenant ID").option("--access-token <token>", "Access token").examples(PUSH_EXAMPLES).trackedAction(processContext, async (options) => {
|
|
34045
35449
|
const verbose = options.verbose ?? false;
|
|
34046
35450
|
getOutputSink().writeErr(`${source_default.blue(MESSAGES.INFO.PUSH_HEADER)}
|
|
34047
35451
|
|
|
@@ -34049,6 +35453,8 @@ var registerPushCommand = (program) => {
|
|
|
34049
35453
|
const logger2 = buildProgressLogger(verbose);
|
|
34050
35454
|
const [error2] = await catchError(executePush({
|
|
34051
35455
|
projectId: options.projectId,
|
|
35456
|
+
solutionName: options.solutionName,
|
|
35457
|
+
projectName: options.projectName,
|
|
34052
35458
|
buildDir: options.buildDir,
|
|
34053
35459
|
ignoreResources: options.ignoreResources,
|
|
34054
35460
|
allowLargeFiles: options.allowLargeFiles,
|
|
@@ -34088,6 +35494,9 @@ async function executeValidatePathName(options) {
|
|
|
34088
35494
|
if (!pathName) {
|
|
34089
35495
|
throw new Error(MESSAGES.VALIDATIONS.PATH_NAME_REQUIRED);
|
|
34090
35496
|
}
|
|
35497
|
+
if (pathName.length > MAX_CODED_APP_NAME_LENGTH) {
|
|
35498
|
+
throw new Error(MESSAGE_BUILDERS.PATH_NAME_TOO_LONG(pathName, pathName.length, MAX_CODED_APP_NAME_LENGTH));
|
|
35499
|
+
}
|
|
34091
35500
|
if (isModified) {
|
|
34092
35501
|
logger2.log(source_default.yellow(MESSAGE_BUILDERS.APP_NAME_SANITIZED(options.pathName, pathName)));
|
|
34093
35502
|
}
|
|
@@ -34148,9 +35557,13 @@ var VALIDATE_EXAMPLES = [
|
|
|
34148
35557
|
}
|
|
34149
35558
|
];
|
|
34150
35559
|
function parsePathNameOption(raw) {
|
|
34151
|
-
|
|
35560
|
+
const { sanitized } = sanitizeAppName(raw);
|
|
35561
|
+
if (!sanitized) {
|
|
34152
35562
|
throw new InvalidArgumentError(MESSAGES.VALIDATIONS.PATH_NAME_REQUIRED);
|
|
34153
35563
|
}
|
|
35564
|
+
if (sanitized.length > MAX_CODED_APP_NAME_LENGTH) {
|
|
35565
|
+
throw new InvalidArgumentError(MESSAGE_BUILDERS.PATH_NAME_TOO_LONG(sanitized, sanitized.length, MAX_CODED_APP_NAME_LENGTH));
|
|
35566
|
+
}
|
|
34154
35567
|
return raw;
|
|
34155
35568
|
}
|
|
34156
35569
|
function instructionsForFailure2(errorCode) {
|
|
@@ -34181,11 +35594,12 @@ async function reportCheckFailure(error2) {
|
|
|
34181
35594
|
return;
|
|
34182
35595
|
}
|
|
34183
35596
|
const details = await extractErrorDetails(error2);
|
|
35597
|
+
const carriedCode = carriedErrorCode(error2);
|
|
34184
35598
|
OutputFormatter.error({
|
|
34185
35599
|
Result: details.result,
|
|
34186
|
-
ErrorCode: details.errorCode,
|
|
35600
|
+
ErrorCode: carriedCode ?? details.errorCode,
|
|
34187
35601
|
Message: `Could not check the path name: ${details.message}`,
|
|
34188
|
-
Instructions: instructionsForFailure2(details.errorCode),
|
|
35602
|
+
Instructions: carriedCode === "permission_denied" ? MESSAGES.ERRORS.APPS_SERVICE_APP_TOKEN_READ_HINT : instructionsForFailure2(details.errorCode),
|
|
34189
35603
|
Retry: details.retry
|
|
34190
35604
|
});
|
|
34191
35605
|
processContext.exit(EXIT_CODES[details.result] ?? 1);
|
|
@@ -34249,16 +35663,17 @@ async function loadAuthCredentials() {
|
|
|
34249
35663
|
var metadata = {
|
|
34250
35664
|
name: "codedapp-tool",
|
|
34251
35665
|
version: package_default.version,
|
|
34252
|
-
description: "Build, pack, publish, deploy, and manage UiPath Coded Web Applications.",
|
|
35666
|
+
description: "Build, pack, publish, deploy, convert, and manage UiPath Coded Web Applications.",
|
|
34253
35667
|
commandPrefix: "codedapp"
|
|
34254
35668
|
};
|
|
34255
35669
|
var registerCommands = async (program) => {
|
|
34256
35670
|
program.hook("preAction", async (_thisCommand, actionCommand) => {
|
|
34257
|
-
if (actionCommand.name() === "init")
|
|
35671
|
+
if (actionCommand.name() === "init" || actionCommand.name() === "convert")
|
|
34258
35672
|
return;
|
|
34259
35673
|
await loadAuthCredentials();
|
|
34260
35674
|
});
|
|
34261
35675
|
registerInitCommand(program);
|
|
35676
|
+
registerConvertCommand(program);
|
|
34262
35677
|
registerPushCommand(program);
|
|
34263
35678
|
registerPullCommand(program);
|
|
34264
35679
|
registerPackCommand(program);
|
|
@@ -34270,4 +35685,4 @@ var registerCommands = async (program) => {
|
|
|
34270
35685
|
|
|
34271
35686
|
export { metadata, registerCommands };
|
|
34272
35687
|
|
|
34273
|
-
//# debugId=
|
|
35688
|
+
//# debugId=D00181AF07BB58B364756E2164756E21
|