@uipath/codedapp-tool 1.204.1 → 1.205.0-preview.258
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-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-j71fq5d5.js → packager-tool-wnkd40wj.js} +1650 -252
- 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.258",
|
|
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
|
+
}
|
|
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
|
+
};
|
|
20681
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
|
|
@@ -21422,7 +21716,6 @@ var MAX_CODED_APP_NAME_LENGTH = 64;
|
|
|
21422
21716
|
var MESSAGES = {
|
|
21423
21717
|
ERRORS: {
|
|
21424
21718
|
INVALID_DIST_DIRECTORY: "Invalid dist directory",
|
|
21425
|
-
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/).",
|
|
21426
21719
|
PACKAGE_NAME_REQUIRED: "Package name is required",
|
|
21427
21720
|
ACTION_SCHEMA_REQUIRED: "❌ action-schema.json file not found in current working directory",
|
|
21428
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.",
|
|
@@ -21448,7 +21741,12 @@ var MESSAGES = {
|
|
|
21448
21741
|
FAILED_TO_FETCH_ORG_TENANT: "❌ Failed to fetch organization/tenant information",
|
|
21449
21742
|
APP_DEPLOYMENT_FAILED: "❌ App deployment failed",
|
|
21450
21743
|
APP_UPGRADE_FAILED: "❌ App upgrade failed",
|
|
21451
|
-
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.",
|
|
21452
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.',
|
|
21453
21751
|
DEPLOY_VERSION_NOT_FOUND: "❌ Could not determine deploy version from the server. Please re-run publish first.",
|
|
21454
21752
|
DEPLOYMENT_ID_NOT_FOUND: "❌ Could not find deployment ID for the app",
|
|
@@ -21467,7 +21765,8 @@ var MESSAGES = {
|
|
|
21467
21765
|
SCOPE_VALIDATION_ERROR: "Scope is required for OAuth client creation during deployment.",
|
|
21468
21766
|
UNKNOWN_FLAG: "✗ Error: Unknown flag",
|
|
21469
21767
|
UNKNOWN_COMMAND: "✗ Error: Unknown command",
|
|
21470
|
-
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>.",
|
|
21471
21770
|
PUSH_VALIDATION_FAILED: "Validation failed",
|
|
21472
21771
|
PUSH_DISALLOWED_EXTENSIONS: "Push blocked: files with disallowed extensions found. Only web-related file types are allowed.",
|
|
21473
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.",
|
|
@@ -21551,8 +21850,12 @@ var MESSAGES = {
|
|
|
21551
21850
|
PUBLISHING_PACKAGE: "Publishing package to UiPath Orchestrator...",
|
|
21552
21851
|
UPLOADING_PACKAGE: "Uploading package to Orchestrator...",
|
|
21553
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.",
|
|
21554
21856
|
REGISTERING_CODED_APP: "Registering coded app...",
|
|
21555
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.",
|
|
21556
21859
|
FINDING_PORT: "Finding available port...",
|
|
21557
21860
|
STARTING_AUTH_PROCESS: "Starting authentication process...",
|
|
21558
21861
|
STARTING_AUTH_SERVER: "Starting local authentication server...",
|
|
@@ -21602,6 +21905,8 @@ var MESSAGES = {
|
|
|
21602
21905
|
PULL_OVERWRITE_CONFIRM: "This pull will overwrite one or more local files. Do you want to continue? (Y/n)",
|
|
21603
21906
|
PULL_CONTINUE_NOT_PROJECT_ROOT: "Continue anyway? (y/N)",
|
|
21604
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):",
|
|
21605
21910
|
ENTER_PACKAGE_DESCRIPTION: "Enter package description:",
|
|
21606
21911
|
SELECT_PACKAGE_TO_PUBLISH: "Select package to publish:",
|
|
21607
21912
|
REAUTH_QUESTION: "Do you want to re-authenticate?",
|
|
@@ -21615,6 +21920,8 @@ var MESSAGES = {
|
|
|
21615
21920
|
},
|
|
21616
21921
|
VALIDATIONS: {
|
|
21617
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.",
|
|
21618
21925
|
PATH_NAME_REQUIRED: "A path name must contain at least one letter or digit",
|
|
21619
21926
|
APP_NAME_INVALID_CHARS: "App name can only contain lowercase letters, numbers, and hyphens (-). Please remove invalid special characters and try again.",
|
|
21620
21927
|
PACKAGE_NAME_REQUIRED: "Package name is required",
|
|
@@ -21627,6 +21934,8 @@ var MESSAGES = {
|
|
|
21627
21934
|
ERROR_CONTEXT: {
|
|
21628
21935
|
PACKAGE_PUBLISHING: "package publishing",
|
|
21629
21936
|
PERSONAL_WORKSPACE_LOOKUP: "Personal Workspace lookup",
|
|
21937
|
+
FOLDER_FEED_LOOKUP: "folder feed lookup",
|
|
21938
|
+
PACKAGE_FEEDS_LOOKUP: "package feeds lookup",
|
|
21630
21939
|
CLIENT_CREDENTIALS_AUTH: "client credentials authentication",
|
|
21631
21940
|
APP_DEPLOYMENT: "app deployment",
|
|
21632
21941
|
DEPLOYED_APP_LOOKUP: "deployed app lookup",
|
|
@@ -21640,11 +21949,33 @@ var MESSAGES = {
|
|
|
21640
21949
|
}
|
|
21641
21950
|
};
|
|
21642
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.`,
|
|
21643
21969
|
APP_NAME_SANITIZED: (original, sanitized) => `⚠️ App name "${original}" contains invalid characters. Using sanitized name: "${sanitized}"`,
|
|
21644
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.`,
|
|
21645
21971
|
PATH_NAME_TOO_LONG: (pathName, length, maxLength) => `Path name '${pathName}' is ${length} characters; limit is ${maxLength}. Pass a shorter --path-name.`,
|
|
21646
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>'.`,
|
|
21647
|
-
|
|
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.`
|
|
21648
21979
|
};
|
|
21649
21980
|
var getHttpErrorMessage = (status, context) => {
|
|
21650
21981
|
switch (status) {
|
|
@@ -28614,13 +28945,237 @@ async function saveAppConfig(config) {
|
|
|
28614
28945
|
await atomicWriteFile(configPath, config);
|
|
28615
28946
|
}
|
|
28616
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
|
+
|
|
28617
29098
|
// src/utils/folder-selection.ts
|
|
28618
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.";
|
|
28619
29100
|
function isPersonalFolder(folder) {
|
|
28620
29101
|
return folder.folderType === "Personal";
|
|
28621
29102
|
}
|
|
28622
|
-
function
|
|
28623
|
-
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.`;
|
|
28624
29179
|
}
|
|
28625
29180
|
function sameFolderKey(a, b) {
|
|
28626
29181
|
return a.toLowerCase() === b.toLowerCase();
|
|
@@ -28643,12 +29198,30 @@ async function fetchFolderPage(baseUrl, accessToken, orgId, tenantName, skip) {
|
|
|
28643
29198
|
key: String(item.Key ?? item.key ?? ""),
|
|
28644
29199
|
displayName: String(item.DisplayName ?? item.displayName ?? ""),
|
|
28645
29200
|
fullyQualifiedName: String(item.FullyQualifiedName ?? item.fullyQualifiedName ?? ""),
|
|
28646
|
-
folderType: String(item.FolderType ?? item.folderType ?? "")
|
|
29201
|
+
folderType: String(item.FolderType ?? item.folderType ?? ""),
|
|
29202
|
+
feedType: String(item.FeedType ?? item.feedType ?? "")
|
|
28647
29203
|
})),
|
|
28648
29204
|
total: typeof count === "number" ? count : null
|
|
28649
29205
|
};
|
|
28650
29206
|
}
|
|
28651
|
-
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) {
|
|
28652
29225
|
const all = [];
|
|
28653
29226
|
for (let page = 0;page < FOLDER_PAGE_LIMIT; page++) {
|
|
28654
29227
|
const { folders, total } = await fetchFolderPage(baseUrl, accessToken, orgId, tenantName, all.length);
|
|
@@ -28666,14 +29239,44 @@ async function fetchFolders(baseUrl, accessToken, orgId, tenantName, stopEarly)
|
|
|
28666
29239
|
}
|
|
28667
29240
|
return all;
|
|
28668
29241
|
}
|
|
28669
|
-
|
|
28670
|
-
|
|
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;
|
|
28671
29271
|
if (filtered.length === 0) {
|
|
28672
|
-
if (personalWorkspace === true) {
|
|
28673
|
-
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.");
|
|
28674
29274
|
}
|
|
28675
|
-
if (
|
|
28676
|
-
throw new Error(
|
|
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.`);
|
|
29277
|
+
}
|
|
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).");
|
|
28677
29280
|
}
|
|
28678
29281
|
logger2.log(source_default.yellow("No folders found in this tenant."));
|
|
28679
29282
|
return null;
|
|
@@ -28685,7 +29288,7 @@ async function promptFolderSelection(folders, logger2, personalWorkspace) {
|
|
|
28685
29288
|
if (!canPrompt()) {
|
|
28686
29289
|
throw new Error(NON_INTERACTIVE_FOLDER_KEY_MESSAGE);
|
|
28687
29290
|
}
|
|
28688
|
-
const promptMessage =
|
|
29291
|
+
const promptMessage = folderPromptMessage(scope);
|
|
28689
29292
|
const { selection } = await esm_default15.prompt([
|
|
28690
29293
|
{
|
|
28691
29294
|
type: "list",
|
|
@@ -28710,43 +29313,53 @@ async function promptFolderSelection(folders, logger2, personalWorkspace) {
|
|
|
28710
29313
|
}
|
|
28711
29314
|
return selection;
|
|
28712
29315
|
}
|
|
28713
|
-
async function validateExplicitFolderKey(folderKey,
|
|
28714
|
-
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));
|
|
28715
29318
|
if (fetchErr)
|
|
28716
29319
|
return;
|
|
28717
29320
|
const match = folders.find((f) => sameFolderKey(f.key, folderKey));
|
|
28718
|
-
if (
|
|
28719
|
-
|
|
28720
|
-
if (!matchesWorkspace(match, personalWorkspace)) {
|
|
28721
|
-
const folderKind = isPersonalFolder(match) ? "a Personal Workspace" : "a shared tenant";
|
|
28722
|
-
const publishedAs = personalWorkspace ? "into your Personal Workspace" : "into the tenant feed";
|
|
28723
|
-
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.";
|
|
28724
|
-
throw new Error(`Folder '${match.displayName}' (${match.fullyQualifiedName}) is ${folderKind} folder, but this app was published ${publishedAs}. ${fixHint}`);
|
|
28725
|
-
}
|
|
28726
|
-
}
|
|
28727
|
-
async function ensureFolderKey(logger2, explicitFolderKey, personalWorkspace) {
|
|
28728
|
-
const baseUrl = process.env.UIPATH_BASE_URL;
|
|
28729
|
-
const accessToken = process.env.UIPATH_ACCESS_TOKEN;
|
|
28730
|
-
const orgId = process.env.UIPATH_ORG_ID;
|
|
28731
|
-
const tenantName = process.env.UIPATH_TENANT_NAME;
|
|
28732
|
-
if (explicitFolderKey !== undefined) {
|
|
28733
|
-
if (personalWorkspace !== undefined && baseUrl && accessToken && orgId && tenantName) {
|
|
28734
|
-
await validateExplicitFolderKey(explicitFolderKey, personalWorkspace, baseUrl, accessToken, orgId, tenantName);
|
|
28735
|
-
}
|
|
28736
|
-
process.env.UIPATH_FOLDER_KEY = explicitFolderKey;
|
|
28737
|
-
return;
|
|
29321
|
+
if (match && personalAxisMismatch(match, scope)) {
|
|
29322
|
+
throw feedMismatchError(match, scope);
|
|
28738
29323
|
}
|
|
28739
|
-
|
|
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;
|
|
28740
29347
|
return;
|
|
29348
|
+
}
|
|
28741
29349
|
if (!baseUrl || !accessToken || !orgId || !tenantName)
|
|
28742
29350
|
return;
|
|
28743
|
-
const [fetchErr, folders] = await catchError(fetchFolders(baseUrl, accessToken, orgId, tenantName));
|
|
29351
|
+
const [fetchErr, folders] = await catchError(fetchFolders(baseUrl, accessToken, orgId, tenantName, undefined, scope !== undefined));
|
|
28744
29352
|
if (fetchErr) {
|
|
28745
29353
|
logger2.log(source_default.yellow(`Could not fetch folders: ${fetchErr.message || "Unknown error"}`));
|
|
28746
29354
|
logger2.log(source_default.yellow("You can provide --folder-key manually or set UIPATH_FOLDER_KEY in your .env."));
|
|
28747
29355
|
return;
|
|
28748
29356
|
}
|
|
28749
|
-
const folderKey = await promptFolderSelection(folders, logger2,
|
|
29357
|
+
const folderKey = await promptFolderSelection(folders, logger2, scope, {
|
|
29358
|
+
baseUrl,
|
|
29359
|
+
orgId,
|
|
29360
|
+
tenant: tenantName,
|
|
29361
|
+
accessToken
|
|
29362
|
+
});
|
|
28750
29363
|
if (folderKey) {
|
|
28751
29364
|
process.env.UIPATH_FOLDER_KEY = folderKey;
|
|
28752
29365
|
}
|
|
@@ -28791,7 +29404,10 @@ async function getDeployedApp(appName, envConfig, legacyAppName) {
|
|
|
28791
29404
|
}
|
|
28792
29405
|
return null;
|
|
28793
29406
|
}
|
|
28794
|
-
async function getPublishedApp(appNames, envConfig, version) {
|
|
29407
|
+
async function getPublishedApp(appNames, envConfig, version, requiredSystemName) {
|
|
29408
|
+
if (requiredSystemName) {
|
|
29409
|
+
return getRecordedPublishedApp(requiredSystemName, envConfig, version);
|
|
29410
|
+
}
|
|
28795
29411
|
for (const appName of appNames) {
|
|
28796
29412
|
const match = await getPublishedAppByName(appName, envConfig, version);
|
|
28797
29413
|
if (match)
|
|
@@ -28799,6 +29415,21 @@ async function getPublishedApp(appNames, envConfig, version) {
|
|
|
28799
29415
|
}
|
|
28800
29416
|
return null;
|
|
28801
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
|
+
}
|
|
28802
29433
|
function pickNewestLineage(apps) {
|
|
28803
29434
|
let newest = null;
|
|
28804
29435
|
for (const app of apps) {
|
|
@@ -28843,10 +29474,10 @@ async function getPublishedAppByName(appName, envConfig, version) {
|
|
|
28843
29474
|
}
|
|
28844
29475
|
return null;
|
|
28845
29476
|
}
|
|
28846
|
-
return
|
|
29477
|
+
return pickCurrentVersion(matches);
|
|
28847
29478
|
}
|
|
28848
|
-
async function getAllPublishedVersions(systemName, envConfig) {
|
|
28849
|
-
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);
|
|
28850
29481
|
const url = appendQueryParams(`${envConfig.baseUrl}/${envConfig.orgId}${endpoint}?top=1000`, BASIC_ORIGIN_QUERY_PARAMS);
|
|
28851
29482
|
const response = await fetch(url, {
|
|
28852
29483
|
method: "GET",
|
|
@@ -28856,19 +29487,24 @@ async function getAllPublishedVersions(systemName, envConfig) {
|
|
|
28856
29487
|
folderKey: envConfig.folderKey
|
|
28857
29488
|
})
|
|
28858
29489
|
});
|
|
29490
|
+
if (response.status === 404 && options.notFoundAsEmpty)
|
|
29491
|
+
return [];
|
|
28859
29492
|
if (!response.ok)
|
|
28860
29493
|
await handleHttpError(response, MESSAGES.ERROR_CONTEXT.APP_DEPLOYMENT, envConfig.accessToken);
|
|
28861
29494
|
const data = await response.json();
|
|
28862
29495
|
return data.value;
|
|
28863
29496
|
}
|
|
28864
|
-
async function getPublishedAppWithRetry(appNames, envConfig, version, onRetry) {
|
|
28865
|
-
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);
|
|
28866
29499
|
for (const delayMs of PUBLISHED_APP_LOOKUP_RETRY_DELAYS_MS) {
|
|
28867
29500
|
if (publishedApp)
|
|
28868
29501
|
return publishedApp;
|
|
28869
29502
|
onRetry(delayMs);
|
|
28870
29503
|
await sleep(delayMs);
|
|
28871
|
-
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));
|
|
28872
29508
|
}
|
|
28873
29509
|
return publishedApp;
|
|
28874
29510
|
}
|
|
@@ -28887,7 +29523,7 @@ async function checkAppNameUniqueness(appName, envConfig) {
|
|
|
28887
29523
|
}
|
|
28888
29524
|
}
|
|
28889
29525
|
async function deployNewApp(appName, routingName, systemName, deployVersion, envConfig, tags, clientId) {
|
|
28890
|
-
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));
|
|
28891
29527
|
const url = appendQueryParams(`${envConfig.baseUrl}/${envConfig.orgId}${endpoint}`, BASIC_ORIGIN_QUERY_PARAMS);
|
|
28892
29528
|
const body = { title: appName, routingName };
|
|
28893
29529
|
if (tags?.length) {
|
|
@@ -28991,12 +29627,21 @@ async function upgradeApp(params) {
|
|
|
28991
29627
|
await handleHttpError(response, MESSAGES.ERROR_CONTEXT.APP_UPGRADE, params.envConfig.accessToken);
|
|
28992
29628
|
return [];
|
|
28993
29629
|
}
|
|
28994
|
-
|
|
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) {
|
|
28995
29636
|
const fsys = getFileSystem();
|
|
28996
29637
|
const configDir = fsys.path.join(fsys.env.cwd(), AUTH_CONSTANTS.FILES.UIPATH_DIR);
|
|
28997
29638
|
const configPath = fsys.path.join(configDir, AUTH_CONSTANTS.FILES.APP_CONFIG);
|
|
28998
29639
|
const [error2] = await catchError((async () => {
|
|
28999
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
|
+
}
|
|
29000
29645
|
if (update.deploymentId !== undefined) {
|
|
29001
29646
|
config.deploymentId = update.deploymentId;
|
|
29002
29647
|
}
|
|
@@ -29028,13 +29673,76 @@ function logDeployDetails(logger2, displayTitle, version, appUrl) {
|
|
|
29028
29673
|
}
|
|
29029
29674
|
logger2.log(` ${source_default.cyan("App URL:")} ${source_default.green(appUrl)}`);
|
|
29030
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
|
+
}
|
|
29031
29736
|
async function executeDeploy(options) {
|
|
29032
29737
|
const logger2 = options.logger ?? {
|
|
29033
29738
|
log: (msg) => logger.info(msg)
|
|
29034
29739
|
};
|
|
29035
29740
|
logger2.log(source_default.blue(MESSAGES.INFO.APP_DEPLOYMENT));
|
|
29036
29741
|
const savedConfig = await loadAppConfig(logger2);
|
|
29037
|
-
|
|
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);
|
|
29038
29746
|
const envConfig = getEnvironmentConfig(AUTH_CONSTANTS.REQUIRED_ENV_VARS.DEPLOY, logger2, {
|
|
29039
29747
|
baseUrl: options.baseUrl,
|
|
29040
29748
|
orgId: options.orgId,
|
|
@@ -29053,10 +29761,11 @@ async function executeDeploy(options) {
|
|
|
29053
29761
|
options.packageName = sanitized;
|
|
29054
29762
|
}
|
|
29055
29763
|
}
|
|
29056
|
-
const appName = options.packageName ?? await getAppName(logger2);
|
|
29764
|
+
const appName = options.packageName ?? await getAppName(savedConfig, logger2);
|
|
29057
29765
|
if (!appName)
|
|
29058
29766
|
throw new Error(MESSAGES.VALIDATIONS.APP_NAME_REQUIRED);
|
|
29059
|
-
const appConfig =
|
|
29767
|
+
const appConfig = recordApplies ? savedConfig : null;
|
|
29768
|
+
const registeredSystemName = appConfig?.systemName;
|
|
29060
29769
|
const displayTitle = options.displayName?.trim() || appConfig?.displayName || originalName || appName;
|
|
29061
29770
|
const deploymentTitleOverride = options.displayName?.trim() || undefined;
|
|
29062
29771
|
const legacyName = legacySanitizedAppName(originalName ?? appName);
|
|
@@ -29078,12 +29787,27 @@ async function executeDeploy(options) {
|
|
|
29078
29787
|
let spinner = ora(MESSAGES.INFO.CHECKING_DEPLOYMENT_STATUS).start();
|
|
29079
29788
|
const [deployError, deployResult] = await catchError((async () => {
|
|
29080
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
|
+
}
|
|
29081
29805
|
let operationResult;
|
|
29082
29806
|
if (deployedApp) {
|
|
29083
29807
|
spinner.text = MESSAGES.INFO.UPGRADING_APP;
|
|
29084
29808
|
const publishedApp = await getPublishedAppWithRetry(publishedLookupNames, envConfig, options.version, () => {
|
|
29085
29809
|
spinner.text = MESSAGES.INFO.WAITING_FOR_PUBLISHED_APP;
|
|
29086
|
-
});
|
|
29810
|
+
}, registeredSystemName);
|
|
29087
29811
|
if (!publishedApp) {
|
|
29088
29812
|
const notFoundMsg = buildNotPublishedMessage(options.version);
|
|
29089
29813
|
spinner.fail(source_default.red(notFoundMsg));
|
|
@@ -29109,8 +29833,7 @@ async function executeDeploy(options) {
|
|
|
29109
29833
|
});
|
|
29110
29834
|
spinner.succeed(source_default.green(MESSAGES.SUCCESS.APP_UPGRADED_SUCCESS));
|
|
29111
29835
|
logPlatformWarnings(upgradeWarnings, logger2);
|
|
29112
|
-
const
|
|
29113
|
-
const version = publishedApp.definition?.codedAppMetadata?.packageVersion ?? appConfig3?.appVersion ?? deployedApp.semVersion;
|
|
29836
|
+
const version = publishedApp.definition?.codedAppMetadata?.packageVersion ?? appConfig?.appVersion ?? deployedApp.semVersion;
|
|
29114
29837
|
operationResult = {
|
|
29115
29838
|
version,
|
|
29116
29839
|
deploymentId: deployedApp.id,
|
|
@@ -29128,7 +29851,7 @@ async function executeDeploy(options) {
|
|
|
29128
29851
|
spinner = ora(MESSAGES.INFO.DEPLOYING_APP).start();
|
|
29129
29852
|
const publishedApp = await getPublishedAppWithRetry(publishedLookupNames, envConfig, options.version, () => {
|
|
29130
29853
|
spinner.text = MESSAGES.INFO.WAITING_FOR_PUBLISHED_APP;
|
|
29131
|
-
});
|
|
29854
|
+
}, registeredSystemName);
|
|
29132
29855
|
if (!publishedApp) {
|
|
29133
29856
|
const notFoundMsg = buildNotPublishedMessage(options.version);
|
|
29134
29857
|
spinner.fail(source_default.red(notFoundMsg));
|
|
@@ -29141,8 +29864,7 @@ async function executeDeploy(options) {
|
|
|
29141
29864
|
const { id: deploymentId, warnings: deployWarnings } = await deployNewApp(displayTitle, routingName, publishedApp.systemName, publishedApp.deployVersion, envConfig, options.tags, options.clientId);
|
|
29142
29865
|
spinner.succeed(source_default.green(MESSAGES.SUCCESS.APP_DEPLOYED_SUCCESS));
|
|
29143
29866
|
logPlatformWarnings(deployWarnings, logger2);
|
|
29144
|
-
const
|
|
29145
|
-
const version = publishedApp.definition?.codedAppMetadata?.packageVersion ?? appConfig3?.appVersion ?? "1.0.0";
|
|
29867
|
+
const version = publishedApp.definition?.codedAppMetadata?.packageVersion ?? appConfig?.appVersion ?? "1.0.0";
|
|
29146
29868
|
operationResult = {
|
|
29147
29869
|
version,
|
|
29148
29870
|
deploymentId,
|
|
@@ -29154,21 +29876,27 @@ async function executeDeploy(options) {
|
|
|
29154
29876
|
Operation: "fresh_deploy"
|
|
29155
29877
|
});
|
|
29156
29878
|
}
|
|
29157
|
-
const
|
|
29158
|
-
const
|
|
29159
|
-
const
|
|
29160
|
-
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({
|
|
29161
29882
|
baseUrl: envConfig.baseUrl,
|
|
29162
29883
|
orgName: envConfig.orgName,
|
|
29163
29884
|
folderKey: envConfig.folderKey,
|
|
29164
|
-
systemName: operationResult.systemName ??
|
|
29885
|
+
systemName: operationResult.systemName ?? appConfig?.systemName,
|
|
29165
29886
|
routingName
|
|
29166
29887
|
});
|
|
29167
|
-
|
|
29168
|
-
|
|
29169
|
-
|
|
29170
|
-
|
|
29171
|
-
|
|
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
|
+
}
|
|
29172
29900
|
logDeployDetails(logger2, displayTitle, operationResult.version, appUrl);
|
|
29173
29901
|
return {
|
|
29174
29902
|
appName: displayTitle,
|
|
@@ -29187,8 +29915,7 @@ async function executeDeploy(options) {
|
|
|
29187
29915
|
}
|
|
29188
29916
|
return deployResult;
|
|
29189
29917
|
}
|
|
29190
|
-
async function getAppName(logger2) {
|
|
29191
|
-
const appConfig = await loadAppConfig(logger2);
|
|
29918
|
+
async function getAppName(appConfig, logger2) {
|
|
29192
29919
|
if (appConfig?.appName)
|
|
29193
29920
|
return appConfig.appName;
|
|
29194
29921
|
if (!canPrompt())
|
|
@@ -29531,7 +30258,7 @@ var package_default2 = {
|
|
|
29531
30258
|
name: "@uipath/solution-sdk",
|
|
29532
30259
|
author: "UiPath",
|
|
29533
30260
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
29534
|
-
version: "1.
|
|
30261
|
+
version: "1.205.0-preview.258",
|
|
29535
30262
|
repository: {
|
|
29536
30263
|
type: "git",
|
|
29537
30264
|
url: "https://github.com/UiPath/cli.git",
|
|
@@ -29560,6 +30287,14 @@ var package_default2 = {
|
|
|
29560
30287
|
"./auth": {
|
|
29561
30288
|
types: "./dist/src/solution-auth.d.ts",
|
|
29562
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"
|
|
29563
30298
|
}
|
|
29564
30299
|
},
|
|
29565
30300
|
bin: {
|
|
@@ -29570,7 +30305,7 @@ var package_default2 = {
|
|
|
29570
30305
|
],
|
|
29571
30306
|
private: false,
|
|
29572
30307
|
scripts: {
|
|
29573
|
-
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",
|
|
29574
30309
|
generate: "bun run src/scripts/generate-sdk.ts",
|
|
29575
30310
|
lint: "biome check .",
|
|
29576
30311
|
test: "vitest run",
|
|
@@ -29582,7 +30317,8 @@ var package_default2 = {
|
|
|
29582
30317
|
"@uipath/common": "workspace:*",
|
|
29583
30318
|
"@uipath/filesystem": "workspace:*",
|
|
29584
30319
|
"@uipath/orchestrator-sdk": "workspace:*",
|
|
29585
|
-
"@uipath/
|
|
30320
|
+
"@uipath/pipelines-sdk": "workspace:*",
|
|
30321
|
+
"@uipath/resource-builder-sdk": "2025.11.0-alpha6584-4367",
|
|
29586
30322
|
"@uipath/solutionpackager-tool-core": "workspace:*",
|
|
29587
30323
|
"@uipath/studioweb-sdk": "workspace:*",
|
|
29588
30324
|
"@types/node": "^25.5.2",
|
|
@@ -29826,14 +30562,15 @@ var DEFAULT_EXCLUDED_DIR_NAMES = new Set([
|
|
|
29826
30562
|
"__pycache__",
|
|
29827
30563
|
".git",
|
|
29828
30564
|
".local",
|
|
29829
|
-
".flow-sdk"
|
|
30565
|
+
".flow-sdk",
|
|
30566
|
+
".flow-debug"
|
|
29830
30567
|
]);
|
|
29831
30568
|
// ../solution-sdk/src/project-debug-status.ts
|
|
29832
30569
|
var SUCCEEDED = "creationsucceeded";
|
|
29833
30570
|
var TERMINAL = new Set([SUCCEEDED, "creationfailed", "validationfailed"]);
|
|
29834
30571
|
// src/services/project-artifacts.ts
|
|
29835
30572
|
async function ensureProjectArtifacts(args) {
|
|
29836
|
-
const { addProjectArtifactsToSolutionAsync } = await import("./index-
|
|
30573
|
+
const { addProjectArtifactsToSolutionAsync } = await import("./index-0k30knwv.js");
|
|
29837
30574
|
return addProjectArtifactsToSolutionAsync(args);
|
|
29838
30575
|
}
|
|
29839
30576
|
|
|
@@ -29849,12 +30586,14 @@ var INIT_ERROR = {
|
|
|
29849
30586
|
TEMPLATE_INVALID: "INIT_TEMPLATE_INVALID",
|
|
29850
30587
|
TYPE_INVALID: "INIT_TYPE_INVALID",
|
|
29851
30588
|
DIR_NOT_EMPTY: "INIT_DIR_NOT_EMPTY",
|
|
29852
|
-
NOT_A_DIRECTORY: "INIT_NOT_A_DIRECTORY"
|
|
30589
|
+
NOT_A_DIRECTORY: "INIT_NOT_A_DIRECTORY",
|
|
30590
|
+
FILE_INVALID: "INIT_FILE_INVALID"
|
|
29853
30591
|
};
|
|
29854
30592
|
var DEFAULT_TEMPLATE = "form";
|
|
29855
30593
|
var PROJECT_UIPROJ_FILE = "project.uiproj";
|
|
29856
30594
|
var WEB_APP_MANIFEST_FILE = "webAppManifest.json";
|
|
29857
30595
|
var PACKAGE_JSON_FILE = "package.json";
|
|
30596
|
+
var ACTION_SCHEMA_FILE = "action-schema.json";
|
|
29858
30597
|
var UIPATH_SDK_PACKAGE = "@uipath/uipath-typescript";
|
|
29859
30598
|
var UIPATH_SDK_FALLBACK = "latest";
|
|
29860
30599
|
var SOURCE_DIR = "source";
|
|
@@ -29910,6 +30649,33 @@ function normalizeInitOptions(options) {
|
|
|
29910
30649
|
}
|
|
29911
30650
|
return { targetPath, name, template, isAction };
|
|
29912
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
|
+
}
|
|
29913
30679
|
function createProjectUiproj(name) {
|
|
29914
30680
|
return `${JSON.stringify({
|
|
29915
30681
|
ProjectType: "AppV2" /* AppV2 */,
|
|
@@ -29920,14 +30686,17 @@ function createProjectUiproj(name) {
|
|
|
29920
30686
|
}, null, 2)}
|
|
29921
30687
|
`;
|
|
29922
30688
|
}
|
|
29923
|
-
function createWebAppManifest(isAction,
|
|
30689
|
+
function createWebAppManifest(isAction, bundlePath, existing) {
|
|
30690
|
+
const existingConfig = existing && typeof existing.config === "object" && existing.config ? existing.config : {};
|
|
29924
30691
|
const manifest = {
|
|
30692
|
+
...existing ?? {},
|
|
29925
30693
|
type: "Coded",
|
|
29926
30694
|
solutionResourceSubType: isAction ? "CodedAction" : "Coded",
|
|
29927
30695
|
config: {
|
|
30696
|
+
...existingConfig,
|
|
29928
30697
|
isCompiled: true,
|
|
29929
30698
|
isActionApp: isAction,
|
|
29930
|
-
bundlePath
|
|
30699
|
+
bundlePath
|
|
29931
30700
|
}
|
|
29932
30701
|
};
|
|
29933
30702
|
return `${JSON.stringify(manifest, null, 2)}
|
|
@@ -29964,6 +30733,11 @@ function createPackageJson(name, sdkVersion) {
|
|
|
29964
30733
|
function escapeHtml(value) {
|
|
29965
30734
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
29966
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
|
+
};
|
|
29967
30741
|
function createIndexHtml(name, template) {
|
|
29968
30742
|
const escapedName = escapeHtml(name);
|
|
29969
30743
|
const heading = {
|
|
@@ -29971,11 +30745,7 @@ function createIndexHtml(name, template) {
|
|
|
29971
30745
|
dashboard: `${escapedName} Dashboard`,
|
|
29972
30746
|
"inline-automation": `${escapedName} Inline Automation`
|
|
29973
30747
|
}[template];
|
|
29974
|
-
const body =
|
|
29975
|
-
form: '<form><label>Name <input name="name" /></label><button type="submit">Submit</button></form>',
|
|
29976
|
-
dashboard: "<section><h2>Metrics</h2><p>Connect your data and publish this dashboard.</p></section>",
|
|
29977
|
-
"inline-automation": "<section><h2>Automation</h2><p>Trigger an inline automation from this starter app.</p></section>"
|
|
29978
|
-
}[template];
|
|
30748
|
+
const body = STARTER_BODIES[template];
|
|
29979
30749
|
return `<!doctype html>
|
|
29980
30750
|
<html lang="en">
|
|
29981
30751
|
<head>
|
|
@@ -29992,6 +30762,113 @@ function createIndexHtml(name, template) {
|
|
|
29992
30762
|
</html>
|
|
29993
30763
|
`;
|
|
29994
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
|
+
}
|
|
29995
30872
|
async function ensureWritableTarget(targetPath, force) {
|
|
29996
30873
|
const fs = getFileSystem();
|
|
29997
30874
|
const stat = await fs.stat(targetPath);
|
|
@@ -30009,7 +30886,12 @@ async function ensureWritableTarget(targetPath, force) {
|
|
|
30009
30886
|
}
|
|
30010
30887
|
async function executeInit(options) {
|
|
30011
30888
|
const fs = getFileSystem();
|
|
30012
|
-
const {
|
|
30889
|
+
const {
|
|
30890
|
+
targetPath,
|
|
30891
|
+
name,
|
|
30892
|
+
template,
|
|
30893
|
+
isAction: requestedIsAction
|
|
30894
|
+
} = normalizeInitOptions(options);
|
|
30013
30895
|
const skipSolutionRegistration = options.skipSolutionRegistration === true;
|
|
30014
30896
|
const inSolution = !skipSolutionRegistration && (await findNearestParentUipxFile(fs, targetPath)).status === "found";
|
|
30015
30897
|
const distParent = inSolution ? fs.path.join(targetPath, SOURCE_DIR) : targetPath;
|
|
@@ -30019,16 +30901,31 @@ async function executeInit(options) {
|
|
|
30019
30901
|
const packageJsonPath = fs.path.join(distParent, PACKAGE_JSON_FILE);
|
|
30020
30902
|
const projectPath = fs.path.join(targetPath, PROJECT_UIPROJ_FILE);
|
|
30021
30903
|
const webAppManifestPath = fs.path.join(targetPath, WEB_APP_MANIFEST_FILE);
|
|
30904
|
+
const actionSchemaPath = fs.path.join(targetPath, ACTION_SCHEMA_FILE);
|
|
30022
30905
|
await ensureWritableTarget(targetPath, options.force === true);
|
|
30023
|
-
|
|
30024
|
-
|
|
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));
|
|
30025
30920
|
}
|
|
30026
|
-
const sdkVersion = await resolveSdkVersion();
|
|
30027
|
-
await fs.writeFile(indexPath, createIndexHtml(name, template));
|
|
30028
|
-
await fs.writeFile(configPath, JSON.stringify(EMPTY_SDK_CONFIG, null, 2));
|
|
30029
|
-
await fs.writeFile(packageJsonPath, createPackageJson(name, sdkVersion));
|
|
30030
30921
|
await fs.writeFile(projectPath, createProjectUiproj(name));
|
|
30031
|
-
|
|
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
|
+
}
|
|
30032
30929
|
const solutionRegistration = await tryRegisterProjectInParentSolution(fs, targetPath, { skipRegistration: skipSolutionRegistration });
|
|
30033
30930
|
let projectArtifacts;
|
|
30034
30931
|
if ((solutionRegistration.Status === "Registered" || solutionRegistration.Status === "AlreadyRegistered") && solutionRegistration.Solution && solutionRegistration.ProjectId) {
|
|
@@ -30040,23 +30937,17 @@ async function executeInit(options) {
|
|
|
30040
30937
|
projectSubType: isAction ? "CodedAction" : "Coded"
|
|
30041
30938
|
});
|
|
30042
30939
|
}
|
|
30043
|
-
const relDist = inSolution ? `${SOURCE_DIR}/${DIST_DIR}/index.html` : `${DIST_DIR}/index.html`;
|
|
30044
|
-
const relConfig = inSolution ? `${SOURCE_DIR}/${AUTH_CONSTANTS.FILES.SDK_CONFIG}` : AUTH_CONSTANTS.FILES.SDK_CONFIG;
|
|
30045
|
-
const relPackageJson = inSolution ? `${SOURCE_DIR}/${PACKAGE_JSON_FILE}` : PACKAGE_JSON_FILE;
|
|
30046
30940
|
const result = {
|
|
30047
30941
|
path: targetPath,
|
|
30048
30942
|
name,
|
|
30049
30943
|
template,
|
|
30050
30944
|
isAction,
|
|
30051
|
-
files:
|
|
30052
|
-
relDist,
|
|
30053
|
-
relConfig,
|
|
30054
|
-
relPackageJson,
|
|
30055
|
-
PROJECT_UIPROJ_FILE,
|
|
30056
|
-
WEB_APP_MANIFEST_FILE
|
|
30057
|
-
],
|
|
30945
|
+
files: writtenFiles,
|
|
30058
30946
|
SolutionRegistration: solutionRegistration
|
|
30059
30947
|
};
|
|
30948
|
+
if (adoptedApp) {
|
|
30949
|
+
result.AdoptedApp = adoptedApp;
|
|
30950
|
+
}
|
|
30060
30951
|
if (projectArtifacts) {
|
|
30061
30952
|
result.ProjectArtifacts = projectArtifacts;
|
|
30062
30953
|
}
|
|
@@ -30125,7 +31016,8 @@ var INIT_FAILURE_INSTRUCTIONS = {
|
|
|
30125
31016
|
[INIT_ERROR.TEMPLATE_INVALID]: "Use --template form, --template dashboard, or --template inline-automation.",
|
|
30126
31017
|
[INIT_ERROR.TYPE_INVALID]: "Omit --type for a regular coded app, or pass --type Action for a coded Action app.",
|
|
30127
31018
|
[INIT_ERROR.DIR_NOT_EMPTY]: "Choose an empty directory or rerun with --force to write the starter files into the existing directory.",
|
|
30128
|
-
[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."
|
|
30129
31021
|
};
|
|
30130
31022
|
function getInitFailureInstructions(error2) {
|
|
30131
31023
|
if (error2 instanceof InitError) {
|
|
@@ -30162,17 +31054,54 @@ var registerInitCommand = (program) => {
|
|
|
30162
31054
|
async function validateDistDirectory(distDir) {
|
|
30163
31055
|
const fs = getFileSystem();
|
|
30164
31056
|
const stat = await fs.stat(distDir);
|
|
30165
|
-
|
|
30166
|
-
return false;
|
|
30167
|
-
const entries = await fs.readdir(distDir);
|
|
30168
|
-
return entries.length > 0;
|
|
31057
|
+
return stat?.isDirectory() === true;
|
|
30169
31058
|
}
|
|
30170
|
-
|
|
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) {
|
|
30171
31070
|
const fs = getFileSystem();
|
|
30172
|
-
const
|
|
30173
|
-
|
|
30174
|
-
|
|
30175
|
-
|
|
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");
|
|
30176
31105
|
if (!html)
|
|
30177
31106
|
return false;
|
|
30178
31107
|
const attrPattern = /(?:src|href)\s*=\s*["']\/(?!\/|https?:|data:)[^"']*["']/gi;
|
|
@@ -30228,27 +31157,32 @@ function createToolLogger(logger2) {
|
|
|
30228
31157
|
logMessage: noop
|
|
30229
31158
|
};
|
|
30230
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
|
+
}
|
|
30231
31174
|
async function packageWithFactory(config, logger2) {
|
|
30232
31175
|
const fs = getFileSystem();
|
|
30233
31176
|
const cwd = fs.env.cwd();
|
|
30234
31177
|
const distAbs = fs.path.resolve(config.distDir);
|
|
30235
31178
|
const bundlePath = fs.path.relative(cwd, distAbs) || ".";
|
|
30236
|
-
const manifest = {
|
|
30237
|
-
type: "Coded" /* Coded */,
|
|
30238
|
-
solutionResourceSubType: "Coded" /* Coded */,
|
|
30239
|
-
config: { isCompiled: true, bundlePath }
|
|
30240
|
-
};
|
|
30241
|
-
const manifestPath = fs.path.join(cwd, WEBAPP_MANIFEST_FILE_NAME);
|
|
30242
|
-
const manifestPreExisted = await fs.exists(manifestPath);
|
|
30243
|
-
if (!manifestPreExisted) {
|
|
30244
|
-
await fs.writeFile(manifestPath, JSON.stringify(manifest, null, 2));
|
|
30245
|
-
}
|
|
30246
31179
|
const factory = new WebAppToolFactory;
|
|
30247
31180
|
let tool;
|
|
30248
31181
|
try {
|
|
30249
31182
|
tool = await factory.createAsync(createToolLogger(logger2), fs);
|
|
30250
31183
|
const result = await tool.packAsync({
|
|
30251
31184
|
projectPath: cwd,
|
|
31185
|
+
codedBundle: { bundlePath, mainFile: config.mainFile },
|
|
30252
31186
|
outputPath: config.outputDir,
|
|
30253
31187
|
projectType: "AppV2" /* AppV2 */,
|
|
30254
31188
|
package: {
|
|
@@ -30275,12 +31209,6 @@ async function packageWithFactory(config, logger2) {
|
|
|
30275
31209
|
if (tool) {
|
|
30276
31210
|
await tool.dispose();
|
|
30277
31211
|
}
|
|
30278
|
-
if (!manifestPreExisted) {
|
|
30279
|
-
const [rmError] = await catchError(fs.rm(manifestPath));
|
|
30280
|
-
if (rmError) {
|
|
30281
|
-
logger2.log(source_default.yellow(`Failed to remove temporary ${WEBAPP_MANIFEST_FILE_NAME}: ${rmError.message}`));
|
|
30282
|
-
}
|
|
30283
|
-
}
|
|
30284
31212
|
}
|
|
30285
31213
|
}
|
|
30286
31214
|
async function handleMetadataJson(config) {
|
|
@@ -30316,12 +31244,43 @@ async function executePack(options) {
|
|
|
30316
31244
|
if (!await validateDistDirectory(distDir)) {
|
|
30317
31245
|
throw new Error(`${MESSAGES.ERRORS.INVALID_DIST_DIRECTORY}: ${distDir}`);
|
|
30318
31246
|
}
|
|
31247
|
+
const projectEntry = await findProjectEntry(distDir);
|
|
31248
|
+
if (projectEntry) {
|
|
31249
|
+
throw new Error(MESSAGE_BUILDERS.PROJECT_FILES_IN_BUILD_DIRECTORY(projectEntry));
|
|
31250
|
+
}
|
|
30319
31251
|
const fs = getFileSystem();
|
|
30320
|
-
const
|
|
30321
|
-
|
|
30322
|
-
|
|
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
|
+
}
|
|
30323
31282
|
}
|
|
30324
|
-
if (await hasAbsoluteAssetPaths(distDir)) {
|
|
31283
|
+
if (await hasAbsoluteAssetPaths(distDir, entryPoint)) {
|
|
30325
31284
|
logger2.log(source_default.yellow(MESSAGES.INFO.ABSOLUTE_ASSET_PATHS_DETECTED));
|
|
30326
31285
|
}
|
|
30327
31286
|
let packageName = options.name;
|
|
@@ -30364,7 +31323,7 @@ async function executePack(options) {
|
|
|
30364
31323
|
version,
|
|
30365
31324
|
author: options.author ?? "UiPath Developer",
|
|
30366
31325
|
description,
|
|
30367
|
-
mainFile:
|
|
31326
|
+
mainFile: entryPoint,
|
|
30368
31327
|
contentType: options.contentType ?? "webapp",
|
|
30369
31328
|
outputDir: options.output ?? "./.uipath",
|
|
30370
31329
|
sdkConfig,
|
|
@@ -30516,7 +31475,7 @@ var buildSuccessEnvelope = (result) => {
|
|
|
30516
31475
|
};
|
|
30517
31476
|
};
|
|
30518
31477
|
var registerPackCommand = (program) => {
|
|
30519
|
-
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");
|
|
30520
31479
|
registerPackageMetadataOptions(command).examples(PACK_EXAMPLES).trackedAction(processContext, async (dist, options) => {
|
|
30521
31480
|
if (options.outputDir !== undefined && options.output !== undefined) {
|
|
30522
31481
|
OutputFormatter.error({
|
|
@@ -30577,6 +31536,53 @@ async function readActionSchemaFile() {
|
|
|
30577
31536
|
}
|
|
30578
31537
|
|
|
30579
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
|
+
}
|
|
30580
31586
|
function extractPackageMetadata(packagePath) {
|
|
30581
31587
|
const filename = getFileSystem().path.basename(packagePath, ".nupkg");
|
|
30582
31588
|
const parts = filename.split(".");
|
|
@@ -30606,15 +31612,18 @@ async function readDisplayName(uipathDir) {
|
|
|
30606
31612
|
return;
|
|
30607
31613
|
return parsed.displayName;
|
|
30608
31614
|
}
|
|
30609
|
-
|
|
31615
|
+
function fetchCurrentUserExtended(envConfig) {
|
|
30610
31616
|
const url = appendQueryParams(`${envConfig.baseUrl}/${envConfig.orgId}/${envConfig.tenantId}${API_ENDPOINTS.ORCH_CURRENT_USER_EXTENDED}`, BASIC_ORIGIN_QUERY_PARAMS);
|
|
30611
|
-
|
|
31617
|
+
return fetch(url, {
|
|
30612
31618
|
method: "GET",
|
|
30613
31619
|
headers: createHeaders({
|
|
30614
31620
|
bearerToken: envConfig.accessToken,
|
|
30615
31621
|
tenantId: envConfig.tenantId
|
|
30616
31622
|
})
|
|
30617
31623
|
});
|
|
31624
|
+
}
|
|
31625
|
+
async function getPersonalWorkspaceFeedId(envConfig) {
|
|
31626
|
+
const response = await fetchCurrentUserExtended(envConfig);
|
|
30618
31627
|
if (!response.ok) {
|
|
30619
31628
|
await handleHttpError(response, MESSAGES.ERROR_CONTEXT.PERSONAL_WORKSPACE_LOOKUP);
|
|
30620
31629
|
}
|
|
@@ -30662,11 +31671,12 @@ async function uploadPackage(packagePath, envConfig, spinner, feedId) {
|
|
|
30662
31671
|
throw new Error(`${MESSAGES.ERRORS.PACKAGE_UPLOAD_FAILED} ${responseText}`);
|
|
30663
31672
|
}
|
|
30664
31673
|
}
|
|
30665
|
-
async function registerCodedApp(metadata, envConfig,
|
|
31674
|
+
async function registerCodedApp(metadata, envConfig, isActionApp2, feedTarget, logger2) {
|
|
30666
31675
|
const url = appendQueryParams(`${envConfig.baseUrl}/${envConfig.orgId}${API_ENDPOINTS.PUBLISH_CODED_APP}`, BASIC_ORIGIN_QUERY_PARAMS);
|
|
31676
|
+
const feedId = wireFeedId(feedTarget);
|
|
30667
31677
|
let actionSchema = {};
|
|
30668
|
-
if (
|
|
30669
|
-
const appName = feedId ? `${metadata.packageName}@${feedId}` : metadata.packageName;
|
|
31678
|
+
if (isActionApp2) {
|
|
31679
|
+
const appName = feedTarget.kind !== "tenant" && feedId ? `${metadata.packageName}@${feedId}` : metadata.packageName;
|
|
30670
31680
|
const [schemaError, parsedSchema] = await catchError(readAndParseActionSchema(appName));
|
|
30671
31681
|
if (schemaError) {
|
|
30672
31682
|
logger2.log("");
|
|
@@ -30694,10 +31704,69 @@ async function registerCodedApp(metadata, envConfig, isActionApp, feedId, logger
|
|
|
30694
31704
|
body: JSON.stringify(payload)
|
|
30695
31705
|
});
|
|
30696
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
|
+
}
|
|
30697
31712
|
await handleHttpError(response, MESSAGES.ERROR_CONTEXT.CODED_APP_REGISTRATION, envConfig.accessToken);
|
|
30698
31713
|
}
|
|
30699
31714
|
return await response.json();
|
|
30700
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
|
+
}
|
|
30701
31770
|
async function resolveAppType(explicit, logger2) {
|
|
30702
31771
|
if (explicit !== undefined)
|
|
30703
31772
|
return explicit;
|
|
@@ -30722,20 +31791,247 @@ async function resolveAppType(explicit, logger2) {
|
|
|
30722
31791
|
]);
|
|
30723
31792
|
return asAction ? "Action" /* Action */ : "Web" /* Web */;
|
|
30724
31793
|
}
|
|
30725
|
-
|
|
30726
|
-
|
|
30727
|
-
|
|
30728
|
-
|
|
30729
|
-
|
|
30730
|
-
|
|
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([
|
|
30731
32024
|
{
|
|
30732
32025
|
type: "confirm",
|
|
30733
|
-
name: "
|
|
30734
|
-
message: "Publish into
|
|
30735
|
-
default:
|
|
32026
|
+
name: "tenantFeed",
|
|
32027
|
+
message: "Publish into the tenant feed? (No = your Personal Workspace feed)",
|
|
32028
|
+
default: true
|
|
30736
32029
|
}
|
|
30737
32030
|
]);
|
|
30738
|
-
|
|
32031
|
+
if (tenantFeed !== false)
|
|
32032
|
+
return tenantFeedTarget(envConfig, knownFeeds);
|
|
32033
|
+
const feedId = await getPersonalWorkspaceFeedId(envConfig);
|
|
32034
|
+
return { kind: "personal", feedId, name: "Personal Workspace" };
|
|
30739
32035
|
}
|
|
30740
32036
|
function findPackageByVersion(nupkgFiles, packageLookupNames, version) {
|
|
30741
32037
|
return nupkgFiles.find((file) => {
|
|
@@ -30859,19 +32155,15 @@ function logPublishedDetails(metadata, registerResponse, logger2) {
|
|
|
30859
32155
|
logger2.log("");
|
|
30860
32156
|
logger2.log(source_default.blue(MESSAGES.INFO.PACKAGE_AVAILABLE));
|
|
30861
32157
|
}
|
|
30862
|
-
async function publishSelectedPackage(selectedPackage, uipathDir, envConfig,
|
|
32158
|
+
async function publishSelectedPackage(selectedPackage, uipathDir, envConfig, isActionApp2, feedTarget, spinner, logger2) {
|
|
30863
32159
|
const metadata = extractPackageMetadata(selectedPackage);
|
|
30864
32160
|
metadata.displayName = await readDisplayName(uipathDir);
|
|
30865
|
-
|
|
30866
|
-
if (personalWorkspace) {
|
|
30867
|
-
spinner.text = MESSAGES.INFO.RESOLVING_PERSONAL_WORKSPACE_FEED;
|
|
30868
|
-
feedId = await getPersonalWorkspaceFeedId(envConfig);
|
|
30869
|
-
}
|
|
32161
|
+
const feedId = wireFeedId(feedTarget);
|
|
30870
32162
|
spinner.text = MESSAGES.INFO.UPLOADING_PACKAGE;
|
|
30871
32163
|
await uploadPackage(selectedPackage, envConfig, spinner, feedId);
|
|
30872
32164
|
spinner.succeed(source_default.green(MESSAGES.SUCCESS.PACKAGE_UPLOADED_SUCCESS));
|
|
30873
32165
|
spinner.start(MESSAGES.INFO.REGISTERING_CODED_APP);
|
|
30874
|
-
const registerResponse = await registerCodedApp(metadata, envConfig,
|
|
32166
|
+
const registerResponse = await registerCodedApp(metadata, envConfig, isActionApp2, feedTarget, logger2);
|
|
30875
32167
|
spinner.succeed(source_default.green(MESSAGES.SUCCESS.CODED_APP_REGISTERED_SUCCESS));
|
|
30876
32168
|
const [saveError] = await catchError(saveAppConfig({
|
|
30877
32169
|
appName: metadata.packageName,
|
|
@@ -30880,8 +32172,11 @@ async function publishSelectedPackage(selectedPackage, uipathDir, envConfig, isA
|
|
|
30880
32172
|
systemName: registerResponse.definition.systemName,
|
|
30881
32173
|
appUrl: null,
|
|
30882
32174
|
registeredAt: new Date().toISOString(),
|
|
30883
|
-
appType:
|
|
30884
|
-
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 } : {}
|
|
30885
32180
|
}));
|
|
30886
32181
|
if (saveError) {
|
|
30887
32182
|
logger2.log(source_default.yellow(`${MESSAGES.ERRORS.FAILED_TO_SAVE_APP_CONFIG} ${saveError instanceof Error ? saveError.message : MESSAGES.ERRORS.UNKNOWN_ERROR}`));
|
|
@@ -30892,8 +32187,9 @@ async function publishSelectedPackage(selectedPackage, uipathDir, envConfig, isA
|
|
|
30892
32187
|
packageVersion: metadata.packageVersion,
|
|
30893
32188
|
systemName: registerResponse.definition.systemName,
|
|
30894
32189
|
deployVersion: registerResponse.deployVersion,
|
|
30895
|
-
personalWorkspace,
|
|
30896
|
-
|
|
32190
|
+
personalWorkspace: feedTarget.kind === "personal",
|
|
32191
|
+
feedTarget: feedTarget.kind,
|
|
32192
|
+
appType: isActionApp2 ? "Action" /* Action */ : "Web" /* Web */
|
|
30897
32193
|
};
|
|
30898
32194
|
}
|
|
30899
32195
|
async function executePublish(options) {
|
|
@@ -30914,11 +32210,11 @@ async function executePublish(options) {
|
|
|
30914
32210
|
if (!envConfig)
|
|
30915
32211
|
throw new Error("Missing required configuration");
|
|
30916
32212
|
const appType = await resolveAppType(options.type, logger2);
|
|
30917
|
-
const
|
|
30918
|
-
const
|
|
32213
|
+
const isActionApp2 = appType === "Action" /* Action */;
|
|
32214
|
+
const feedTarget = await resolveFeedTarget(options, envConfig, logger2);
|
|
30919
32215
|
const cwd = fs.env.cwd();
|
|
30920
32216
|
const actionSchemaPath = fs.path.join(cwd, ACTION_SCHEMA_CONSTANTS.ACTION_SCHEMA_FILENAME);
|
|
30921
|
-
if (
|
|
32217
|
+
if (isActionApp2 && !await fs.exists(actionSchemaPath)) {
|
|
30922
32218
|
throw new Error(MESSAGES.ERRORS.ACTION_SCHEMA_REQUIRED);
|
|
30923
32219
|
}
|
|
30924
32220
|
const { packageName, packageLookupNames } = resolvePackageLookup(options, logger2);
|
|
@@ -30927,7 +32223,7 @@ async function executePublish(options) {
|
|
|
30927
32223
|
const [publishError, publishResult] = await catchError((async () => {
|
|
30928
32224
|
const nupkgFiles = await listNupkgFiles(uipathDir, spinner, logger2);
|
|
30929
32225
|
const selectedPackage = await selectPackage(nupkgFiles, packageLookupNames, packageName, options, spinner, logger2);
|
|
30930
|
-
return publishSelectedPackage(selectedPackage, uipathDir, envConfig,
|
|
32226
|
+
return publishSelectedPackage(selectedPackage, uipathDir, envConfig, isActionApp2, feedTarget, spinner, logger2);
|
|
30931
32227
|
})());
|
|
30932
32228
|
if (publishError) {
|
|
30933
32229
|
if (spinner.isSpinning) {
|
|
@@ -30952,8 +32248,38 @@ var parseAppType = (value) => {
|
|
|
30952
32248
|
};
|
|
30953
32249
|
var PUBLISH_EXAMPLES = [
|
|
30954
32250
|
{
|
|
30955
|
-
Description: "Publish a packaged .nupkg to UiPath",
|
|
30956
|
-
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',
|
|
30957
32283
|
Output: {
|
|
30958
32284
|
Code: "PublishCompleted",
|
|
30959
32285
|
Data: {
|
|
@@ -30962,8 +32288,13 @@ var PUBLISH_EXAMPLES = [
|
|
|
30962
32288
|
}
|
|
30963
32289
|
}
|
|
30964
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
|
+
};
|
|
30965
32296
|
var registerPublishCommand = (program) => {
|
|
30966
|
-
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) => {
|
|
30967
32298
|
const logger2 = {
|
|
30968
32299
|
log: (msg) => getOutputSink().writeErr(`${msg}
|
|
30969
32300
|
`)
|
|
@@ -30973,6 +32304,10 @@ var registerPublishCommand = (program) => {
|
|
|
30973
32304
|
version: options.version,
|
|
30974
32305
|
type: options.type,
|
|
30975
32306
|
personalWorkspace: options.personalWorkspace,
|
|
32307
|
+
tenantFeed: options.tenantFeed,
|
|
32308
|
+
folderPath: options.folderPath,
|
|
32309
|
+
folderKey: options.folderKey,
|
|
32310
|
+
feedId: options.feedId,
|
|
30976
32311
|
uipathDir: options.uipathDir,
|
|
30977
32312
|
baseUrl: options.baseUrl,
|
|
30978
32313
|
orgId: options.orgId,
|
|
@@ -31003,7 +32338,7 @@ var registerPublishCommand = (program) => {
|
|
|
31003
32338
|
if (result) {
|
|
31004
32339
|
trackShipSucceeded({
|
|
31005
32340
|
[ShipDimensions.ShipKind]: "publish",
|
|
31006
|
-
[ShipDimensions.Target]: result.
|
|
32341
|
+
[ShipDimensions.Target]: FEED_TARGET_TELEMETRY[result.feedTarget],
|
|
31007
32342
|
[ShipDimensions.ProjectType]: "coded_app",
|
|
31008
32343
|
[CommandDimensions.CommandName]: "uip codedapp publish",
|
|
31009
32344
|
[ShipDimensions.ArtifactCorrelationKey]: `${result.systemName}:${result.packageVersion}`,
|
|
@@ -31715,7 +33050,7 @@ function normalizeFolderPath(p) {
|
|
|
31715
33050
|
}
|
|
31716
33051
|
var PUSH_METADATA_REMOTE_PATH = `${REMOTE_SOURCE_FOLDER_NAME}/push_metadata.json`;
|
|
31717
33052
|
var WEB_APP_MANIFEST_FILENAME = "webAppManifest.json";
|
|
31718
|
-
function
|
|
33053
|
+
function normalizeBundlePath2(bundlePath) {
|
|
31719
33054
|
let s = bundlePath.split("\\").join("/");
|
|
31720
33055
|
while (s.length > 0 && s.startsWith("/"))
|
|
31721
33056
|
s = s.slice(1);
|
|
@@ -31724,12 +33059,12 @@ function normalizeBundlePath(bundlePath) {
|
|
|
31724
33059
|
return s || bundlePath;
|
|
31725
33060
|
}
|
|
31726
33061
|
function getRemoteContentRoot(bundlePath) {
|
|
31727
|
-
const name =
|
|
33062
|
+
const name = normalizeBundlePath2(bundlePath);
|
|
31728
33063
|
return name ? `${REMOTE_SOURCE_FOLDER_NAME}/${name}` : REMOTE_SOURCE_FOLDER_NAME;
|
|
31729
33064
|
}
|
|
31730
33065
|
function localPathToRemotePath(localPath, bundlePath, remoteContentRoot) {
|
|
31731
33066
|
const normalized = localPath.replace(/\\/g, "/");
|
|
31732
|
-
const buildDirNorm =
|
|
33067
|
+
const buildDirNorm = normalizeBundlePath2(bundlePath);
|
|
31733
33068
|
const prefix = buildDirNorm ? `${buildDirNorm}/` : "";
|
|
31734
33069
|
if (buildDirNorm && normalized.startsWith(prefix)) {
|
|
31735
33070
|
return `${remoteContentRoot}/${normalized.slice(prefix.length)}`;
|
|
@@ -31745,7 +33080,7 @@ function sourceLocalPathToRemotePath(localPath) {
|
|
|
31745
33080
|
}
|
|
31746
33081
|
function getRemotePathForLocalPath(localPath, bundlePath, remoteContentRoot) {
|
|
31747
33082
|
const normalized = localPath.replace(/\\/g, "/");
|
|
31748
|
-
const buildDirNorm =
|
|
33083
|
+
const buildDirNorm = normalizeBundlePath2(bundlePath);
|
|
31749
33084
|
const prefix = buildDirNorm ? `${buildDirNorm}/` : "";
|
|
31750
33085
|
if (buildDirNorm && (normalized === buildDirNorm || normalized.startsWith(prefix))) {
|
|
31751
33086
|
return localPathToRemotePath(localPath, bundlePath, remoteContentRoot);
|
|
@@ -32051,7 +33386,7 @@ function getLocalRelativePath(relativePath) {
|
|
|
32051
33386
|
function isPathUnderBuildDir(relativePath, buildDir) {
|
|
32052
33387
|
if (!buildDir)
|
|
32053
33388
|
return false;
|
|
32054
|
-
const norm =
|
|
33389
|
+
const norm = normalizeBundlePath2(buildDir);
|
|
32055
33390
|
if (!norm)
|
|
32056
33391
|
return false;
|
|
32057
33392
|
return relativePath === norm || relativePath.startsWith(`${norm}/`);
|
|
@@ -32678,7 +34013,7 @@ async function updateRemoteWebAppManifest(config, bundlePath, fullRemoteFiles, l
|
|
|
32678
34013
|
const parsed = JSON.parse(content.toString());
|
|
32679
34014
|
if (typeof parsed !== "object" || parsed === null)
|
|
32680
34015
|
return;
|
|
32681
|
-
const buildDirName =
|
|
34016
|
+
const buildDirName = normalizeBundlePath2(bundlePath);
|
|
32682
34017
|
const configObj = parsed.config ?? {};
|
|
32683
34018
|
parsed.config = {
|
|
32684
34019
|
...configObj,
|
|
@@ -33752,14 +35087,14 @@ async function fetchSolutions(envConfig) {
|
|
|
33752
35087
|
}
|
|
33753
35088
|
return allSolutions;
|
|
33754
35089
|
}
|
|
33755
|
-
function buildCreateProjectForm(appName,
|
|
33756
|
-
const solutionResourceSubType =
|
|
35090
|
+
function buildCreateProjectForm(appName, isActionApp2) {
|
|
35091
|
+
const solutionResourceSubType = isActionApp2 ? "CodedAction" : "Coded";
|
|
33757
35092
|
const webAppManifest = JSON.stringify({
|
|
33758
35093
|
type: "Coded",
|
|
33759
35094
|
solutionResourceSubType,
|
|
33760
35095
|
config: {
|
|
33761
35096
|
isCompiled: true,
|
|
33762
|
-
isActionApp
|
|
35097
|
+
isActionApp: isActionApp2
|
|
33763
35098
|
}
|
|
33764
35099
|
});
|
|
33765
35100
|
const form = new FormData;
|
|
@@ -33780,9 +35115,9 @@ function buildCreateProjectForm(appName, isActionApp) {
|
|
|
33780
35115
|
form.append("createDefaultProjectCommand.IsMain", "false");
|
|
33781
35116
|
return form;
|
|
33782
35117
|
}
|
|
33783
|
-
async function createProjectInSolution(envConfig, solutionId, appName,
|
|
35118
|
+
async function createProjectInSolution(envConfig, solutionId, appName, isActionApp2, logger2) {
|
|
33784
35119
|
const url = appendQueryParams(`${envConfig.baseUrl}/${envConfig.orgId}/studio_/backend/api/Solution/${solutionId}/Projects`, BASIC_ORIGIN_QUERY_PARAMS);
|
|
33785
|
-
const form = buildCreateProjectForm(appName,
|
|
35120
|
+
const form = buildCreateProjectForm(appName, isActionApp2);
|
|
33786
35121
|
const response = await fetch(url, {
|
|
33787
35122
|
method: "POST",
|
|
33788
35123
|
headers: {
|
|
@@ -33802,30 +35137,47 @@ async function createProjectInSolution(envConfig, solutionId, appName, isActionA
|
|
|
33802
35137
|
logger2.log(source_default.green(`Created coded app project "${appName}" in solution with ID: ${projectId}`));
|
|
33803
35138
|
return projectId;
|
|
33804
35139
|
}
|
|
33805
|
-
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() {
|
|
33806
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) {
|
|
33807
35171
|
const { appName } = await esm_default15.prompt([
|
|
33808
35172
|
{
|
|
33809
35173
|
type: "input",
|
|
33810
35174
|
name: "appName",
|
|
33811
|
-
message:
|
|
33812
|
-
default:
|
|
35175
|
+
message: MESSAGES.PROMPTS.ENTER_NEW_CODED_APP_NAME,
|
|
35176
|
+
default: await getDefaultName(),
|
|
35177
|
+
validate: validateName(MESSAGES.VALIDATIONS.CODED_APP_NAME_EMPTY)
|
|
33813
35178
|
}
|
|
33814
35179
|
]);
|
|
33815
|
-
|
|
33816
|
-
let isActionApp = false;
|
|
33817
|
-
if (schemaExists) {
|
|
33818
|
-
const { confirmAction } = await esm_default15.prompt([
|
|
33819
|
-
{
|
|
33820
|
-
type: "confirm",
|
|
33821
|
-
name: "confirmAction",
|
|
33822
|
-
message: "action-schema.json detected. Push as a Coded Action app?",
|
|
33823
|
-
default: true
|
|
33824
|
-
}
|
|
33825
|
-
]);
|
|
33826
|
-
isActionApp = confirmAction;
|
|
33827
|
-
}
|
|
33828
|
-
return createProjectInSolution(envConfig, solutionId, appName, isActionApp, logger2);
|
|
35180
|
+
return createProjectInSolution(envConfig, solutionId, appName.trim(), await resolveIsActionApp(), logger2);
|
|
33829
35181
|
}
|
|
33830
35182
|
async function promptSelectExistingSolution(envConfig, logger2) {
|
|
33831
35183
|
const solutions = await fetchSolutions(envConfig);
|
|
@@ -33874,10 +35226,10 @@ async function promptSelectExistingSolution(envConfig, logger2) {
|
|
|
33874
35226
|
logger2.log(source_default.gray(`Using project "${selectedProject?.name}" from solution "${selectedSolution.name}"`));
|
|
33875
35227
|
return chosen;
|
|
33876
35228
|
}
|
|
33877
|
-
async function createCodedAppProject(envConfig, appName,
|
|
35229
|
+
async function createCodedAppProject(envConfig, solutionName, appName, isActionApp2, logger2) {
|
|
33878
35230
|
const url = appendQueryParams(`${envConfig.baseUrl}/${envConfig.orgId}/studio_/backend/api/Solution`, BASIC_ORIGIN_QUERY_PARAMS);
|
|
33879
|
-
const form = buildCreateProjectForm(appName,
|
|
33880
|
-
form.append("name",
|
|
35231
|
+
const form = buildCreateProjectForm(appName, isActionApp2);
|
|
35232
|
+
form.append("name", solutionName);
|
|
33881
35233
|
const response = await fetch(url, {
|
|
33882
35234
|
method: "POST",
|
|
33883
35235
|
headers: {
|
|
@@ -33894,42 +35246,44 @@ async function createCodedAppProject(envConfig, appName, isActionApp, logger2) {
|
|
|
33894
35246
|
if (!projectId) {
|
|
33895
35247
|
throw new Error("Solution created but could not extract projectId from response");
|
|
33896
35248
|
}
|
|
33897
|
-
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})`));
|
|
33898
35250
|
return projectId;
|
|
33899
35251
|
}
|
|
33900
|
-
async function
|
|
33901
|
-
|
|
33902
|
-
|
|
33903
|
-
|
|
33904
|
-
|
|
33905
|
-
|
|
33906
|
-
message: "Enter a name for the new Coded App:",
|
|
33907
|
-
default: "App"
|
|
33908
|
-
}
|
|
33909
|
-
]);
|
|
33910
|
-
const schemaExists = await fs.exists(fs.path.join(fs.env.cwd(), ACTION_SCHEMA_CONSTANTS.ACTION_SCHEMA_FILENAME));
|
|
33911
|
-
let isActionApp = false;
|
|
33912
|
-
if (schemaExists) {
|
|
33913
|
-
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([
|
|
33914
35258
|
{
|
|
33915
|
-
type: "
|
|
33916
|
-
name: "
|
|
33917
|
-
message:
|
|
33918
|
-
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
|
|
33919
35273
|
}
|
|
33920
35274
|
]);
|
|
33921
|
-
|
|
35275
|
+
solutionName ||= answers.solutionName?.trim();
|
|
35276
|
+
projectName ||= answers.projectName?.trim();
|
|
33922
35277
|
}
|
|
33923
|
-
|
|
33924
|
-
|
|
33925
|
-
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);
|
|
33926
35280
|
}
|
|
33927
|
-
return
|
|
35281
|
+
return createCodedAppProject(envConfig, solutionName, projectName, await resolveIsActionApp(), logger2);
|
|
33928
35282
|
}
|
|
33929
35283
|
async function persistProjectId(projectId, logger2) {
|
|
33930
35284
|
const fs = getFileSystem();
|
|
33931
35285
|
const [saveErr] = await catchError((async () => {
|
|
33932
|
-
const { saveEnvFileAsync } = await import("./index-
|
|
35286
|
+
const { saveEnvFileAsync } = await import("./index-wbp18pm0.js");
|
|
33933
35287
|
const localEnvPath = fs.path.join(fs.env.cwd(), ".env");
|
|
33934
35288
|
await saveEnvFileAsync({
|
|
33935
35289
|
envPath: localEnvPath,
|
|
@@ -33942,22 +35296,32 @@ async function persistProjectId(projectId, logger2) {
|
|
|
33942
35296
|
logger2.log(source_default.yellow(`Could not save UIPATH_PROJECT_ID to .env: ${saveErr.message}`));
|
|
33943
35297
|
}
|
|
33944
35298
|
}
|
|
33945
|
-
|
|
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);
|
|
33946
35304
|
if (!canPrompt()) {
|
|
33947
|
-
|
|
33948
|
-
|
|
33949
|
-
|
|
33950
|
-
{
|
|
33951
|
-
type: "list",
|
|
33952
|
-
name: "action",
|
|
33953
|
-
message: "No project ID found. Would you like to create a new solution or use an existing one?",
|
|
33954
|
-
choices: [
|
|
33955
|
-
{ name: "Create a new solution", value: "new" },
|
|
33956
|
-
{ name: "Use an existing solution", value: "existing" }
|
|
33957
|
-
]
|
|
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);
|
|
33958
35308
|
}
|
|
33959
|
-
|
|
33960
|
-
|
|
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);
|
|
33961
35325
|
await persistProjectId(projectId, logger2);
|
|
33962
35326
|
return projectId;
|
|
33963
35327
|
}
|
|
@@ -33985,6 +35349,26 @@ async function validateRemoteActionSchema(config, logger2) {
|
|
|
33985
35349
|
}
|
|
33986
35350
|
}
|
|
33987
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
|
+
}
|
|
33988
35372
|
async function executePush(options) {
|
|
33989
35373
|
const logger2 = options.logger ?? {
|
|
33990
35374
|
log: (msg) => logger.info(msg)
|
|
@@ -33999,12 +35383,13 @@ async function executePush(options) {
|
|
|
33999
35383
|
if (!envConfig)
|
|
34000
35384
|
throw new Error("Missing required configuration");
|
|
34001
35385
|
const fs = getFileSystem();
|
|
34002
|
-
|
|
34003
|
-
|
|
34004
|
-
|
|
34005
|
-
}
|
|
35386
|
+
const newSolution = {
|
|
35387
|
+
solutionName: options.solutionName,
|
|
35388
|
+
projectName: options.projectName
|
|
35389
|
+
};
|
|
35390
|
+
let projectId = await findExistingProjectId(options.projectId, hasNewSolutionNames(newSolution));
|
|
34006
35391
|
if (!projectId) {
|
|
34007
|
-
projectId = await resolveProjectId(envConfig, logger2);
|
|
35392
|
+
projectId = await resolveProjectId(envConfig, newSolution, logger2);
|
|
34008
35393
|
}
|
|
34009
35394
|
logger2.startSpinner?.("Pushing...");
|
|
34010
35395
|
const rootDir = fs.env.cwd();
|
|
@@ -34047,10 +35432,20 @@ var PUSH_EXAMPLES = [
|
|
|
34047
35432
|
message: "Push completed successfully."
|
|
34048
35433
|
}
|
|
34049
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
|
+
}
|
|
34050
35445
|
}
|
|
34051
35446
|
];
|
|
34052
35447
|
var registerPushCommand = (program) => {
|
|
34053
|
-
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) => {
|
|
34054
35449
|
const verbose = options.verbose ?? false;
|
|
34055
35450
|
getOutputSink().writeErr(`${source_default.blue(MESSAGES.INFO.PUSH_HEADER)}
|
|
34056
35451
|
|
|
@@ -34058,6 +35453,8 @@ var registerPushCommand = (program) => {
|
|
|
34058
35453
|
const logger2 = buildProgressLogger(verbose);
|
|
34059
35454
|
const [error2] = await catchError(executePush({
|
|
34060
35455
|
projectId: options.projectId,
|
|
35456
|
+
solutionName: options.solutionName,
|
|
35457
|
+
projectName: options.projectName,
|
|
34061
35458
|
buildDir: options.buildDir,
|
|
34062
35459
|
ignoreResources: options.ignoreResources,
|
|
34063
35460
|
allowLargeFiles: options.allowLargeFiles,
|
|
@@ -34266,16 +35663,17 @@ async function loadAuthCredentials() {
|
|
|
34266
35663
|
var metadata = {
|
|
34267
35664
|
name: "codedapp-tool",
|
|
34268
35665
|
version: package_default.version,
|
|
34269
|
-
description: "Build, pack, publish, deploy, and manage UiPath Coded Web Applications.",
|
|
35666
|
+
description: "Build, pack, publish, deploy, convert, and manage UiPath Coded Web Applications.",
|
|
34270
35667
|
commandPrefix: "codedapp"
|
|
34271
35668
|
};
|
|
34272
35669
|
var registerCommands = async (program) => {
|
|
34273
35670
|
program.hook("preAction", async (_thisCommand, actionCommand) => {
|
|
34274
|
-
if (actionCommand.name() === "init")
|
|
35671
|
+
if (actionCommand.name() === "init" || actionCommand.name() === "convert")
|
|
34275
35672
|
return;
|
|
34276
35673
|
await loadAuthCredentials();
|
|
34277
35674
|
});
|
|
34278
35675
|
registerInitCommand(program);
|
|
35676
|
+
registerConvertCommand(program);
|
|
34279
35677
|
registerPushCommand(program);
|
|
34280
35678
|
registerPullCommand(program);
|
|
34281
35679
|
registerPackCommand(program);
|
|
@@ -34287,4 +35685,4 @@ var registerCommands = async (program) => {
|
|
|
34287
35685
|
|
|
34288
35686
|
export { metadata, registerCommands };
|
|
34289
35687
|
|
|
34290
|
-
//# debugId=
|
|
35688
|
+
//# debugId=0B71376C4710019264756E2164756E21
|