@uipath/admin-tool 1.205.0-preview.277 → 1.206.0-preview.279

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.
@@ -1,23 +1,22 @@
1
1
  import {
2
- getLoginStatusAsync
3
- } from "./tool-nwbftwhg.js";
4
- import {
5
- EXIT_CODES,
6
- OutputFormatter,
7
- RESULTS,
8
- addSdkUserAgentHeader,
2
+ getFileSystem,
9
3
  catchError,
10
4
  extractErrorDetails,
11
5
  extractErrorMessage,
12
- getFileSystem,
13
- getSdkUserAgentToken,
14
- installSdkUserAgentHeader,
15
- isGuid,
6
+ RESULTS,
16
7
  logger,
8
+ EXIT_CODES,
9
+ OutputFormatter,
10
+ processContext,
11
+ isGuid,
17
12
  parseLimit,
18
- processContext
19
- } from "./tool-2wtwtawb.js";
20
- import"./tool-1yh8g550.js";
13
+ getSdkUserAgentToken,
14
+ addSdkUserAgentHeader,
15
+ installSdkUserAgentHeader
16
+ } from "./tool-zg1at4tw.js";
17
+ import {
18
+ getAuthContext
19
+ } from "./tool-1nnqcf86.js";
21
20
 
22
21
  // ../audit-sdk/generated/src/runtime.ts
23
22
  var BASE_PATH = "https://localhost:7008".replace(/\/+$/, "");
