@startinblox/core 2.0.6-beta.18 → 2.0.6-beta.19

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.
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
  import { q as mergeContexts, o as getRawContext, n as normalizeContext } from "./helpers-DtCY-jxq.js";
5
- import { S as StoreService } from "./store-BS4UzkyW.js";
5
+ import { S as StoreService } from "./store-BpnX896B.js";
6
6
  const store = StoreService.getInstance();
7
7
  class CustomGetter {
8
8
  // search attributes to give to server
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { g as getDefaultExportFromCjs, S as StoreService, b as base_context, f as formatAttributesToServerPaginationOptions, m as mergeServerSearchOptions, a as formatAttributesToServerSearchOptions, c as StoreType, d as StoreFactory, h as hasSetLocalData, e as hasQueryIndex, __tla as __tla_0 } from "./store-BS4UzkyW.js";
4
+ import { g as getDefaultExportFromCjs, S as StoreService, b as base_context, f as formatAttributesToServerPaginationOptions, m as mergeServerSearchOptions, a as formatAttributesToServerSearchOptions, c as StoreType, d as StoreFactory, h as hasSetLocalData, e as hasQueryIndex, __tla as __tla_0 } from "./store-BpnX896B.js";
5
5
  import { d as defineComponent, n as normalizeContext, u as uniqID, f as fuzzyCompare, a as asyncQuerySelector, i as importInlineCSS, b as importCSS, c as doesResourceContainList, e as findClosingBracketMatchIndex, p as parseFieldsString, g as evalTemplateString, h as compare, j as generalComparator, t as transformArrayToContainer, s as setDeepProperty } from "./helpers-DtCY-jxq.js";
6
- import { __tla as __tla_1 } from "./store-BS4UzkyW.js";
7
- import { A, D } from "./store-BS4UzkyW.js";
6
+ import { __tla as __tla_1 } from "./store-BpnX896B.js";
7
+ import { A, D } from "./store-BpnX896B.js";
8
8
  import { k } from "./helpers-DtCY-jxq.js";
9
9
  let index$4, BaseWidgetMixin, index$3, CounterMixin, DspCatalogDisplay, EdcAssetsDisplay, FederationMixin, FilterMixin, GrouperMixin, HighlighterMixin, ListMixin, NextMixin, PaginateMixin, RequiredMixin, Sib, SolidAcChecker, SolidDelete, SolidDisplay, SolidForm, SolidFormSearch, SolidLang, SolidMemberAdd, SolidMemberDelete, SolidMembership, SolidTable, SolidTemplateElement, SolidWidget, SorterMixin, StoreMixin, index$2, index$1, index, TranslationMixin, ValidationMixin, WidgetMixin, b, o$2, newWidgetFactory, D2, o$1, m, widgetFactory;
10
10
  let __tla = Promise.all([
@@ -5383,6 +5383,9 @@ let __tla = (async () => {
5383
5383
  __publicField(this, "cleanupAuth");
5384
5384
  __publicField(this, "isFetching", false);
5385
5385
  __publicField(this, "pendingGetData", null);
5386
+ __publicField(this, "apiReady");
5387
+ __publicField(this, "resolveApiReady");
5388
+ __publicField(this, "apiReadyTimer");
5386
5389
  __publicField(this, "resolveFetch", async (event) => {
5387
5390
  if (!this.cfg.endpoint) {
5388
5391
  throw new Error("Missing required `endpoint` in StoreConfig for FederatedCatalogueStore");
@@ -5394,19 +5397,34 @@ let __tla = (async () => {
5394
5397
  console.warn("[FederatedCatalogueStore] Auth activation event received but token not ready, skipping initialization");
5395
5398
  return;
5396
5399
  }
5400
+ const wasAlreadyReady = this.fcApi !== null;
5397
5401
  this.fcApi = getFederatedCatalogueAPIWrapper(this.cfg.endpoint, {}, event.detail.fetch);
5398
- console.log("[FederatedCatalogueStore] Auth verified and ready, triggering data refetch");
5399
- this.triggerRefetch();
5402
+ this.markApiReady();
5403
+ if (wasAlreadyReady) {
5404
+ console.log("[FederatedCatalogueStore] Auth re-activated, triggering data refetch");
5405
+ this.triggerRefetch();
5406
+ }
5400
5407
  }
5401
5408
  });
5402
5409
  this.cfg = cfg;
5403
5410
  if (!this.cfg.endpoint) {
5404
5411
  throw new Error("Missing required `endpoint` in StoreConfig for FederatedCatalogueStore");
5405
5412
  }
5413
+ this.apiReady = new Promise((resolve) => {
5414
+ this.resolveApiReady = resolve;
5415
+ });
5416
+ this.apiReadyTimer = setTimeout(() => {
5417
+ if (!this.fcApi && this.cfg.endpoint) {
5418
+ console.warn("[FederatedCatalogueStore] Auth did not activate within 5s; falling back to unauthenticated fetch.");
5419
+ this.fcApi = getFederatedCatalogueAPIWrapper(this.cfg.endpoint, {}, fetch.bind(globalThis));
5420
+ }
5421
+ this.resolveApiReady();
5422
+ }, 5e3);
5406
5423
  this.cleanupAuth = AuthFetchResolver.onAuthActivated(this.resolveFetch.bind(this));
5407
5424
  if (this.cfg.login) {
5408
5425
  const fetchAuth = AuthFetchResolver.getAuthFetch();
5409
5426
  this.fcApi = getFederatedCatalogueAPIWrapper(this.cfg.endpoint, this.cfg.login, fetchAuth);
5427
+ this.markApiReady();
5410
5428
  } else {
5411
5429
  this.initializeWithOidcAuth();
5412
5430
  }
@@ -5423,6 +5441,17 @@ let __tla = (async () => {
5423
5441
  disconnectedCallback() {
5424
5442
  var _a2;
5425
5443
  (_a2 = this.cleanupAuth) == null ? void 0 : _a2.call(this);
5444
+ if (this.apiReadyTimer !== void 0) {
5445
+ clearTimeout(this.apiReadyTimer);
5446
+ this.apiReadyTimer = void 0;
5447
+ }
5448
+ }
5449
+ markApiReady() {
5450
+ if (this.apiReadyTimer !== void 0) {
5451
+ clearTimeout(this.apiReadyTimer);
5452
+ this.apiReadyTimer = void 0;
5453
+ }
5454
+ this.resolveApiReady();
5426
5455
  }
5427
5456
  async initializeWithOidcAuth() {
5428
5457
  var _a2;
@@ -5434,6 +5463,7 @@ let __tla = (async () => {
5434
5463
  if (!authElement) {
5435
5464
  console.log("[FederatedCatalogueStore] No auth element found, initializing with basic fetch (anonymous mode)");
5436
5465
  this.fcApi = getFederatedCatalogueAPIWrapper(this.cfg.endpoint, {}, fetch.bind(window));
5466
+ this.markApiReady();
5437
5467
  return;
5438
5468
  }
5439
5469
  const isReady = await checkAuthElementReady(authElement);
@@ -5442,7 +5472,7 @@ let __tla = (async () => {
5442
5472
  if (typeof fetchAuth === "function") {
5443
5473
  console.log("[FederatedCatalogueStore] Auth is ready, initializing fcApi");
5444
5474
  this.fcApi = getFederatedCatalogueAPIWrapper(this.cfg.endpoint, {}, fetchAuth);
5445
- this.triggerRefetch();
5475
+ this.markApiReady();
5446
5476
  }
5447
5477
  } else {
5448
5478
  console.log("[FederatedCatalogueStore] Auth not ready yet, will wait for activation event");
@@ -5506,9 +5536,10 @@ let __tla = (async () => {
5506
5536
  this.isFetching = true;
5507
5537
  const executeGetData = async () => {
5508
5538
  var _a2;
5539
+ await this.apiReady;
5509
5540
  const targetType = this.resolveTargetType(args);
5510
5541
  if (!this.fcApi) {
5511
- console.warn("[FederatedCatalogueStore] API not initialized yet, waiting for auth activation");
5542
+ console.warn("[FederatedCatalogueStore] apiReady resolved without fcApi, returning empty container");
5512
5543
  return await this.initLocalDataSourceContainer();
5513
5544
  }
5514
5545
  const cacheIsValid = this.enableCaching && ((_a2 = this.metadataManager) == null ? void 0 : _a2.isCacheValid());
@@ -33026,7 +33057,7 @@ sh:property [
33026
33057
  window.dispatchEvent(event);
33027
33058
  }
33028
33059
  async initGetter() {
33029
- const { CustomGetter } = await import("./custom-getter-CRz-sS8r.js");
33060
+ const { CustomGetter } = await import("./custom-getter-CBnSj88B.js");
33030
33061
  return CustomGetter;
33031
33062
  }
33032
33063
  disconnectedCallback() {
package/dist/store.js CHANGED
@@ -1,4 +1,4 @@
1
- import { s, S, c, b, e, j, h, i } from "./store-BS4UzkyW.js";
1
+ import { s, S, c, b, e, j, h, i } from "./store-BpnX896B.js";
2
2
  export {
3
3
  s as SEMANTIZER,
4
4
  S as StoreService,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startinblox/core",
3
- "version": "2.0.6-beta.18",
3
+ "version": "2.0.6-beta.19",
4
4
  "description": "This is a series of web component respecting both the web components standards and the Linked Data Platform convention.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",