@ductape/sdk 0.1.156 → 0.1.158

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.
@@ -2987,7 +2987,24 @@ class ProductsBuilderService {
2987
2987
  return components;
2988
2988
  }
2989
2989
  async fetchApp(tag, throwErrorIfExists = false) {
2990
- const component = await this.productApi.fetchProductComponentByTag(this.product_id, 'app', tag, this.getUserAccess());
2990
+ var _a;
2991
+ let component = null;
2992
+ try {
2993
+ component = await this.productApi.fetchProductComponentByTag(this.product_id, 'app', tag, this.getUserAccess());
2994
+ }
2995
+ catch (_b) {
2996
+ // Compatibility fallback below handles deployments that only index app_tag.
2997
+ }
2998
+ if (!component) {
2999
+ const normalized = tag.toLowerCase();
3000
+ const apps = await this.fetchApps();
3001
+ component = (_a = apps.find((app) => {
3002
+ var _a, _b, _c;
3003
+ return String((_a = app.access_tag) !== null && _a !== void 0 ? _a : '').toLowerCase() === normalized
3004
+ || String((_b = app.app_tag) !== null && _b !== void 0 ? _b : '').toLowerCase() === normalized
3005
+ || String((_c = app.tag) !== null && _c !== void 0 ? _c : '').toLowerCase() === normalized;
3006
+ })) !== null && _a !== void 0 ? _a : null;
3007
+ }
2991
3008
  if (!component && throwErrorIfExists)
2992
3009
  throw new Error(`App ${tag} not found`);
2993
3010
  return component;