@odla-ai/cli 0.27.9 → 0.27.10

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/bin.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  exitCodeFor,
4
4
  redactSecrets,
5
5
  runCli
6
- } from "./chunk-LT56MKDK.js";
6
+ } from "./chunk-OGZELVS5.js";
7
7
 
8
8
  // src/bin.ts
9
9
  runCli().catch((err) => {
@@ -1397,7 +1397,7 @@ function parseCalendarStatus(raw, env) {
1397
1397
  throw new Error("calendar status returned unsupported access");
1398
1398
  }
1399
1399
  const errorValue = record(value2.error) ?? record(connection.error);
1400
- const errorCode = textField(value2.lastErrorCode, 128);
1400
+ const errorCode2 = textField(value2.lastErrorCode, 128);
1401
1401
  const bookingPageValue = Object.hasOwn(value2, "bookingPageUrl") ? value2.bookingPageUrl : Object.hasOwn(config, "bookingPageUrl") ? config.bookingPageUrl : googleConfig.bookingPageUrl;
1402
1402
  const connected = typeof (value2.connected ?? connection.connected) === "boolean" ? Boolean(value2.connected ?? connection.connected) : ["healthy", "degraded"].includes(stateValue);
1403
1403
  const bookingCalendarId = textField(value2.bookingCalendarId ?? config.bookingCalendarId, 1024);
@@ -1416,10 +1416,10 @@ function parseCalendarStatus(raw, env) {
1416
1416
  ...optionalNullableUrl("bookingPageUrl", bookingPageValue),
1417
1417
  grantedScopes: stringList(value2.grantedScopes ?? connection.grantedScopes ?? connection.scopes),
1418
1418
  ...optionalText("attemptId", value2.attemptId ?? connection.attemptId, 180),
1419
- ...errorValue || errorCode ? { error: {
1419
+ ...errorValue || errorCode2 ? { error: {
1420
1420
  ...textField(errorValue?.code, 128) ? { code: textField(errorValue?.code, 128) } : {},
1421
1421
  ...textField(errorValue?.message, 500) ? { message: textField(errorValue?.message, 500) } : {},
1422
- ...!errorValue && errorCode ? { code: errorCode } : {}
1422
+ ...!errorValue && errorCode2 ? { code: errorCode2 } : {}
1423
1423
  } } : {}
1424
1424
  };
1425
1425
  }
@@ -1799,12 +1799,26 @@ async function assertTenantAdminAccess(doFetch, cfg, env, token) {
1799
1799
  });
1800
1800
  if (res.ok || res.status === 404) return;
1801
1801
  if (res.status === 403) {
1802
+ const detail = await safeText4(res);
1803
+ if (errorCode(detail) === "human_session_required") {
1804
+ throw new Error(
1805
+ `${env}: odla-db rejected the provision credential before checking ownership for "${cfg.app.id}" (tenant ${tenantId}): human_session_required. Retrying or changing app owners will not help; the deployed odla-db must accept owner-approved app.manage credentials on provisioning routes`
1806
+ );
1807
+ }
1802
1808
  throw new Error(
1803
1809
  `${env}: this credential lacks live app.manage authority for "${cfg.app.id}" (tenant ${tenantId}) \u2014 nothing was minted or written; re-run provision with a fresh owner-approved provision handshake. If the human account is not an owner, an existing owner must add it in signed-in Studio; an agent token cannot repair ownership`
1804
1810
  );
1805
1811
  }
1806
1812
  throw new Error(`${env}: tenant access preflight (${tenantId}) failed: ${res.status} ${await safeText4(res)}`);
1807
1813
  }
1814
+ function errorCode(text2) {
1815
+ try {
1816
+ const body = JSON.parse(text2);
1817
+ return typeof body.error?.code === "string" ? body.error.code : null;
1818
+ } catch {
1819
+ return null;
1820
+ }
1821
+ }
1808
1822
  async function postJson(doFetch, url, bearer, body) {
1809
1823
  const res = await doFetch(url, {
1810
1824
  method: "POST",
@@ -13199,4 +13213,4 @@ export {
13199
13213
  exitCodeFor,
13200
13214
  runCli
13201
13215
  };
13202
- //# sourceMappingURL=chunk-LT56MKDK.js.map
13216
+ //# sourceMappingURL=chunk-OGZELVS5.js.map