@amaster.ai/client 1.1.74 → 1.1.76

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/index.js CHANGED
@@ -1487,6 +1487,7 @@ function createResolvedClient(options, beforeAuthInitialize) {
1487
1487
  };
1488
1488
  };
1489
1489
  const scopedHttp = scope ? createScopedHttpClient(baseHttpClient, scope, credentials, autoRefresh, onUnauthorized) : void 0;
1490
+ const accountBusinessTransport = accountScope && authTransport ? createScopedHttpClient(authTransport, accountScope, credentials, autoRefresh, onUnauthorized) : void 0;
1490
1491
  const consumerHint = options.tenancy ? createConsumerUIHint(options.tenancy, () => auth.getAccessToken()) : void 0;
1491
1492
  const authority = scope ? createConsumerAuthorization(scope, consumerHint) : void 0;
1492
1493
  auth.on("credentialsChanged", (kind) => {
@@ -1497,6 +1498,10 @@ function createResolvedClient(options, beforeAuthInitialize) {
1497
1498
  const authenticatedHttpClient = scopedHttp && scope && consumerContext ? {
1498
1499
  async request(config) {
1499
1500
  const application = config.scopeLevel === "application" || /^\/api\/auth\//.test(config.url);
1501
+ if (accountBusinessTransport && application && !config.scopeCapture && config.url === "/api/tenancy/accessible" && String(config.method ?? "GET").toUpperCase() === "GET") {
1502
+ const result = await accountBusinessTransport.request({ ...config, scopeLevel: "application", preserveBusinessResponse: false });
1503
+ return result.error ? result : { ...result, scopeCapture: scope.capture("application") };
1504
+ }
1500
1505
  const selectedContextRead = config.url === "/api/tenancy/current" && !!scope.currentIdentity && !!scope.appTenantId;
1501
1506
  if (!application && (!selectedContextRead && consumerContext.pending || !scope.currentIdentity || !scope.appTenantId)) {
1502
1507
  const established = await consumerContext.ensure();
@@ -1548,7 +1553,6 @@ function createResolvedClient(options, beforeAuthInitialize) {
1548
1553
  } : void 0
1549
1554
  });
1550
1555
  const functionClient = createFunctionClient(authenticatedHttpClient);
1551
- const accountBusinessTransport = accountScope && authTransport ? createScopedHttpClient(authTransport, accountScope, credentials, autoRefresh, onUnauthorized) : void 0;
1552
1556
  const applicationHttp = accountBusinessTransport ? {
1553
1557
  async request(config) {
1554
1558
  return accountBusinessTransport.request({ ...config, scopeLevel: "application", preserveBusinessResponse: true });