@@ -285,7 +284,7 @@ var package_default = {
285
284
  name: "@uipath/audit-sdk",
286
285
  author: "UiPath",
287
286
  license: "SEE LICENSE IN LICENSE.txt",
288
- version: "1.205.0",
287
+ version: "1.206.0",
289
288
  description: "SDK for the UiPath Audit Service — query audit event sources, list events, download long-term-store exports, and manage audit exclusion rules.",
290
289
  repository: {
291
290
  type: "git",
@@ -315,6 +314,7 @@ var package_default = {
315
314
  private: true,
316
315
  scripts: {
317
316
  build: "bun build ./src/index.ts --outdir dist --format esm --target node --sourcemap=linked && tsc -p tsconfig.build.json --noCheck",
317
+ typecheck: "tsc --noEmit",
318
318
  generate: "bun run src/scripts/generate-sdk.ts",
319
319
  lint: "biome check ."
320
320
  },
@@ -770,28 +770,22 @@ class QueryApi extends BaseAPI {
770
770
  }
771
771
  // ../audit-sdk/src/client-factory.ts
772
772
  async function createAuditConfig(options) {
773
- const status = await getLoginStatusAsync({
774
- ensureTokenValidityMinutes: options.loginValidity
773
+ const auth = await getAuthContext({
774
+ ensureTokenValidityMinutes: options.loginValidity,
775
+ requireOrganizationId: true
775
776
  });
776
- if (status.loginStatus !== "Logged in" || !status.baseUrl || !status.accessToken) {
777
- const message = status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.";
778
- throw new Error(message);
779
- }
780
- if (!status.organizationId) {
781
- throw new Error("Organization ID not available. Ensure you are logged in with an organization context.");
782
- }
783
777
  let suffix;
784
778
  if (options.scope === "tenant") {
785
- const tenantId = options.tenantId ?? status.tenantId;
779
+ const tenantId = options.tenantId ?? auth.tenantId;
786
780
  if (!tenantId) {
787
781
  throw new Error("Tenant ID required for tenant-scoped audit calls. Pass --tenant-id or select a tenant via 'uip login'.");
788
782
  }
789
- suffix = `${status.organizationId}/${tenantId}/tenantaudit_`;
783
+ suffix = `${encodeURIComponent(auth.organizationId)}/${encodeURIComponent(tenantId)}/tenantaudit_`;
790
784
  } else {
791
- suffix = `${status.organizationId}/orgaudit_`;
785
+ suffix = `${encodeURIComponent(auth.organizationId)}/orgaudit_`;
792
786
  }
793
- const basePath = `${status.baseUrl}/${suffix}`;
794
- const bearerToken = options.s2sToken ?? status.accessToken;
787
+ const basePath = `${auth.baseUrl}/${suffix}`;
788
+ const bearerToken = options.s2sToken ?? auth.accessToken;
795
789
  return new Configuration({
796
790
  basePath,
797
791
  apiKey: () => `Bearer ${bearerToken}`,
@@ -1410,25 +1404,25 @@ var x;
1410
1404
  var i;
1411
1405
  var hMap = function(cd, mb, r) {
1412
1406
  var s = cd.length;
1413
- var i2 = 0;
1407
+ var i = 0;
1414
1408
  var l = new u16(mb);
1415
- for (;i2 < s; ++i2) {
1416
- if (cd[i2])
1417
- ++l[cd[i2] - 1];
1409
+ for (;i < s; ++i) {
1410
+ if (cd[i])
1411
+ ++l[cd[i] - 1];
1418
1412
  }
1419
1413
  var le = new u16(mb);
1420
- for (i2 = 1;i2 < mb; ++i2) {
1421
- le[i2] = le[i2 - 1] + l[i2 - 1] << 1;
1414
+ for (i = 1;i < mb; ++i) {
1415
+ le[i] = le[i - 1] + l[i - 1] << 1;
1422
1416
  }
1423
1417
  var co;
1424
1418
  if (r) {
1425
1419
  co = new u16(1 << mb);
1426
1420
  var rvb = 15 - mb;
1427
- for (i2 = 0;i2 < s; ++i2) {
1428
- if (cd[i2]) {
1429
- var sv = i2 << 4 | cd[i2];
1430
- var r_1 = mb - cd[i2];
1431
- var v = le[cd[i2] - 1]++ << r_1;
1421
+ for (i = 0;i < s; ++i) {
1422
+ if (cd[i]) {
1423
+ var sv = i << 4 | cd[i];
1424
+ var r_1 = mb - cd[i];
1425
+ var v = le[cd[i] - 1]++ << r_1;
1432
1426
  for (var m = v | (1 << r_1) - 1;v <= m; ++v) {
1433
1427
  co[rev[v] >> rvb] = sv;
1434
1428
  }
@@ -1436,9 +1430,9 @@ var hMap = function(cd, mb, r) {
1436
1430
  }
1437
1431
  } else {
1438
1432
  co = new u16(s);
1439
- for (i2 = 0;i2 < s; ++i2) {
1440
- if (cd[i2]) {
1441
- co[i2] = rev[le[cd[i2] - 1]++] >> 15 - cd[i2];
1433
+ for (i = 0;i < s; ++i) {
1434
+ if (cd[i]) {
1435
+ co[i] = rev[le[cd[i] - 1]++] >> 15 - cd[i];
1442
1436
  }
1443
1437
  }
1444
1438
  }
@@ -1465,9 +1459,9 @@ var flrm = /* @__PURE__ */ hMap(flt, 9, 1);
1465
1459
  var fdrm = /* @__PURE__ */ hMap(fdt, 5, 1);
1466
1460
  var max = function(a) {
1467
1461
  var m = a[0];
1468
- for (var i2 = 1;i2 < a.length; ++i2) {
1469
- if (a[i2] > m)
1470
- m = a[i2];
1462
+ for (var i = 1;i < a.length; ++i) {
1463
+ if (a[i] > m)
1464
+ m = a[i];
1471
1465
  }
1472
1466
  return m;
1473
1467
  };
@@ -1523,15 +1517,15 @@ var inflt = function(dat, st, buf, dict) {
1523
1517
  var noSt = st.i;
1524
1518
  if (noBuf)
1525
1519
  buf = new u8(sl * 3);
1526
- var cbuf = function(l2) {
1520
+ var cbuf = function(l) {
1527
1521
  var bl = buf.length;
1528
- if (l2 > bl) {
1529
- var nbuf = new u8(Math.max(bl * 2, l2));
1522
+ if (l > bl) {
1523
+ var nbuf = new u8(Math.max(bl * 2, l));
1530
1524
  nbuf.set(buf);
1531
1525
  buf = nbuf;
1532
1526
  }
1533
1527
  };
1534
- var final = st.f || 0, pos = st.p || 0, bt = st.b || 0, lm = st.l, dm = st.d, lbt = st.m, dbt = st.n;
1528
+ var final = st.f || 0, pos = st.p || 0, bt = st.b || 0, { l: lm, d: dm, m: lbt, n: dbt } = st;
1535
1529
  var tbts = sl * 8;
1536
1530
  do {
1537
1531
  if (!lm) {
@@ -1558,28 +1552,28 @@ var inflt = function(dat, st, buf, dict) {
1558
1552
  pos += 14;
1559
1553
  var ldt = new u8(tl);
1560
1554
  var clt = new u8(19);
1561
- for (var i2 = 0;i2 < hcLen; ++i2) {
1562
- clt[clim[i2]] = bits(dat, pos + i2 * 3, 7);
1555
+ for (var i = 0;i < hcLen; ++i) {
1556
+ clt[clim[i]] = bits(dat, pos + i * 3, 7);
1563
1557
  }
1564
1558
  pos += hcLen * 3;
1565
1559
  var clb = max(clt), clbmsk = (1 << clb) - 1;
1566
1560
  var clm = hMap(clt, clb, 1);
1567
- for (var i2 = 0;i2 < tl; ) {
1561
+ for (var i = 0;i < tl; ) {
1568
1562
  var r = clm[bits(dat, pos, clbmsk)];
1569
1563
  pos += r & 15;
1570
1564
  var s = r >> 4;
1571
1565
  if (s < 16) {
1572
- ldt[i2++] = s;
1566
+ ldt[i++] = s;
1573
1567
  } else {
1574
1568
  var c = 0, n = 0;
1575
1569
  if (s == 16)
1576
- n = 3 + bits(dat, pos, 3), pos += 2, c = ldt[i2 - 1];
1570
+ n = 3 + bits(dat, pos, 3), pos += 2, c = ldt[i - 1];
1577
1571
  else if (s == 17)
1578
1572
  n = 3 + bits(dat, pos, 7), pos += 3;
1579
1573
  else if (s == 18)
1580
1574
  n = 11 + bits(dat, pos, 127), pos += 7;
1581
1575
  while (n--)
1582
- ldt[i2++] = c;
1576
+ ldt[i++] = c;
1583
1577
  }
1584
1578
  }
1585
1579
  var lt = ldt.subarray(0, hLit), dt = ldt.subarray(hLit);
@@ -1617,8 +1611,8 @@ var inflt = function(dat, st, buf, dict) {
1617
1611
  } else {
1618
1612
  var add = sym - 254;
1619
1613
  if (sym > 264) {
1620
- var i2 = sym - 257, b = fleb[i2];
1621
- add = bits(dat, pos, (1 << b) - 1) + fl[i2];
1614
+ var i = sym - 257, b = fleb[i];
1615
+ add = bits(dat, pos, (1 << b) - 1) + fl[i];
1622
1616
  pos += b;
1623
1617
  }
1624
1618
  var d = dm[bits16(dat, pos) & dms], dsym = d >> 4;
@@ -1675,31 +1669,31 @@ try {
1675
1669
  tds = 1;
1676
1670
  } catch (e) {}
1677
1671
  var dutf8 = function(d) {
1678
- for (var r = "", i2 = 0;; ) {
1679
- var c = d[i2++];
1672
+ for (var r = "", i = 0;; ) {
1673
+ var c = d[i++];
1680
1674
  var eb = (c > 127) + (c > 223) + (c > 239);
1681
- if (i2 + eb > d.length)
1682
- return { s: r, r: slc(d, i2 - 1) };
1675
+ if (i + eb > d.length)
1676
+ return { s: r, r: slc(d, i - 1) };
1683
1677
  if (!eb)
1684
1678
  r += String.fromCharCode(c);
1685
1679
  else if (eb == 3) {
1686
- c = ((c & 15) << 18 | (d[i2++] & 63) << 12 | (d[i2++] & 63) << 6 | d[i2++] & 63) - 65536, r += String.fromCharCode(55296 | c >> 10, 56320 | c & 1023);
1680
+ c = ((c & 15) << 18 | (d[i++] & 63) << 12 | (d[i++] & 63) << 6 | d[i++] & 63) - 65536, r += String.fromCharCode(55296 | c >> 10, 56320 | c & 1023);
1687
1681
  } else if (eb & 1)
1688
- r += String.fromCharCode((c & 31) << 6 | d[i2++] & 63);
1682
+ r += String.fromCharCode((c & 31) << 6 | d[i++] & 63);
1689
1683
  else
1690
- r += String.fromCharCode((c & 15) << 12 | (d[i2++] & 63) << 6 | d[i2++] & 63);
1684
+ r += String.fromCharCode((c & 15) << 12 | (d[i++] & 63) << 6 | d[i++] & 63);
1691
1685
  }
1692
1686
  };
1693
1687
  function strFromU8(dat, latin1) {
1694
1688
  if (latin1) {
1695
1689
  var r = "";
1696
- for (var i2 = 0;i2 < dat.length; i2 += 16384)
1697
- r += String.fromCharCode.apply(null, dat.subarray(i2, i2 + 16384));
1690
+ for (var i = 0;i < dat.length; i += 16384)
1691
+ r += String.fromCharCode.apply(null, dat.subarray(i, i + 16384));
1698
1692
  return r;
1699
1693
  } else if (td) {
1700
1694
  return td.decode(dat);
1701
1695
  } else {
1702
- var _a2 = dutf8(dat), s = _a2.s, r = _a2.r;
1696
+ var _a = dutf8(dat), { s, r } = _a;
1703
1697
  if (r.length)
1704
1698
  err(8);
1705
1699
  return s;
@@ -1710,7 +1704,7 @@ var slzh = function(d, b) {
1710
1704
  };
1711
1705
  var zh = function(d, b, z) {
1712
1706
  var fnl = b2(d, b + 28), efl = b2(d, b + 30), fn = strFromU8(d.subarray(b + 46, b + 46 + fnl), !(b2(d, b + 8) & 2048)), es = b + 46 + fnl;
1713
- var _a2 = z64hs(d, es, efl, z, b4(d, b + 20), b4(d, b + 24), b4(d, b + 42)), sc = _a2[0], su = _a2[1], off = _a2[2];
1707
+ var _a = z64hs(d, es, efl, z, b4(d, b + 20), b4(d, b + 24), b4(d, b + 42)), sc = _a[0], su = _a[1], off = _a[2];
1714
1708
  return [b2(d, b + 10), sc, su, fn, es + efl + b2(d, b + 32), off];
1715
1709
  };
1716
1710
  var z64hs = function(d, b, l, z, sc, su, off) {
@@ -1753,8 +1747,8 @@ function unzipSync(data, opts) {
1753
1747
  }
1754
1748
  }
1755
1749
  var fltr = opts && opts.filter;
1756
- for (var i2 = 0;i2 < c; ++i2) {
1757
- var _a2 = zh(data, o, z), c_2 = _a2[0], sc = _a2[1], su = _a2[2], fn = _a2[3], no = _a2[4], off = _a2[5], b = slzh(data, off);
1750
+ for (var i = 0;i < c; ++i) {
1751
+ var _a = zh(data, o, z), c_2 = _a[0], sc = _a[1], su = _a[2], fn = _a[3], no = _a[4], off = _a[5], b = slzh(data, off);
1758
1752
  o = no;
1759
1753
  if (!fltr || fltr({
1760
1754
  name: fn,
@@ -1817,12 +1811,12 @@ async function forEachExportEntry(api, from, to, onEntry) {
1817
1811
  from: chunkFrom,
1818
1812
  to: chunkTo
1819
1813
  });
1820
- } catch (err2) {
1821
- if (err2 instanceof ResponseError) {
1822
- const body = await err2.response.text().catch(() => "");
1823
- throw new Error(`Audit export failed for ${isoDay} (HTTP ${err2.response.status}): ${body.slice(0, 500)}`);
1814
+ } catch (err) {
1815
+ if (err instanceof ResponseError) {
1816
+ const body = await err.response.text().catch(() => "");
1817
+ throw new Error(`Audit export failed for ${isoDay} (HTTP ${err.response.status}): ${body.slice(0, 500)}`);
1824
1818
  }
1825
- throw new Error(`Audit export failed for ${isoDay}: ${err2 instanceof Error ? err2.message : String(err2)}`);
1819
+ throw new Error(`Audit export failed for ${isoDay}: ${err instanceof Error ? err.message : String(err)}`);
1826
1820
  }
1827
1821
  const dayBuffer = Buffer.from(await response.raw.arrayBuffer());
1828
1822
  if (dayBuffer.byteLength === 0)
@@ -1927,8 +1921,8 @@ function parseDailyEvents(data, isoDay, fileName) {
1927
1921
  let parsed;
1928
1922
  try {
1929
1923
  parsed = JSON.parse(text);
1930
- } catch (err2) {
1931
- throw new Error(`Audit export for ${isoDay} returned a file (${fileName}) that is not valid JSON: ${err2 instanceof Error ? err2.message : String(err2)}`);
1924
+ } catch (err) {
1925
+ throw new Error(`Audit export for ${isoDay} returned a file (${fileName}) that is not valid JSON: ${err instanceof Error ? err.message : String(err)}`);
1932
1926
  }
1933
1927
  if (Array.isArray(parsed))
1934
1928
  return parsed;
@@ -2313,17 +2307,17 @@ function registerExport(parent, opts) {
2313
2307
  const baseDir = fs.path.resolve(outputPath);
2314
2308
  const baseName = exportBaseName(from, to, generatedAt);
2315
2309
  if (format === "csv") {
2316
- const result2 = await downloadChunkedCsvExport(api, from, to);
2310
+ const result = await downloadChunkedCsvExport(api, from, to);
2317
2311
  await fs.mkdir(baseDir);
2318
2312
  const target = fs.path.join(baseDir, `${baseName}.csv`);
2319
- await fs.writeFile(target, result2.buffer);
2313
+ await fs.writeFile(target, result.buffer);
2320
2314
  return {
2321
2315
  Path: target,
2322
2316
  Format: "csv",
2323
- Bytes: result2.buffer.byteLength,
2324
- Days: result2.days,
2325
- NonEmptyDays: result2.nonEmptyDays,
2326
- Events: result2.eventCount,
2317
+ Bytes: result.buffer.byteLength,
2318
+ Days: result.days,
2319
+ NonEmptyDays: result.nonEmptyDays,
2320
+ Events: result.eventCount,
2327
2321
  GeneratedAt: generatedAt.toISOString()
2328
2322
  };
2329
2323
  }
@@ -2408,4 +2402,4 @@ export {
2408
2402
  registerCommands
2409
2403
  };
2410
2404
 
2411
- //# debugId=E384A04394AEF5EF64756E2164756E21
2405
+ //# debugId=A99146D44D8CCDE364756E2164756E21
@@ -1,24 +1,25 @@
1
1
  import {
2
- UserApi,
3
- createApiClient
4
- } from "./tool-hsqb6sve.js";
5
- import {
6
- getLoginStatusAsync
7
- } from "./tool-nwbftwhg.js";
2
+ getAuthContext
3
+ } from "./tool-1nnqcf86.js";
8
4
  import {
5
+ getFileSystem,
6
+ catchError,
7
+ extractErrorMessage,
8
+ hasIdentityInstructionContext,
9
+ RESULTS,
10
+ authContextFailure,
9
11
  InvalidArgumentError,
10
12
  Option,
11
13
  OutputFormatter,
12
- RESULTS,
13
- addSdkUserAgentHeader,
14
- catchError,
15
- extractErrorMessage,
16
- getFileSystem,
14
+ processContext,
17
15
  getSdkUserAgentToken,
18
- installSdkUserAgentHeader,
19
- processContext
20
- } from "./tool-2wtwtawb.js";
21
- import"./tool-1yh8g550.js";
16
+ addSdkUserAgentHeader,
17
+ installSdkUserAgentHeader
18
+ } from "./tool-zg1at4tw.js";
19
+ import {
20
+ UserApi,
21
+ createApiClient
22
+ } from "./tool-vp6z9an2.js";
22
23
 
23
24
  // ../authz-sdk/generated/src/runtime.ts
24
25
  var BASE_PATH = "http://localhost".replace(/\/+$/, "");
@@ -274,7 +275,7 @@ var package_default = {
274
275
  name: "@uipath/authz-sdk",
275
276
  author: "UiPath",
276
277
  license: "SEE LICENSE IN LICENSE.txt",
277
- version: "1.205.0",
278
+ version: "1.206.0",
278
279
  description: "SDK for the UiPath Authorization Service API.",
279
280
  repository: {
280
281
  type: "git",
@@ -834,26 +835,21 @@ class RoleAssignmentApi extends BaseAPI {
834
835
  }
835
836
  // ../authz-sdk/src/client-factory.ts
836
837
  async function resolveConfig(plane, options) {
837
- const status = await getLoginStatusAsync({
838
- ensureTokenValidityMinutes: options?.loginValidity
838
+ const auth = await getAuthContext({
839
+ ensureTokenValidityMinutes: options?.loginValidity,
840
+ requireOrganizationId: true
839
841
  });
840
- if (status.loginStatus !== "Logged in" || !status.baseUrl || !status.accessToken) {
841
- throw new Error(status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.");
842
- }
843
- if (!status.organizationId) {
844
- throw new Error("Organization ID not available. Ensure you are logged in with an organization context.");
845
- }
846
- const basePath = `${status.baseUrl}/${status.organizationId}/${plane}_`;
847
- const bearerToken = options?.s2sToken ?? status.accessToken;
842
+ const basePath = `${auth.baseUrl}/${encodeURIComponent(auth.organizationId)}/${plane}_`;
843
+ const bearerToken = options?.s2sToken ?? auth.accessToken;
848
844
  return {
849
845
  config: new Configuration({
850
846
  basePath,
851
847
  accessToken: async () => bearerToken,
852
848
  headers: addSdkUserAgentHeader(undefined, SDK_USER_AGENT)
853
849
  }),
854
- organizationId: status.organizationId,
855
- tenantId: status.tenantId,
856
- tenantName: status.tenantName
850
+ organizationId: auth.organizationId,
851
+ tenantId: auth.tenantId,
852
+ tenantName: auth.tenantName
857
853
  };
858
854
  }
859
855
  async function createAuthzConfig(plane, options) {
@@ -1283,13 +1279,13 @@ var shapeAssignmentListFilter = (ctx) => {
1283
1279
  if (scopeIdFlag === undefined) {
1284
1280
  return emitShapeError(`--scope ${scope} requires --scope-id <id>.`, `Pass --scope-id with the ${scope === "Project" ? "project id" : scope === "Folder" ? "folder name/id" : "app id"} to compose the scope path, or use --scope-path <path> for a verbatim match.`);
1285
1281
  }
1286
- const tenantId2 = tenantIdFlag ?? loginTenantId;
1287
- if (tenantId2 === undefined) {
1282
+ const tenantId = tenantIdFlag ?? loginTenantId;
1283
+ if (tenantId === undefined) {
1288
1284
  return emitShapeError(`--scope ${scope} requires a tenant id, but --tenant-id was not provided and the login context has no tenant.`, "Pass --tenant-id <guid>, or log in to a tenant before retrying.");
1289
1285
  }
1290
1286
  const segment = scope.toLowerCase();
1291
1287
  return {
1292
- scope: `/tenant/${tenantId2}/${service}/${segment}/${scopeIdFlag}`,
1288
+ scope: `/tenant/${tenantId}/${service}/${segment}/${scopeIdFlag}`,
1293
1289
  serviceName: service,
1294
1290
  roleScopeType: undefined
1295
1291
  };
@@ -1307,12 +1303,12 @@ var shapeAssignmentListFilter = (ctx) => {
1307
1303
  roleScopeType: "organization"
1308
1304
  };
1309
1305
  }
1310
- const tenantId2 = tenantIdFlag ?? loginTenantId;
1311
- if (tenantId2 === undefined) {
1306
+ const tenantId = tenantIdFlag ?? loginTenantId;
1307
+ if (tenantId === undefined) {
1312
1308
  return emitShapeError("Tenant-scope assignment query requires a tenant id, but --tenant-id was not provided and the login context has no tenant.", "Pass --tenant-id <guid>, or log in to a tenant before retrying.");
1313
1309
  }
1314
1310
  return {
1315
- scope: `/tenant/${tenantId2}/${service}`,
1311
+ scope: `/tenant/${tenantId}/${service}`,
1316
1312
  serviceName: service,
1317
1313
  roleScopeType: undefined
1318
1314
  };
@@ -1328,12 +1324,12 @@ var shapeAssignmentListFilter = (ctx) => {
1328
1324
  };
1329
1325
  }
1330
1326
  if (scope === "Tenant") {
1331
- const tenantId2 = tenantIdFlag ?? loginTenantId;
1332
- if (tenantId2 === undefined) {
1327
+ const tenantId = tenantIdFlag ?? loginTenantId;
1328
+ if (tenantId === undefined) {
1333
1329
  return emitShapeError("--scope Tenant requires a tenant id, but --tenant-id was not provided and the login context has no tenant.", "Pass --tenant-id <guid>, or log in to a tenant before retrying.");
1334
1330
  }
1335
1331
  return {
1336
- scope: `/tenant/${tenantId2}`,
1332
+ scope: `/tenant/${tenantId}`,
1337
1333
  serviceName: CENTRALIZED_ACCESS_SERVICE,
1338
1334
  roleScopeType: undefined
1339
1335
  };
@@ -1379,14 +1375,14 @@ var shapeAssignmentCreateScope = (ctx) => {
1379
1375
  if (scopeIdFlag === undefined) {
1380
1376
  return emitShapeError(`--scope ${scope} requires --scope-id <id>.`, `Pass --scope-id with the ${scope === "Project" ? "project id" : scope === "Folder" ? "folder name/id" : "app id"} to compose the scope path, or use --scope-path <path> for a verbatim assignment.`);
1381
1377
  }
1382
- const tenantId2 = tenantIdFlag ?? loginTenantId;
1383
- if (tenantId2 === undefined) {
1378
+ const tenantId = tenantIdFlag ?? loginTenantId;
1379
+ if (tenantId === undefined) {
1384
1380
  return emitShapeError(`--scope ${scope} requires a tenant id, but --tenant-id was not provided and the login context has no tenant.`, "Pass --tenant-id <guid>, or log in to a tenant before retrying.");
1385
1381
  }
1386
1382
  const segment = scope.toLowerCase();
1387
1383
  return {
1388
- scope: `/tenant/${tenantId2}/${service}/${segment}/${scopeIdFlag}`,
1389
- tenantId: tenantId2
1384
+ scope: `/tenant/${tenantId}/${service}/${segment}/${scopeIdFlag}`,
1385
+ tenantId
1390
1386
  };
1391
1387
  }
1392
1388
  if (service !== undefined) {
@@ -1398,13 +1394,13 @@ var shapeAssignmentCreateScope = (ctx) => {
1398
1394
  }
1399
1395
  return { scope: "/", tenantId: undefined };
1400
1396
  }
1401
- const tenantId2 = tenantIdFlag ?? loginTenantId;
1402
- if (tenantId2 === undefined) {
1397
+ const tenantId = tenantIdFlag ?? loginTenantId;
1398
+ if (tenantId === undefined) {
1403
1399
  return emitShapeError("Tenant-scope assignment requires a tenant id, but --tenant-id was not provided and the login context has no tenant.", "Pass --tenant-id <guid>, or log in to a tenant before retrying.");
1404
1400
  }
1405
1401
  return {
1406
- scope: `/tenant/${tenantId2}/${service}`,
1407
- tenantId: tenantId2
1402
+ scope: `/tenant/${tenantId}/${service}`,
1403
+ tenantId
1408
1404
  };
1409
1405
  }
1410
1406
  if (scope === "Organization") {
@@ -1414,11 +1410,11 @@ var shapeAssignmentCreateScope = (ctx) => {
1414
1410
  return { scope: "/", tenantId: undefined };
1415
1411
  }
1416
1412
  if (scope === "Tenant" || scope === "TenantGlobal") {
1417
- const tenantId2 = tenantIdFlag ?? loginTenantId;
1418
- if (tenantId2 === undefined) {
1413
+ const tenantId = tenantIdFlag ?? loginTenantId;
1414
+ if (tenantId === undefined) {
1419
1415
  return emitShapeError(`--scope ${scope} requires a tenant id, but --tenant-id was not provided and the login context has no tenant.`, "Pass --tenant-id <guid>, or log in to a tenant before retrying.");
1420
1416
  }
1421
- return { scope: `/tenant/${tenantId2}`, tenantId: tenantId2 };
1417
+ return { scope: `/tenant/${tenantId}`, tenantId };
1422
1418
  }
1423
1419
  const tenantId = tenantIdFlag ?? loginTenantId;
1424
1420
  if (tenantId === undefined) {
@@ -1621,23 +1617,21 @@ async function resolveIdentityToId(identity, options) {
1621
1617
  async function resolveTenantId(options) {
1622
1618
  if (options.tenantId !== undefined)
1623
1619
  return options.tenantId;
1624
- const [loginErr, status] = await catchError(getLoginStatusAsync({
1625
- ensureTokenValidityMinutes: options.loginValidity
1620
+ const [authError, auth] = await catchError(getAuthContext({
1621
+ ensureTokenValidityMinutes: options.loginValidity,
1622
+ requireTenantId: true
1626
1623
  }));
1627
- if (loginErr) {
1628
- await emitFailure(loginErr, "Re-run 'uip login' and retry.");
1624
+ if (authError) {
1625
+ const failure = await authContextFailure(authError, "Re-run 'uip login' and retry.");
1626
+ if (hasIdentityInstructionContext(authError)) {
1627
+ failure.Result = RESULTS.Failure;
1628
+ failure.Instructions = "Pass --tenant-id <guid>, or run 'uip login tenant set <tenant>'.";
1629
+ }
1630
+ OutputFormatter.error(failure);
1631
+ processContext.exit(1);
1629
1632
  return null;
1630
1633
  }
1631
- if (status?.tenantId !== undefined && status.tenantId !== "") {
1632
- return status.tenantId;
1633
- }
1634
- OutputFormatter.error({
1635
- Result: RESULTS.Failure,
1636
- Message: "No tenant id resolved: --tenant-id was not provided and the login session is not bound to a tenant.",
1637
- Instructions: "Pass --tenant-id <guid>, or re-run 'uip login' and select a tenant."
1638
- });
1639
- processContext.exit(1);
1640
- return null;
1634
+ return auth.tenantId;
1641
1635
  }
1642
1636
  var registerCheckAccessCommand = (authz) => {
1643
1637
  withLoginValidity(authz.command("check-access").description([
@@ -2737,4 +2731,4 @@ export {
2737
2731
  registerCommands
2738
2732
  };
2739
2733
 
2740
- //# debugId=4F3015C24C2A503D64756E2164756E21
2734
+ //# debugId=A99EE81F57B529D664756E2164756E21