@uipath/packager-tool-flow 1.202.0 → 1.202.1
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/flow-tool.d.ts +7 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +102 -30
- package/dist/maestro-automate-entry.d.ts +10 -0
- package/dist/maestro-automate-entry.js +56 -0
- package/dist/maestro-automate.d.ts +67 -0
- package/package.json +4 -3
package/dist/flow-tool.d.ts
CHANGED
|
@@ -64,7 +64,13 @@ export declare class FlowTool extends ProjectTool {
|
|
|
64
64
|
*/
|
|
65
65
|
private copyDirectoryContents;
|
|
66
66
|
/**
|
|
67
|
-
* Create operate.json
|
|
67
|
+
* Create operate.json if it doesn't already exist, then stamp the runtime
|
|
68
|
+
* profile on it.
|
|
69
|
+
*
|
|
70
|
+
* Stamping here rather than where the artifacts are generated covers both
|
|
71
|
+
* writers: a project with no `.flow` skips artifact generation entirely and
|
|
72
|
+
* gets the scaffolded operate.json, which would otherwise ship with no
|
|
73
|
+
* profile for Orchestrator to read.
|
|
68
74
|
*/
|
|
69
75
|
private createOperateFile;
|
|
70
76
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -5,5 +5,6 @@ export { createFlowRefResolver, type FlowIoLogger, migrateRawWorkflow, readFlowW
|
|
|
5
5
|
export { FlowTool } from "./flow-tool.js";
|
|
6
6
|
export { FlowToolFactory } from "./flow-tool-factory.js";
|
|
7
7
|
export { type AgentInputVariable, hydrateInlineAgentInputVariables, isInlineAgentNodeType, readInlineAgentSource, reconcileInlineAgentInputVariables, setPublishIntentOnInlineAgents, } from "./inline-agent-utils.js";
|
|
8
|
+
export { applyRuntimeProfile, isMaestroAutomateSentinel, RuntimeProfile, resolveRuntimeProfile, resolveRuntimeProfileForFlowFile, withRuntimeProfile, } from "./maestro-automate.js";
|
|
8
9
|
export { operateRuntimeOptions } from "./operate-runtime-options.js";
|
|
9
10
|
export { assertVoiceAgentDefinitionsEmbedded, type VoiceAgentFlowNode, voiceConvertOptions, } from "./voice-agent-definitions.js";
|
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
ensureProjectId,
|
|
22
22
|
NugetConstants,
|
|
23
23
|
NugetPackager,
|
|
24
|
-
Path as
|
|
24
|
+
Path as Path4,
|
|
25
25
|
ProjectTool,
|
|
26
26
|
ProjectTypes,
|
|
27
27
|
TemporaryStorageService,
|
|
@@ -32,11 +32,12 @@ import {
|
|
|
32
32
|
// package.json
|
|
33
33
|
var package_default = {
|
|
34
34
|
name: "@uipath/packager-tool-flow",
|
|
35
|
-
version: "1.202.
|
|
35
|
+
version: "1.202.1",
|
|
36
36
|
description: "UiPath Flow tool implementation",
|
|
37
37
|
type: "module",
|
|
38
38
|
exports: {
|
|
39
|
-
".": "./dist/index.js"
|
|
39
|
+
".": "./dist/index.js",
|
|
40
|
+
"./maestro-automate": "./dist/maestro-automate-entry.js"
|
|
40
41
|
},
|
|
41
42
|
repository: {
|
|
42
43
|
type: "git",
|
|
@@ -48,7 +49,7 @@ var package_default = {
|
|
|
48
49
|
},
|
|
49
50
|
types: "./dist/index.d.ts",
|
|
50
51
|
scripts: {
|
|
51
|
-
build: "bun build ./src/index.ts --outdir dist --format esm --target browser --external @uipath/filesystem --external @uipath/solutionpackager-tool-core --external @uipath/tool-agent --external @uipath/flow-core --external @uipath/flow-converter --external @uipath/flow-migrations --external @uipath/flow-schema --sourcemap=linked && tsc --emitDeclarationOnly --outDir dist",
|
|
52
|
+
build: "bun build ./src/index.ts --outdir dist --format esm --target browser --external @uipath/filesystem --external @uipath/solutionpackager-tool-core --external @uipath/tool-agent --external @uipath/flow-core --external @uipath/flow-converter --external @uipath/flow-migrations --external @uipath/flow-schema --sourcemap=linked && bun build ./src/maestro-automate-entry.ts --outdir dist --format esm --target browser --external @uipath/filesystem --external @uipath/solutionpackager-tool-core --sourcemap=linked && tsc --emitDeclarationOnly --outDir dist",
|
|
52
53
|
dev: "bun build ./src/index.ts --outdir dist --format esm --target browser --external @uipath/filesystem --external @uipath/solutionpackager-tool-core --external @uipath/tool-agent --external @uipath/flow-core --external @uipath/flow-converter --external @uipath/flow-migrations --external @uipath/flow-schema --watch",
|
|
53
54
|
test: "vitest run",
|
|
54
55
|
"test:browser": "vitest run --config=vitest.browser.config.ts",
|
|
@@ -575,6 +576,53 @@ function setPublishIntentOnInlineAgents(fileFormat) {
|
|
|
575
576
|
}
|
|
576
577
|
}
|
|
577
578
|
|
|
579
|
+
// src/maestro-automate.ts
|
|
580
|
+
import { Path as Path3 } from "@uipath/solutionpackager-tool-core";
|
|
581
|
+
var SENTINEL_FILE_NAME = ".maestro_automate";
|
|
582
|
+
var RuntimeProfile;
|
|
583
|
+
((RuntimeProfile2) => {
|
|
584
|
+
RuntimeProfile2["Lite"] = "Lite";
|
|
585
|
+
RuntimeProfile2["Standard"] = "Standard";
|
|
586
|
+
})(RuntimeProfile ||= {});
|
|
587
|
+
async function applyRuntimeProfile(fs, projectDir, profile) {
|
|
588
|
+
const sentinel = Path3.join(projectDir, SENTINEL_FILE_NAME);
|
|
589
|
+
if (profile === "Lite" /* Lite */) {
|
|
590
|
+
await fs.writeFile(sentinel, "");
|
|
591
|
+
return;
|
|
592
|
+
}
|
|
593
|
+
if (await fs.exists(sentinel)) {
|
|
594
|
+
await fs.rm(sentinel);
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
async function resolveRuntimeProfile(fs, projectDir) {
|
|
598
|
+
const sentinel = Path3.join(projectDir, SENTINEL_FILE_NAME);
|
|
599
|
+
return await fs.exists(sentinel) ? "Lite" /* Lite */ : "Standard" /* Standard */;
|
|
600
|
+
}
|
|
601
|
+
function isMaestroAutomateSentinel(fileName) {
|
|
602
|
+
return fileName === SENTINEL_FILE_NAME;
|
|
603
|
+
}
|
|
604
|
+
var PROJECT_FILE_NAME = "project.uiproj";
|
|
605
|
+
async function resolveRuntimeProfileForFlowFile(fs, flowFilePath) {
|
|
606
|
+
const flowDir = Path3.dirname(flowFilePath);
|
|
607
|
+
let dir = flowDir;
|
|
608
|
+
for (;; ) {
|
|
609
|
+
if (await fs.exists(Path3.join(dir, PROJECT_FILE_NAME))) {
|
|
610
|
+
return resolveRuntimeProfile(fs, dir);
|
|
611
|
+
}
|
|
612
|
+
const parent = Path3.dirname(dir);
|
|
613
|
+
if (parent === dir)
|
|
614
|
+
break;
|
|
615
|
+
dir = parent;
|
|
616
|
+
}
|
|
617
|
+
return resolveRuntimeProfile(fs, flowDir);
|
|
618
|
+
}
|
|
619
|
+
function withRuntimeProfile(operateJson, profile) {
|
|
620
|
+
return {
|
|
621
|
+
...operateJson,
|
|
622
|
+
runtimeOptions: { ...operateJson.runtimeOptions, profile }
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
|
|
578
626
|
// src/operate-runtime-options.ts
|
|
579
627
|
var CONVERSATION_TRIGGER_NODE_TYPE = "core.trigger.conversation";
|
|
580
628
|
function operateRuntimeOptions(nodes) {
|
|
@@ -671,8 +719,8 @@ class FlowTool extends ProjectTool {
|
|
|
671
719
|
}
|
|
672
720
|
async buildAsync(options, _cancellationToken) {
|
|
673
721
|
const tempFolder = await this._temporaryStorage.getTempFolderPath();
|
|
674
|
-
const localBuildFolder =
|
|
675
|
-
const contentFolder =
|
|
722
|
+
const localBuildFolder = Path4.join(tempFolder, NugetConstants.OutputFolderName);
|
|
723
|
+
const contentFolder = Path4.join(localBuildFolder, NugetConstants.ContentFolderName);
|
|
676
724
|
try {
|
|
677
725
|
this.logger.progress("Copying files...");
|
|
678
726
|
await this.copyProjectFiles(options.projectPath, contentFolder);
|
|
@@ -681,10 +729,11 @@ class FlowTool extends ProjectTool {
|
|
|
681
729
|
this.logger.progress("Resolving process bindings...");
|
|
682
730
|
await this.resolveProcessBindings(contentFolder);
|
|
683
731
|
const projectId = options.projectStorageId ?? await ensureProjectId(options.projectPath, this.fileSystem);
|
|
732
|
+
const profile = await resolveRuntimeProfile(this.fileSystem, options.projectPath);
|
|
684
733
|
this.logger.progress("Generating packaging artifacts from .flow...");
|
|
685
734
|
await this.generateFlowPackagingArtifacts(contentFolder, projectId, builtAgents);
|
|
686
735
|
this.logger.progress("Creating operate.json file...");
|
|
687
|
-
await this.createOperateFile(contentFolder, projectId);
|
|
736
|
+
await this.createOperateFile(contentFolder, projectId, profile);
|
|
688
737
|
this.logger.progress("Creating package-descriptor.json file...");
|
|
689
738
|
await this.createPackageDescriptor(localBuildFolder, contentFolder);
|
|
690
739
|
return new ToolResult(ToolErrorCodes.Success, "done", [
|
|
@@ -705,7 +754,7 @@ class FlowTool extends ProjectTool {
|
|
|
705
754
|
try {
|
|
706
755
|
this.logger.progress("Creating NuGet package...");
|
|
707
756
|
const nupkgFileName = `${options.package.id}.${options.package.version}.nupkg`;
|
|
708
|
-
const nupkgPath =
|
|
757
|
+
const nupkgPath = Path4.join(options.outputPath, nupkgFileName);
|
|
709
758
|
const packager = new NugetPackager(this.fileSystem);
|
|
710
759
|
const result = await packager.packAsync(localBuildFolder, options.package, nupkgPath);
|
|
711
760
|
this.logger.progress("Package created successfully");
|
|
@@ -729,7 +778,7 @@ class FlowTool extends ProjectTool {
|
|
|
729
778
|
const flowFile = entries.find((e) => e.endsWith(".flow"));
|
|
730
779
|
if (!flowFile)
|
|
731
780
|
return;
|
|
732
|
-
const flowPath =
|
|
781
|
+
const flowPath = Path4.join(contentFolder, flowFile);
|
|
733
782
|
const flowBuffer = await this.fileSystem.readFile(flowPath);
|
|
734
783
|
if (!flowBuffer)
|
|
735
784
|
return;
|
|
@@ -752,7 +801,7 @@ class FlowTool extends ProjectTool {
|
|
|
752
801
|
this.logger.warn("No .flow file found in content folder — skipping artifact generation");
|
|
753
802
|
return;
|
|
754
803
|
}
|
|
755
|
-
const flowFilePath =
|
|
804
|
+
const flowFilePath = Path4.join(contentFolder, flowFile);
|
|
756
805
|
let workflow;
|
|
757
806
|
try {
|
|
758
807
|
workflow = await readFlowWorkflow(flowFilePath, {
|
|
@@ -766,7 +815,7 @@ class FlowTool extends ProjectTool {
|
|
|
766
815
|
}
|
|
767
816
|
await this.hydrateInlineAgentInputs(workflow, builtAgents, contentFolder);
|
|
768
817
|
const bpmnFileName = flowFile.replace(/\.flow$/, ".bpmn");
|
|
769
|
-
const bpmnPath =
|
|
818
|
+
const bpmnPath = Path4.join(contentFolder, bpmnFileName);
|
|
770
819
|
const fileFormat = inMemoryWorkflowToFileFormat(workflow);
|
|
771
820
|
setPublishIntentOnInlineAgents(fileFormat);
|
|
772
821
|
const resolvedFlowJson = JSON.stringify(fileFormat);
|
|
@@ -791,7 +840,7 @@ class FlowTool extends ProjectTool {
|
|
|
791
840
|
const variables = workflow.variables ?? {};
|
|
792
841
|
const bindings = workflow.bindings ?? [];
|
|
793
842
|
const definitions = workflow.definitions ?? [];
|
|
794
|
-
const entryPointsPath =
|
|
843
|
+
const entryPointsPath = Path4.join(contentFolder, FlowConstants.EntryPointsFileName);
|
|
795
844
|
const entryPoints = getEntryPoints(bpmnFileName, packagingNodes, variables, definitions, ProjectType.Flow);
|
|
796
845
|
const agentEntryPoints = [];
|
|
797
846
|
const seenSources = new Set;
|
|
@@ -832,11 +881,11 @@ class FlowTool extends ProjectTool {
|
|
|
832
881
|
const allEntryPoints = [...entryPoints, ...agentEntryPoints];
|
|
833
882
|
await this.fileSystem.writeFile(entryPointsPath, `${JSON.stringify(generateEntryPointsJson(allEntryPoints), null, 2)}
|
|
834
883
|
`);
|
|
835
|
-
const bindingsPath =
|
|
884
|
+
const bindingsPath = Path4.join(contentFolder, FlowConstants.BindingsV2FileName);
|
|
836
885
|
const bindingResources = getBindingResources(packagingNodes, bindings, definitions);
|
|
837
886
|
await this.fileSystem.writeFile(bindingsPath, `${JSON.stringify(generateBindingsJson(bindingResources), null, 2)}
|
|
838
887
|
`);
|
|
839
|
-
const operatePath =
|
|
888
|
+
const operatePath = Path4.join(contentFolder, NugetConstants.OperateFileName);
|
|
840
889
|
const startEventMatch = bpmn.match(/<bpmn:startEvent\s+id="([^"]+)"/);
|
|
841
890
|
const startEventId = startEventMatch?.[1] ?? "start";
|
|
842
891
|
const mainEntryPoint = `/${bpmnFileName}#${startEventId}`;
|
|
@@ -865,7 +914,7 @@ class FlowTool extends ProjectTool {
|
|
|
865
914
|
}, (source, added) => this.logger.info(`Reconciled ${added} inline-agent input(s) for "${source}" from agent.json inputSchema`), (source, reason) => this.logger.warn(reason === "invalid-source" ? `Inline agent "${source}" is not a bare project-id folder, so its inputs were not reconciled and packaging skips it — the agent would ship with no bound inputs.` : `Could not read an inputSchema for inline agent "${source}", so its inputs were not reconciled — the agent would ship with no bound inputs. Check that ${source}/agent.json exists and parses.`));
|
|
866
915
|
}
|
|
867
916
|
async readCopiedAgentJson(contentFolder, source) {
|
|
868
|
-
const agentJsonPath =
|
|
917
|
+
const agentJsonPath = Path4.join(contentFolder, source, "agent.json");
|
|
869
918
|
if (!await this.fileSystem.exists(agentJsonPath)) {
|
|
870
919
|
return;
|
|
871
920
|
}
|
|
@@ -884,19 +933,19 @@ class FlowTool extends ProjectTool {
|
|
|
884
933
|
await this.fileSystem.mkdir(contentFolder);
|
|
885
934
|
const entries = await this.fileSystem.readdir(projectPath);
|
|
886
935
|
for (const entry of entries) {
|
|
887
|
-
const sourceEntry =
|
|
936
|
+
const sourceEntry = Path4.join(projectPath, entry);
|
|
888
937
|
const stat = await this.fileSystem.stat(sourceEntry);
|
|
889
938
|
if (stat?.isDirectory()) {
|
|
890
939
|
if (entry === NugetConstants.ContentFolderName) {
|
|
891
940
|
await this.copyDirectoryContents(sourceEntry, contentFolder);
|
|
892
941
|
}
|
|
893
942
|
} else if (stat?.isFile()) {
|
|
894
|
-
if (entry === "project.uiproj") {
|
|
943
|
+
if (entry === "project.uiproj" || isMaestroAutomateSentinel(entry)) {
|
|
895
944
|
continue;
|
|
896
945
|
}
|
|
897
946
|
const content = await this.fileSystem.readFile(sourceEntry);
|
|
898
947
|
if (content) {
|
|
899
|
-
await this.fileSystem.writeFile(
|
|
948
|
+
await this.fileSystem.writeFile(Path4.join(contentFolder, entry), content);
|
|
900
949
|
}
|
|
901
950
|
}
|
|
902
951
|
}
|
|
@@ -905,8 +954,8 @@ class FlowTool extends ProjectTool {
|
|
|
905
954
|
await this.fileSystem.mkdir(destinationPath);
|
|
906
955
|
const entries = await this.fileSystem.readdir(sourcePath);
|
|
907
956
|
for (const entry of entries) {
|
|
908
|
-
const sourceEntry =
|
|
909
|
-
const destinationEntry =
|
|
957
|
+
const sourceEntry = Path4.join(sourcePath, entry);
|
|
958
|
+
const destinationEntry = Path4.join(destinationPath, entry);
|
|
910
959
|
const stat = await this.fileSystem.stat(sourceEntry);
|
|
911
960
|
if (stat?.isDirectory()) {
|
|
912
961
|
await this.copyDirectoryContents(sourceEntry, destinationEntry);
|
|
@@ -918,26 +967,43 @@ class FlowTool extends ProjectTool {
|
|
|
918
967
|
}
|
|
919
968
|
}
|
|
920
969
|
}
|
|
921
|
-
async createOperateFile(contentFolder, projectId) {
|
|
970
|
+
async createOperateFile(contentFolder, projectId, profile) {
|
|
922
971
|
await writeContentOperateFile(this.fileSystem, {
|
|
923
972
|
contentFolder,
|
|
924
973
|
projectId,
|
|
925
974
|
contentType: ProjectTypes.Flow
|
|
926
975
|
});
|
|
976
|
+
const operatePath = Path4.join(contentFolder, NugetConstants.OperateFileName);
|
|
977
|
+
const raw = await this.fileSystem.readFile(operatePath);
|
|
978
|
+
if (!raw)
|
|
979
|
+
return;
|
|
980
|
+
const text = typeof raw === "string" ? raw : new TextDecoder().decode(raw);
|
|
981
|
+
let operateJson;
|
|
982
|
+
try {
|
|
983
|
+
const parsed = JSON.parse(text);
|
|
984
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
985
|
+
throw new Error("not a JSON object");
|
|
986
|
+
}
|
|
987
|
+
operateJson = parsed;
|
|
988
|
+
} catch (error) {
|
|
989
|
+
throw new Error(`Cannot set runtimeOptions.profile: ${NugetConstants.OperateFileName} is ` + `${error instanceof Error ? error.message : String(error)}. ` + "Fix or delete it and pack again; packaging regenerates a missing one.");
|
|
990
|
+
}
|
|
991
|
+
await this.fileSystem.writeFile(operatePath, `${JSON.stringify(withRuntimeProfile(operateJson, profile), null, 2)}
|
|
992
|
+
`);
|
|
927
993
|
}
|
|
928
994
|
async createPackageDescriptor(localBuildFolder, contentFolder) {
|
|
929
995
|
const descriptorFiles = {};
|
|
930
|
-
descriptorFiles[NugetConstants.OperateFileName] =
|
|
931
|
-
descriptorFiles[FlowConstants.EntryPointsFileName] =
|
|
932
|
-
descriptorFiles[NugetConstants.BindingsFileId] =
|
|
933
|
-
const contentEntries = await
|
|
996
|
+
descriptorFiles[NugetConstants.OperateFileName] = Path4.join(NugetConstants.ContentFolderName, NugetConstants.OperateFileName);
|
|
997
|
+
descriptorFiles[FlowConstants.EntryPointsFileName] = Path4.join(NugetConstants.ContentFolderName, FlowConstants.EntryPointsFileName);
|
|
998
|
+
descriptorFiles[NugetConstants.BindingsFileId] = Path4.join(NugetConstants.ContentFolderName, FlowConstants.BindingsV2FileName);
|
|
999
|
+
const contentEntries = await Path4.walkDirectory(this.fileSystem, contentFolder);
|
|
934
1000
|
for (const entry of contentEntries) {
|
|
935
|
-
const ext =
|
|
1001
|
+
const ext = Path4.extname(entry.relativePath);
|
|
936
1002
|
if (ext === ".bpmn" || ext === ".flow") {
|
|
937
|
-
descriptorFiles[entry.relativePath] =
|
|
1003
|
+
descriptorFiles[entry.relativePath] = Path4.join(NugetConstants.ContentFolderName, entry.relativePath);
|
|
938
1004
|
}
|
|
939
1005
|
}
|
|
940
|
-
const packageDescriptorPath =
|
|
1006
|
+
const packageDescriptorPath = Path4.join(localBuildFolder, NugetConstants.ContentFolderName, NugetConstants.PackageDescriptorFileName);
|
|
941
1007
|
const packageDescriptorJson = JSON.stringify({
|
|
942
1008
|
$schema: "https://cloud.uipath.com/draft/2024-12/package-descriptor",
|
|
943
1009
|
files: descriptorFiles
|
|
@@ -959,7 +1025,9 @@ toolsFactoryRepository.registerProjectToolFactory(new FlowToolFactory);
|
|
|
959
1025
|
export {
|
|
960
1026
|
FlowTool,
|
|
961
1027
|
FlowToolFactory,
|
|
1028
|
+
RuntimeProfile,
|
|
962
1029
|
SCHEMA_CONTAINER_MARKER,
|
|
1030
|
+
applyRuntimeProfile,
|
|
963
1031
|
assertVoiceAgentDefinitionsEmbedded,
|
|
964
1032
|
buildInlineAgentContract,
|
|
965
1033
|
canonicalAgentInputPath,
|
|
@@ -967,6 +1035,7 @@ export {
|
|
|
967
1035
|
createFlowRefResolver,
|
|
968
1036
|
hydrateInlineAgentInputVariables,
|
|
969
1037
|
isInlineAgentNodeType,
|
|
1038
|
+
isMaestroAutomateSentinel,
|
|
970
1039
|
leafToBinding,
|
|
971
1040
|
migrateRawWorkflow,
|
|
972
1041
|
operateRuntimeOptions,
|
|
@@ -975,9 +1044,12 @@ export {
|
|
|
975
1044
|
reconcileInlineAgentInputVariables,
|
|
976
1045
|
replaceExporterVersion,
|
|
977
1046
|
resolveAndMigrateWorkflow,
|
|
1047
|
+
resolveRuntimeProfile,
|
|
1048
|
+
resolveRuntimeProfileForFlowFile,
|
|
978
1049
|
resolveWorkflowRefs,
|
|
979
1050
|
setPublishIntentOnInlineAgents,
|
|
980
|
-
voiceConvertOptions
|
|
1051
|
+
voiceConvertOptions,
|
|
1052
|
+
withRuntimeProfile
|
|
981
1053
|
};
|
|
982
1054
|
|
|
983
|
-
//# debugId=
|
|
1055
|
+
//# debugId=836D4B4DD546E6ED64756E2164756E21
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Side-effect-free entry for the Maestro Automate helpers.
|
|
3
|
+
*
|
|
4
|
+
* The package root registers `FlowToolFactory` with the global tool repository
|
|
5
|
+
* at module load, so importing it to read a profile pulls in the whole
|
|
6
|
+
* packager and mutates that registry. `flow init` only scaffolds files, and
|
|
7
|
+
* `@uipath/flow-tool/init` is a published API, so both take this entry
|
|
8
|
+
* instead.
|
|
9
|
+
*/
|
|
10
|
+
export { applyRuntimeProfile, isMaestroAutomateSentinel, RuntimeProfile, resolveRuntimeProfile, resolveRuntimeProfileForFlowFile, withRuntimeProfile, } from "./maestro-automate.js";
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// src/maestro-automate.ts
|
|
2
|
+
import { Path } from "@uipath/solutionpackager-tool-core";
|
|
3
|
+
var SENTINEL_FILE_NAME = ".maestro_automate";
|
|
4
|
+
var RuntimeProfile;
|
|
5
|
+
((RuntimeProfile2) => {
|
|
6
|
+
RuntimeProfile2["Lite"] = "Lite";
|
|
7
|
+
RuntimeProfile2["Standard"] = "Standard";
|
|
8
|
+
})(RuntimeProfile ||= {});
|
|
9
|
+
async function applyRuntimeProfile(fs, projectDir, profile) {
|
|
10
|
+
const sentinel = Path.join(projectDir, SENTINEL_FILE_NAME);
|
|
11
|
+
if (profile === "Lite" /* Lite */) {
|
|
12
|
+
await fs.writeFile(sentinel, "");
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (await fs.exists(sentinel)) {
|
|
16
|
+
await fs.rm(sentinel);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
async function resolveRuntimeProfile(fs, projectDir) {
|
|
20
|
+
const sentinel = Path.join(projectDir, SENTINEL_FILE_NAME);
|
|
21
|
+
return await fs.exists(sentinel) ? "Lite" /* Lite */ : "Standard" /* Standard */;
|
|
22
|
+
}
|
|
23
|
+
function isMaestroAutomateSentinel(fileName) {
|
|
24
|
+
return fileName === SENTINEL_FILE_NAME;
|
|
25
|
+
}
|
|
26
|
+
var PROJECT_FILE_NAME = "project.uiproj";
|
|
27
|
+
async function resolveRuntimeProfileForFlowFile(fs, flowFilePath) {
|
|
28
|
+
const flowDir = Path.dirname(flowFilePath);
|
|
29
|
+
let dir = flowDir;
|
|
30
|
+
for (;; ) {
|
|
31
|
+
if (await fs.exists(Path.join(dir, PROJECT_FILE_NAME))) {
|
|
32
|
+
return resolveRuntimeProfile(fs, dir);
|
|
33
|
+
}
|
|
34
|
+
const parent = Path.dirname(dir);
|
|
35
|
+
if (parent === dir)
|
|
36
|
+
break;
|
|
37
|
+
dir = parent;
|
|
38
|
+
}
|
|
39
|
+
return resolveRuntimeProfile(fs, flowDir);
|
|
40
|
+
}
|
|
41
|
+
function withRuntimeProfile(operateJson, profile) {
|
|
42
|
+
return {
|
|
43
|
+
...operateJson,
|
|
44
|
+
runtimeOptions: { ...operateJson.runtimeOptions, profile }
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
RuntimeProfile,
|
|
49
|
+
applyRuntimeProfile,
|
|
50
|
+
isMaestroAutomateSentinel,
|
|
51
|
+
resolveRuntimeProfile,
|
|
52
|
+
resolveRuntimeProfileForFlowFile,
|
|
53
|
+
withRuntimeProfile
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
//# debugId=A6D16C6E2614839D64756E2164756E21
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maestro Automate is a Flow project packed with a restricted runtime profile.
|
|
3
|
+
* It is not a separate project type: `contentType` stays `Flow` and the
|
|
4
|
+
* distinction travels as `runtimeOptions.profile` in operate.json, which
|
|
5
|
+
* Orchestrator reads off the package.
|
|
6
|
+
*
|
|
7
|
+
* Design time marks the project with a sentinel file rather than a field in
|
|
8
|
+
* `project.uiproj`, so the mark survives export, import, and projects authored
|
|
9
|
+
* outside Studio Web.
|
|
10
|
+
*/
|
|
11
|
+
import type { IFileSystem } from "@uipath/filesystem";
|
|
12
|
+
/**
|
|
13
|
+
* `operate.json` → `runtimeOptions.profile`.
|
|
14
|
+
*
|
|
15
|
+
* Canonical PascalCase, like `contentType` beside it — Orchestrator matches
|
|
16
|
+
* these values exactly. These are wire values, not user-facing vocabulary:
|
|
17
|
+
* the CLI says `--automate` and maps to them, because the product does not
|
|
18
|
+
* brand the restricted profile "Lite".
|
|
19
|
+
*/
|
|
20
|
+
export declare enum RuntimeProfile {
|
|
21
|
+
Lite = "Lite",
|
|
22
|
+
Standard = "Standard"
|
|
23
|
+
}
|
|
24
|
+
interface OperateJson {
|
|
25
|
+
runtimeOptions?: Record<string, unknown>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Make `projectDir`'s sentinel match `profile`.
|
|
29
|
+
*
|
|
30
|
+
* Symmetric on purpose: re-initializing a Lite project as Standard has to
|
|
31
|
+
* remove the sentinel, or packaging reads the stale file and ships Lite while
|
|
32
|
+
* operate.json says Standard.
|
|
33
|
+
*/
|
|
34
|
+
export declare function applyRuntimeProfile(fs: IFileSystem, projectDir: string, profile: RuntimeProfile): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* The profile `projectDir` packs with. Resolve it per project directory —
|
|
37
|
+
* one solution can hold both Automate and standard Flow projects.
|
|
38
|
+
*/
|
|
39
|
+
export declare function resolveRuntimeProfile(fs: IFileSystem, projectDir: string): Promise<RuntimeProfile>;
|
|
40
|
+
/** True for the sentinel, which packagers exclude from the package content. */
|
|
41
|
+
export declare function isMaestroAutomateSentinel(fileName: string): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* The profile for the project owning `flowFilePath`.
|
|
44
|
+
*
|
|
45
|
+
* The flow's own directory is not the project root: `findProjectFlowFile`
|
|
46
|
+
* takes `project.uiproj`'s `MainFile` at any relative depth, and also accepts
|
|
47
|
+
* a `.flow` under `content/` or `flow_files/`. So this climbs to the nearest
|
|
48
|
+
* enclosing `project.uiproj` rather than assuming a depth or reading directory
|
|
49
|
+
* names — a fixed number of levels misses a nested `MainFile`, and matching on
|
|
50
|
+
* `content` misreads a project legitimately named that. Solutions are marked
|
|
51
|
+
* by a `.uipx`, so the nearest `project.uiproj` is the owning project and the
|
|
52
|
+
* climb cannot capture a sibling's sentinel.
|
|
53
|
+
*
|
|
54
|
+
* A `.flow` with no `project.uiproj` above it resolves from its own directory;
|
|
55
|
+
* `flow debug` accepts a loose file.
|
|
56
|
+
*/
|
|
57
|
+
export declare function resolveRuntimeProfileForFlowFile(fs: IFileSystem, flowFilePath: string): Promise<RuntimeProfile>;
|
|
58
|
+
/**
|
|
59
|
+
* Stamp the profile onto an operate.json.
|
|
60
|
+
*
|
|
61
|
+
* `generateOperateJson` comes from `@uipath/flow-schema` and its options carry
|
|
62
|
+
* `isConversational` only, so the profile is merged in here. Keeping it out of
|
|
63
|
+
* that package also keeps this working across the flow-schema versions the
|
|
64
|
+
* release lines pin.
|
|
65
|
+
*/
|
|
66
|
+
export declare function withRuntimeProfile<T extends OperateJson>(operateJson: T, profile: RuntimeProfile): T;
|
|
67
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/packager-tool-flow",
|
|
3
|
-
"version": "1.202.
|
|
3
|
+
"version": "1.202.1",
|
|
4
4
|
"description": "UiPath Flow tool implementation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
|
-
".": "./dist/index.js"
|
|
7
|
+
".": "./dist/index.js",
|
|
8
|
+
"./maestro-automate": "./dist/maestro-automate-entry.js"
|
|
8
9
|
},
|
|
9
10
|
"repository": {
|
|
10
11
|
"type": "git",
|
|
@@ -29,5 +30,5 @@
|
|
|
29
30
|
"@uipath/solutionpackager-tool-core": "1.202.0",
|
|
30
31
|
"@uipath/tool-agent": "^2.0.0"
|
|
31
32
|
},
|
|
32
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "851398a44b9231a9fd8ac913a24388151bd27692"
|
|
33
34
|
}
|