@uipath/flow-tool 1.197.0 → 1.198.0-preview.100

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.
@@ -25047,6 +25047,7 @@ var require_fast_uri = __commonJS((exports, module) => {
25047
25047
  return uriTokens.join("");
25048
25048
  }
25049
25049
  var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
25050
+ var AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/;
25050
25051
  function getParseError(parsed, matches) {
25051
25052
  if (matches[2] !== undefined && parsed.path && parsed.path[0] !== "/") {
25052
25053
  return 'URI path must start with "/" when authority is present.';
@@ -25076,6 +25077,11 @@ var require_fast_uri = __commonJS((exports, module) => {
25076
25077
  uri2 = "//" + uri2;
25077
25078
  }
25078
25079
  }
25080
+ const authorityMatch = uri2.match(AUTHORITY_PREFIX);
25081
+ if (authorityMatch !== null && authorityMatch[1].indexOf("\\") !== -1) {
25082
+ parsed.error = "URI authority must not contain a literal backslash.";
25083
+ malformedAuthorityOrPort = true;
25084
+ }
25079
25085
  const matches = uri2.match(URI_PARSE);
25080
25086
  if (matches) {
25081
25087
  parsed.scheme = matches[1];
@@ -25119,7 +25125,7 @@ var require_fast_uri = __commonJS((exports, module) => {
25119
25125
  if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
25120
25126
  if (parsed.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
25121
25127
  try {
25122
- parsed.host = URL.domainToASCII(parsed.host.toLowerCase());
25128
+ parsed.host = new URL("http://" + parsed.host).hostname;
25123
25129
  } catch (e) {
25124
25130
  parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
25125
25131
  }
@@ -159757,6 +159763,10 @@ class ProjectTool {
159757
159763
  this.logger.info("Pack operation is a noop");
159758
159764
  return ToolResult.success();
159759
159765
  }
159766
+ async cleanupAsync(_options, _cancellationToken) {
159767
+ this.logger.info("Cleanup operation is a noop");
159768
+ return ToolResult.success();
159769
+ }
159760
159770
  async getUiProjectAsync(projectPath) {
159761
159771
  const filePath = Path.join(projectPath, ProjectTool.ProjectFileName);
159762
159772
  if (!await this.fileSystem.exists(filePath)) {
@@ -159836,7 +159846,7 @@ init_dist6();
159836
159846
  // ../packager/packager-tool-flow/package.json
159837
159847
  var package_default = {
159838
159848
  name: "@uipath/packager-tool-flow",
159839
- version: "1.197.0",
159849
+ version: "1.198.0-preview.100",
159840
159850
  description: "UiPath Flow tool implementation",
159841
159851
  type: "module",
159842
159852
  exports: {
@@ -171779,10 +171789,14 @@ var PROCESS_NODE_PREFIXES = [
171779
171789
  "uipath.core.agent.",
171780
171790
  "uipath.core.api-workflow."
171781
171791
  ];
171782
- var UNRESOLVED_BINDING_PATTERN = /^<bindings\.\w+>$/;
171792
+ var CONNECTOR_TOOL_PREFIX = "uipath.agent.resource.tool.connector.";
171793
+ var UNRESOLVED_BINDING_PATTERN = /^<bindings\.[^>]+>$/;
171783
171794
  function isProcessNode(nodeType) {
171784
171795
  return PROCESS_NODE_PREFIXES.some((prefix2) => nodeType?.startsWith(prefix2));
171785
171796
  }
171797
+ function isConnectorToolNode(nodeType) {
171798
+ return nodeType?.startsWith(CONNECTOR_TOOL_PREFIX) ?? false;
171799
+ }
171786
171800
  function extractProcessGuid(nodeType) {
171787
171801
  const match = nodeType.match(/^(?:uipath\.core\.rpa-workflow|uipath\.agent\.resource\.tool\.process|uipath\.core\.agent|uipath\.core\.api-workflow)\.([0-9a-f-]+)$/i);
171788
171802
  if (!match) {
@@ -171834,13 +171848,50 @@ function resolveContextPlaceholders(context, storedName, storedFolder) {
171834
171848
  }
171835
171849
  }
171836
171850
  }
171851
+ function createConnectorToolBindings(node, definition95) {
171852
+ const model = definition95.model;
171853
+ const detail = node.inputs?.detail;
171854
+ const connectionId = detail?.connectionId ?? "";
171855
+ const connectionFolderKey = detail?.connectionFolderKey ?? "";
171856
+ const values = model?.bindings?.values ?? [];
171857
+ const connValue = values.find((v2) => v2.propertyAttribute === "ConnectionId");
171858
+ const folderValue = values.find((v2) => v2.propertyAttribute === "FolderKey");
171859
+ const connectionBinding = createBinding2({
171860
+ name: connValue?.name ?? "connection",
171861
+ value: connectionId,
171862
+ resource: "Connection",
171863
+ resourceKey: connectionId,
171864
+ propertyAttribute: "ConnectionId"
171865
+ });
171866
+ const folderKeyBinding = createBinding2({
171867
+ name: folderValue?.name ?? "FolderKey",
171868
+ value: connectionFolderKey,
171869
+ resource: "Connection",
171870
+ resourceKey: connectionId,
171871
+ propertyAttribute: "FolderKey"
171872
+ });
171873
+ return { connectionBinding, folderKeyBinding };
171874
+ }
171875
+ function resolveConnectorContextPlaceholders(context, storedConnection, storedFolderKey) {
171876
+ if (!context)
171877
+ return;
171878
+ for (const entry of context) {
171879
+ if (typeof entry.value === "string" && UNRESOLVED_BINDING_PATTERN.test(entry.value)) {
171880
+ if (entry.name === "connection") {
171881
+ entry.default = storedConnection.default;
171882
+ entry.value = `=bindings.${storedConnection.id}`;
171883
+ } else if (entry.name === "folderKey") {
171884
+ entry.default = storedFolderKey.default;
171885
+ entry.value = `=bindings.${storedFolderKey.id}`;
171886
+ }
171887
+ }
171888
+ }
171889
+ }
171837
171890
  function ensureProcessBindings(workflow, logger) {
171838
171891
  const nodes = workflow.nodes ?? [];
171839
171892
  const definitions = workflow.definitions ?? [];
171840
171893
  let bindingsCreated = 0;
171841
171894
  for (const node of nodes) {
171842
- if (!isProcessNode(node.type))
171843
- continue;
171844
171895
  const nodeModel = node.model;
171845
171896
  const defModel = definitions.find((d2) => d2.nodeType === node.type)?.model;
171846
171897
  const hasUnresolved = [nodeModel, defModel].some((m2) => m2?.context?.some((entry) => typeof entry.value === "string" && UNRESOLVED_BINDING_PATTERN.test(entry.value)));
@@ -171849,25 +171900,49 @@ function ensureProcessBindings(workflow, logger) {
171849
171900
  const definition95 = definitions.find((d2) => d2.nodeType === node.type);
171850
171901
  if (!definition95)
171851
171902
  continue;
171852
- let nameBinding;
171853
- let folderBinding;
171854
- try {
171855
- ({ nameBinding, folderBinding } = createProcessBindings(definition95));
171856
- } catch (err2) {
171857
- logger.warn(`Skipping binding resolution for node "${node.id}": ${err2 instanceof Error ? err2.message : String(err2)}`);
171903
+ if (isProcessNode(node.type)) {
171904
+ let nameBinding;
171905
+ let folderBinding;
171906
+ try {
171907
+ ({ nameBinding, folderBinding } = createProcessBindings(definition95));
171908
+ } catch (err2) {
171909
+ logger.warn(`Skipping binding resolution for node "${node.id}": ${err2 instanceof Error ? err2.message : String(err2)}`);
171910
+ continue;
171911
+ }
171912
+ const beforeCount = workflow.bindings?.length ?? 0;
171913
+ addBinding(workflow, nameBinding);
171914
+ addBinding(workflow, folderBinding);
171915
+ const storedBindings = workflow.bindings;
171916
+ const storedName = storedBindings.find((b2) => b2.resourceKey === nameBinding.resourceKey && b2.propertyAttribute === nameBinding.propertyAttribute) ?? nameBinding;
171917
+ const storedFolder = storedBindings.find((b2) => b2.resourceKey === folderBinding.resourceKey && b2.propertyAttribute === folderBinding.propertyAttribute) ?? folderBinding;
171918
+ resolveContextPlaceholders(nodeModel?.context, storedName, storedFolder);
171919
+ resolveContextPlaceholders(defModel?.context, storedName, storedFolder);
171920
+ const added = (workflow.bindings?.length ?? 0) - beforeCount;
171921
+ bindingsCreated += added;
171922
+ logger.info(`Resolved process bindings for node "${node.id}" (${node.type})`);
171858
171923
  continue;
171859
171924
  }
171860
- const beforeCount = workflow.bindings?.length ?? 0;
171861
- addBinding(workflow, nameBinding);
171862
- addBinding(workflow, folderBinding);
171863
- const storedBindings = workflow.bindings;
171864
- const storedName = storedBindings.find((b2) => b2.resourceKey === nameBinding.resourceKey && b2.propertyAttribute === nameBinding.propertyAttribute) ?? nameBinding;
171865
- const storedFolder = storedBindings.find((b2) => b2.resourceKey === folderBinding.resourceKey && b2.propertyAttribute === folderBinding.propertyAttribute) ?? folderBinding;
171866
- resolveContextPlaceholders(nodeModel?.context, storedName, storedFolder);
171867
- resolveContextPlaceholders(defModel?.context, storedName, storedFolder);
171868
- const added = (workflow.bindings?.length ?? 0) - beforeCount;
171869
- bindingsCreated += added;
171870
- logger.info(`Resolved process bindings for node "${node.id}" (${node.type})`);
171925
+ if (isConnectorToolNode(node.type)) {
171926
+ let connectionBinding;
171927
+ let folderKeyBinding;
171928
+ try {
171929
+ ({ connectionBinding, folderKeyBinding } = createConnectorToolBindings(node, definition95));
171930
+ } catch (err2) {
171931
+ logger.warn(`Skipping connector binding resolution for node "${node.id}": ${err2 instanceof Error ? err2.message : String(err2)}`);
171932
+ continue;
171933
+ }
171934
+ const beforeCount = workflow.bindings?.length ?? 0;
171935
+ addBinding(workflow, connectionBinding);
171936
+ addBinding(workflow, folderKeyBinding);
171937
+ const storedBindings = workflow.bindings;
171938
+ const storedConn = storedBindings.find((b2) => b2.resourceKey === connectionBinding.resourceKey && b2.propertyAttribute === connectionBinding.propertyAttribute) ?? connectionBinding;
171939
+ const storedFk = storedBindings.find((b2) => b2.resourceKey === folderKeyBinding.resourceKey && b2.propertyAttribute === folderKeyBinding.propertyAttribute) ?? folderKeyBinding;
171940
+ resolveConnectorContextPlaceholders(nodeModel?.context, storedConn, storedFk);
171941
+ resolveConnectorContextPlaceholders(defModel?.context, storedConn, storedFk);
171942
+ const added = (workflow.bindings?.length ?? 0) - beforeCount;
171943
+ bindingsCreated += added;
171944
+ logger.info(`Resolved connector bindings for node "${node.id}" (${node.type})`);
171945
+ }
171871
171946
  }
171872
171947
  if (bindingsCreated > 0) {
171873
171948
  logger.info(`ensureProcessBindings: created ${bindingsCreated} binding(s) for directly-authored nodes`);
@@ -174488,4 +174563,4 @@ var toolsFactoryRepository2 = _global2[REGISTRY_KEY2];
174488
174563
  // src/packager-tool.ts
174489
174564
  toolsFactoryRepository2.registerProjectToolFactory(new FlowToolFactory);
174490
174565
 
174491
- //# debugId=7BFF9F271C5C8D6564756E2164756E21
174566
+ //# debugId=B3BEA5A9D74B5A4C64756E2164756E21
@@ -0,0 +1,11 @@
1
+ import type { IFileSystem } from "@uipath/filesystem";
2
+ export declare function ensureDirectory(fs: IFileSystem, path: string): Promise<void>;
3
+ export declare class FlowEvalFileStore {
4
+ private readonly fs;
5
+ constructor(fs: IFileSystem);
6
+ readJsonFiles<T extends {
7
+ fileName?: string;
8
+ }>(dir: string): Promise<T[]>;
9
+ writeJsonFile(path: string, value: unknown): Promise<void>;
10
+ remove(path: string): Promise<void>;
11
+ }
@@ -0,0 +1,51 @@
1
+ import { type MigrationErrorTracker, type MigrationWorkflow } from "@uipath/flow-migrations";
2
+ /**
3
+ * Studio Web runs the workflow migration chain when it opens a `.flow`, and
4
+ * rejects the flow if any step fails (e.g. "Workflow migration failed at
5
+ * 1.3->1.4: Invalid input for migration 1.3 -> 1.4"). The CLI bundles the same
6
+ * `@uipath/flow-migrations` engine, so it can reproduce that failure locally —
7
+ * this module is the shared plumbing that both `flow migrate` and `flow
8
+ * validate` use to do so (UV-15030).
9
+ *
10
+ * `migrateWorkflow` does NOT throw on a failed step; it returns the ORIGINAL
11
+ * workflow with `migrated: false` and a populated `error: { step, message }`.
12
+ * The offending field paths are only reachable through the optional
13
+ * `errorTracker`, not the returned `error`. `captureMigrationIssues` wires that
14
+ * tracker up so callers can enrich the bare "Invalid input" message with the
15
+ * exact nodes/fields that failed.
16
+ */
17
+ export declare function captureMigrationIssues(): {
18
+ tracker: MigrationErrorTracker;
19
+ fieldPaths: () => string[];
20
+ };
21
+ /**
22
+ * Human-facing explanation for a failed workflow migration step, shared by
23
+ * `flow migrate` (as a thrown error message) and `flow validate` (as a
24
+ * validation issue). `step` and `rawMessage` come straight from
25
+ * `migrateWorkflow`'s returned `error`; `fieldPaths` come from
26
+ * `captureMigrationIssues`.
27
+ */
28
+ export declare function formatMigrationFailureMessage(step: string, rawMessage: string, fieldPaths: string[]): string;
29
+ export type ForwardMigrationCheck = {
30
+ ok: true;
31
+ } | {
32
+ ok: false;
33
+ step: string;
34
+ rawMessage: string;
35
+ message: string;
36
+ fieldPaths: string[];
37
+ };
38
+ /**
39
+ * Run the forward migration Studio Web would run when opening this flow, in
40
+ * memory — no write, no network. Returns `{ ok: false, ... }` only when a
41
+ * migration STEP fails (the flow is at a known version but its shape is
42
+ * invalid for the next step); that flow will not open in Studio Web until
43
+ * fixed.
44
+ *
45
+ * Returns `{ ok: true }` when the flow migrates cleanly, is already current,
46
+ * OR when the chain can't be built at all — a missing/unknown/newer-than-
47
+ * bundled `version` makes `migrateWorkflow` throw before running any step.
48
+ * That last case means the CLI's bundled migrations are out of step with the
49
+ * flow (version skew), which is not a flow defect we should hard-fail on.
50
+ */
51
+ export declare function checkForwardMigration(rawWorkflow: MigrationWorkflow): ForwardMigrationCheck;
@@ -82,6 +82,18 @@ export declare class FlowValidateService {
82
82
  private loadCurrentManifestMap;
83
83
  private loadCurrentManifestMapUncached;
84
84
  validateFile(flowFilePath: string): Promise<FlowValidateResult>;
85
+ /**
86
+ * Forward-migration preflight (UV-15030).
87
+ *
88
+ * Studio Web runs the `@uipath/flow-migrations` chain when it opens a
89
+ * `.flow`; a flow that fails a migration step (e.g. 1.3->1.4) passes every
90
+ * structural/semantic check here yet never opens in the browser. The CLI
91
+ * bundles the same engine, so we run it in-memory (no write, no network)
92
+ * and turn a failed step into a blocking error naming the offending
93
+ * fields. A flow that migrates cleanly, is already current, or carries an
94
+ * unknown/skewed version yields no issue — see `checkForwardMigration`.
95
+ */
96
+ private validateForwardMigration;
85
97
  /**
86
98
  * For agent nodes that reference an external agent definition via a
87
99
  * `projectId` UUID, read the sibling `<uuid>/agent.json` file and
@@ -55,7 +55,24 @@ export interface InlineAgentPackage {
55
55
  entryPoint: EntryPoint;
56
56
  /** The raw agent.json content (for .agent-builder/agent.json). */
57
57
  agentJson: Record<string, unknown>;
58
+ bindingsJson?: PackagingBindingsJson;
58
59
  }
60
+ export interface PackagingBindingsJson extends Record<string, unknown> {
61
+ version: string;
62
+ resources: Record<string, unknown>[];
63
+ }
64
+ export interface PackagingArtifacts {
65
+ entryPoints: EntryPoint[];
66
+ bindingsJson: PackagingBindingsJson;
67
+ }
68
+ export interface PackagingArtifactOptions {
69
+ additionalEntryPoints?: EntryPoint[];
70
+ additionalBindingsJsons?: Array<PackagingBindingsJson | undefined>;
71
+ packageDescriptorJson?: Record<string, unknown>;
72
+ }
73
+ export declare function normalizePackagingBindingsJson(value: unknown): PackagingBindingsJson | undefined;
74
+ export declare function emptyPackagingBindingsJson(): PackagingBindingsJson;
75
+ export declare function mergePackagingBindingsJson(bindingsJsons: Array<PackagingBindingsJson | undefined>): PackagingBindingsJson;
59
76
  /**
60
77
  * Scan workflow nodes for inline agents, read their agent.json,
61
78
  * and build entry points + metadata for packaging.
@@ -71,6 +88,12 @@ export declare function packageInlineAgents(fs: IFileSystem, projectDir: string,
71
88
  inputs?: Record<string, unknown>;
72
89
  model?: Record<string, unknown>;
73
90
  }>): Promise<InlineAgentPackage[]>;
91
+ /**
92
+ * Copy each referenced inline agent's directory into the staging project and
93
+ * write its `.agent-builder` files (agent.json + bindings.json) — the agent's
94
+ * runtime execution contract the runtime loads when it runs the agent.
95
+ */
96
+ export declare function stageInlineAgentPackageFiles(fs: IFileSystem, sourceProjectPath: string, stagingProjectDir: string, inlineAgents: InlineAgentPackage[], formatLogMessage: (source: string) => string): Promise<void>;
74
97
  /**
75
98
  * Build inline-agent descriptors for a debug session's FpsProperties
76
99
  * injection. Mirrors flow-workbench's `extractInlineAgents` shape:
@@ -101,7 +124,8 @@ export declare function buildInlineAgentDescriptors(nodes: Array<{
101
124
  * Returns the computed entry points so callers can derive PIMS entry point paths
102
125
  * without calling getEntryPoints again.
103
126
  */
104
- export declare function writePackagingArtifacts(fs: IFileSystem, projectDir: string, projectId: string, packagingNodes: PackagingNode[], bindings: PackagingBinding[], variables: PackagingWorkflowVariables, bpmnFileName: string, startEventId: string, flowFileName?: string, definitions?: PackagingNodeManifest[]): Promise<EntryPoint[]>;
127
+ export declare function writePackagingArtifacts(fs: IFileSystem, projectDir: string, projectId: string, packagingNodes: PackagingNode[], bindings: PackagingBinding[], variables: PackagingWorkflowVariables, bpmnFileName: string, startEventId: string, flowFileName?: string, definitions?: PackagingNodeManifest[], options?: PackagingArtifactOptions): Promise<EntryPoint[]>;
128
+ export declare function writePackagingArtifactsDetailed(fs: IFileSystem, projectDir: string, projectId: string, packagingNodes: PackagingNode[], bindings: PackagingBinding[], variables: PackagingWorkflowVariables, bpmnFileName: string, startEventId: string, flowFileName?: string, definitions?: PackagingNodeManifest[], options?: PackagingArtifactOptions): Promise<PackagingArtifacts>;
105
129
  /**
106
130
  * Re-read a .flow file and regenerate bindings_v2.json in the same project directory.
107
131
  * Called after `node add` (process nodes), `node delete`, and `node configure` to