fansunited-management-components 1.71.0-RC4 → 1.71.0-RC6

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/index.es.js CHANGED
@@ -11882,10 +11882,19 @@ class B1 extends A1 {
11882
11882
  headers: q(k({}, this.headers), { Authorization: "Bearer " + h }),
11883
11883
  method: "POST",
11884
11884
  body: JSON.stringify({
11885
- query: this.buildSportEntityBrowseQuery(o),
11885
+ query: this.withPopularityRanking(this.buildSportEntityBrowseQuery(o)),
11886
11886
  size: i,
11887
11887
  from: (r - 1) * i,
11888
- sort: [{ _doc: "asc" }]
11888
+ // Score first, so the page is ordered by popularity exactly as a search
11889
+ // is. This used to sort on `_doc` alone, which is index order: an
11890
+ // explicit sort replaces relevance entirely, so the popularity ranking
11891
+ // would have been computed and then thrown away.
11892
+ //
11893
+ // `_doc` stays as the tiebreaker. Most entity types carry no popularity
11894
+ // at all and so score identically, and without a stable second key
11895
+ // their order could differ between two requests - which during paging
11896
+ // shows the same entity twice and hides another.
11897
+ sort: [{ _score: "desc" }, { _doc: "asc" }]
11889
11898
  })
11890
11899
  });
11891
11900
  }));
@@ -11960,6 +11969,25 @@ class B1 extends A1 {
11960
11969
  headers: q(k({}, this.headers), { Authorization: "Bearer " + u })
11961
11970
  });
11962
11971
  }));
11972
+ /**
11973
+ * Fetch many sport entities of one type by id, in a single request.
11974
+ *
11975
+ * An `ids` query rather than a `_doc` read per id: resolving the entities a
11976
+ * document links to otherwise costs one request per link, which for a squad is
11977
+ * dozens. The proxy exposes no `_mget`, but it forwards a `_search` body
11978
+ * verbatim, so this needs nothing added to it.
11979
+ *
11980
+ * Ids missing from the index are simply absent from the response rather than
11981
+ * failing the request, so the caller must not assume the result is complete.
11982
+ */
11983
+ N(this, "getSportEntitiesByIds", (o, a, ...l) => _(this, [o, a, ...l], function* (n, r, i = this.clientId) {
11984
+ const c = `${this.resolveSportEntityIndex(r, i)}/_search`, u = yield this.getToken();
11985
+ return yield fetch(this.ikebanaProxyBaseUrl + c, {
11986
+ headers: q(k({}, this.headers), { Authorization: "Bearer " + u }),
11987
+ method: "POST",
11988
+ body: JSON.stringify({ query: { ids: { values: n } }, size: n.length })
11989
+ });
11990
+ }));
11963
11991
  /** Count sport entities in the global catalogue or a client overlay. */
11964
11992
  N(this, "countSportEntities", (i, ...o) => _(this, [i, ...o], function* (n, r = this.clientId) {
11965
11993
  const a = `${this.resolveSportEntityIndex(n, r)}/_count`, l = yield this.getToken();