@uipath/maestro-builder-sdk 6.49.1 → 6.49.2

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.
@@ -0,0 +1,14 @@
1
+ import type { UipClient } from "../uip/client.js";
2
+ /**
3
+ * Set by `uip` for the processes it starts: the login profile the run is for.
4
+ * Empty or unset means the default login.
5
+ */
6
+ export declare const INHERITED_PROFILE_ENV = "UIPATH_CLI_INHERITED_PROFILE";
7
+ /**
8
+ * Refuse unless the `uip` on PATH answers as `profile`.
9
+ *
10
+ * A `uip` older than {@link INHERITED_PROFILE_ENV} ignores it and reads the
11
+ * default login, which can be another customer's tenant, and nothing downstream
12
+ * notices (UiPath/cli#5485).
13
+ */
14
+ export declare function assertInheritedProfile(client: UipClient, profile: string): Promise<void>;
@@ -0,0 +1,28 @@
1
+ import { Refusal } from "../errors.js";
2
+ import { loginStatus } from "../uip/commands.js";
3
+ import { failureReason, getCI, parseEnvelope } from "../uip/envelope.js";
4
+ /**
5
+ * Set by `uip` for the processes it starts: the login profile the run is for.
6
+ * Empty or unset means the default login.
7
+ */
8
+ export const INHERITED_PROFILE_ENV = "UIPATH_CLI_INHERITED_PROFILE";
9
+ /**
10
+ * Refuse unless the `uip` on PATH answers as `profile`.
11
+ *
12
+ * A `uip` older than {@link INHERITED_PROFILE_ENV} ignores it and reads the
13
+ * default login, which can be another customer's tenant, and nothing downstream
14
+ * notices (UiPath/cli#5485).
15
+ */
16
+ export async function assertInheritedProfile(client, profile) {
17
+ const result = await client.run(loginStatus());
18
+ const data = result.code === 0 ? getCI(parseEnvelope(result.stdout), "Data") : undefined;
19
+ if (data === undefined) {
20
+ throw new Refusal(`could not confirm login profile "${profile}": ${failureReason(result)}`, "PROFILE_UNCONFIRMED");
21
+ }
22
+ const actual = getCI(data, "Profile");
23
+ if (actual === profile)
24
+ return;
25
+ const answeredAs = typeof actual === "string" ? `profile "${actual}"` : "the default login";
26
+ const tenant = `${String(getCI(data, "Organization"))}/${String(getCI(data, "Tenant"))}`;
27
+ throw new Refusal(`this run is for login profile "${profile}", but the uip on PATH answers as ${answeredAs} (${tenant}). Run 'uip update', then retry.`, "PROFILE_MISMATCH");
28
+ }
@@ -2,6 +2,7 @@ import { resolve } from 'node:path';
2
2
  import { reportResult } from '../cli-result.js';
3
3
  import { PACKAGE_NAME } from "../package-name.js";
4
4
  import { exitCodeOf } from "./errors.js";
5
+ import { assertInheritedProfile, INHERITED_PROFILE_ENV } from "./prepare/inherited-profile.js";
5
6
  import { exitText } from "./prepare/messages.js";
6
7
  import { defaultOverlayOut, prepareConnector as runPipeline } from "./prepare/pipeline.js";
7
8
  import { consoleReporter } from "./reporter.js";
@@ -64,6 +65,9 @@ export async function prepareConnector(options) {
64
65
  // once, as a warning, and the calls spawn as they did before.
65
66
  const client = defaultUipClient({ host: { onFallback: (reason) => consoleReporter.warn(` WARN: ${reason}`) } });
66
67
  try {
68
+ const profile = process.env[INHERITED_PROFILE_ENV];
69
+ if (profile)
70
+ await assertInheritedProfile(client, profile);
67
71
  return await runPipeline(pipelineOptions(options), {
68
72
  client,
69
73
  reporter: consoleReporter,
@@ -15,6 +15,7 @@ export declare const UIP = "uip";
15
15
  export declare function connectionArgs(connectionId?: string): string[];
16
16
  /** `-f name=value` per parent field, in the order given. */
17
17
  export declare function fieldArgs(parentFields: ReadonlyMap<string, string> | Readonly<Record<string, string>> | undefined): string[];
18
+ export declare function loginStatus(): string[];
18
19
  export declare function registrySearchConnectors(): string[];
19
20
  export declare function registrySearch(query: string): string[];
20
21
  /**
@@ -22,6 +22,9 @@ export function fieldArgs(parentFields) {
22
22
  const entries = parentFields instanceof Map ? [...parentFields.entries()] : Object.entries(parentFields);
23
23
  return entries.flatMap(([name, value]) => ["-f", `${name}=${value}`]);
24
24
  }
25
+ export function loginStatus() {
26
+ return [UIP, "login", "status", "--output", "json"];
27
+ }
25
28
  export function registrySearchConnectors() {
26
29
  return [UIP, "maestro", "flow", "registry", "search", "--filter", "tags:in=connector", "--output", "json"];
27
30
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.49.1",
3
+ "version": "6.49.2",
4
4
  "description": "Build UiPath Flow, Case, and BPMN artifacts by writing TypeScript.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://docs.uipath.com/maestro",
@@ -92,5 +92,5 @@
92
92
  "@types/node": "^22.7.0",
93
93
  "esbuild": "^0.28.1"
94
94
  },
95
- "gitref": "784ae01c8e59d695dc0c711a7ff1be52dda3c98f"
95
+ "gitref": "72292af393e64e04ffe0ce42e31992e3ea9a3980"
96
96
  }