@getlupa/client 1.25.4 → 1.26.1

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.
@@ -12064,6 +12064,16 @@ var __async = (__this, __arguments, generator) => {
12064
12064
  const errors = yield res.json();
12065
12065
  return { success: false, errors };
12066
12066
  });
12067
+ const relatedQueriesCustom = (query, options) => __async2(null, null, function* () {
12068
+ var _a25;
12069
+ const res = yield fetch(options.customUrl, Object.assign(Object.assign({}, customRequestConfig({ customHeaders: options.customHeaders })), { body: JSON.stringify(Object.assign({ publicQuery: query }, (_a25 = options.customPayload) !== null && _a25 !== void 0 ? _a25 : {})) }));
12070
+ if (res.status < 400) {
12071
+ const data = yield res.json();
12072
+ return Object.assign(Object.assign({}, data), { success: true });
12073
+ }
12074
+ const errors = yield res.json();
12075
+ return { success: false, errors };
12076
+ });
12067
12077
  const queryByIds = (queryKey, ids, environment, customBaseUrl, customParams) => __async2(null, null, function* () {
12068
12078
  const idParam = ids.map((id) => `ids=${id}`).join("&");
12069
12079
  const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/ids?${idParam}`;
@@ -12286,6 +12296,10 @@ var __async = (__this, __arguments, generator) => {
12286
12296
  return transformSearchQueryRefinersResult(result2, options);
12287
12297
  }),
12288
12298
  queryRelated: (queryKey, publicQuery, options = null) => __async2(null, null, function* () {
12299
+ if (options === null || options === void 0 ? void 0 : options.customUrl) {
12300
+ const result3 = yield relatedQueriesCustom(publicQuery, options);
12301
+ return transformRelatedQueries(result3, options);
12302
+ }
12289
12303
  const result2 = yield relatedQueries(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12290
12304
  return transformRelatedQueries(result2, options);
12291
12305
  }),
@@ -38815,23 +38829,20 @@ and ensure you are accounting for this risk.
38815
38829
  return;
38816
38830
  }
38817
38831
  LupaSearchSdk.query(props.options.queryKey, query2, props.options.options).then((res) => {
38818
- var _a25, _b25, _c;
38832
+ var _a25, _b25, _c, _d, _e, _f, _g;
38819
38833
  if (res.success) {
38820
38834
  handleResults({ queryKey: props.options.queryKey, results: res });
38821
38835
  searchResultStore.add(requestId, __spreadValues2({}, res));
38822
38836
  searchResultStore.setRelatedQueriesApiEnabled((_a25 = res.hasRelatedQueries) != null ? _a25 : false);
38823
38837
  if (res.hasRelatedQueries && Boolean(props.options.relatedQueries)) {
38824
- searchResultStore.queryRelatedQueries(
38825
- props.options.queryKey,
38826
- publicQuery,
38827
- res,
38828
- props.options.options
38829
- );
38838
+ searchResultStore.queryRelatedQueries(props.options.queryKey, publicQuery, res, __spreadProps2(__spreadValues2({}, (_c = (_b25 = props.options) == null ? void 0 : _b25.options) != null ? _c : {}), {
38839
+ customUrl: ((_e = (_d = props.options) == null ? void 0 : _d.options) == null ? void 0 : _e.customRelatedQueriesUrl) || void 0
38840
+ }));
38830
38841
  }
38831
38842
  if (props.options.splitExpensiveRequests && res.refinementThreshold >= res.total) {
38832
38843
  queryRefiners(requestId, publicQuery);
38833
38844
  }
38834
- } else if ((_c = (_b25 = props.options) == null ? void 0 : _b25.options) == null ? void 0 : _c.onError) {
38845
+ } else if ((_g = (_f = props.options) == null ? void 0 : _f.options) == null ? void 0 : _g.onError) {
38835
38846
  props.options.options.onError(res);
38836
38847
  }
38837
38848
  }).catch((err) => {
@@ -41746,6 +41757,7 @@ and ensure you are accounting for this risk.
41746
41757
  customBaseUrl: searchResultOptions.customBaseUrl,
41747
41758
  customPayload: searchResultOptions.customPayload,
41748
41759
  customHeaders: searchResultOptions.customHeaders,
41760
+ customRelatedQueriesUrl: searchResultOptions.customRelatedQueriesUrl,
41749
41761
  onError: searchResultOptions.errorHandler
41750
41762
  },
41751
41763
  queryKey: searchResultOptions.queryKey,
@@ -12064,6 +12064,16 @@ const relatedQueries = (queryKey, query, environment, customBaseUrl, customParam
12064
12064
  const errors = yield res.json();
12065
12065
  return { success: false, errors };
12066
12066
  });
12067
+ const relatedQueriesCustom = (query, options) => __async2(null, null, function* () {
12068
+ var _a25;
12069
+ const res = yield fetch(options.customUrl, Object.assign(Object.assign({}, customRequestConfig({ customHeaders: options.customHeaders })), { body: JSON.stringify(Object.assign({ publicQuery: query }, (_a25 = options.customPayload) !== null && _a25 !== void 0 ? _a25 : {})) }));
12070
+ if (res.status < 400) {
12071
+ const data = yield res.json();
12072
+ return Object.assign(Object.assign({}, data), { success: true });
12073
+ }
12074
+ const errors = yield res.json();
12075
+ return { success: false, errors };
12076
+ });
12067
12077
  const queryByIds = (queryKey, ids, environment, customBaseUrl, customParams) => __async2(null, null, function* () {
12068
12078
  const idParam = ids.map((id) => `ids=${id}`).join("&");
12069
12079
  const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/ids?${idParam}`;
@@ -12286,6 +12296,10 @@ const LupaSearchSdk = {
12286
12296
  return transformSearchQueryRefinersResult(result2, options);
12287
12297
  }),
12288
12298
  queryRelated: (queryKey, publicQuery, options = null) => __async2(null, null, function* () {
12299
+ if (options === null || options === void 0 ? void 0 : options.customUrl) {
12300
+ const result3 = yield relatedQueriesCustom(publicQuery, options);
12301
+ return transformRelatedQueries(result3, options);
12302
+ }
12289
12303
  const result2 = yield relatedQueries(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12290
12304
  return transformRelatedQueries(result2, options);
12291
12305
  }),
@@ -38815,23 +38829,20 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
38815
38829
  return;
38816
38830
  }
38817
38831
  LupaSearchSdk.query(props.options.queryKey, query2, props.options.options).then((res) => {
38818
- var _a25, _b25, _c;
38832
+ var _a25, _b25, _c, _d, _e, _f, _g;
38819
38833
  if (res.success) {
38820
38834
  handleResults({ queryKey: props.options.queryKey, results: res });
38821
38835
  searchResultStore.add(requestId, __spreadValues2({}, res));
38822
38836
  searchResultStore.setRelatedQueriesApiEnabled((_a25 = res.hasRelatedQueries) != null ? _a25 : false);
38823
38837
  if (res.hasRelatedQueries && Boolean(props.options.relatedQueries)) {
38824
- searchResultStore.queryRelatedQueries(
38825
- props.options.queryKey,
38826
- publicQuery,
38827
- res,
38828
- props.options.options
38829
- );
38838
+ searchResultStore.queryRelatedQueries(props.options.queryKey, publicQuery, res, __spreadProps2(__spreadValues2({}, (_c = (_b25 = props.options) == null ? void 0 : _b25.options) != null ? _c : {}), {
38839
+ customUrl: ((_e = (_d = props.options) == null ? void 0 : _d.options) == null ? void 0 : _e.customRelatedQueriesUrl) || void 0
38840
+ }));
38830
38841
  }
38831
38842
  if (props.options.splitExpensiveRequests && res.refinementThreshold >= res.total) {
38832
38843
  queryRefiners(requestId, publicQuery);
38833
38844
  }
38834
- } else if ((_c = (_b25 = props.options) == null ? void 0 : _b25.options) == null ? void 0 : _c.onError) {
38845
+ } else if ((_g = (_f = props.options) == null ? void 0 : _f.options) == null ? void 0 : _g.onError) {
38835
38846
  props.options.options.onError(res);
38836
38847
  }
38837
38848
  }).catch((err) => {
@@ -41746,6 +41757,7 @@ const getSearchResultsComponent = ({
41746
41757
  customBaseUrl: searchResultOptions.customBaseUrl,
41747
41758
  customPayload: searchResultOptions.customPayload,
41748
41759
  customHeaders: searchResultOptions.customHeaders,
41760
+ customRelatedQueriesUrl: searchResultOptions.customRelatedQueriesUrl,
41749
41761
  onError: searchResultOptions.errorHandler
41750
41762
  },
41751
41763
  queryKey: searchResultOptions.queryKey,
@@ -12062,6 +12062,16 @@ const relatedQueries = (queryKey, query, environment, customBaseUrl, customParam
12062
12062
  const errors = yield res.json();
12063
12063
  return { success: false, errors };
12064
12064
  });
12065
+ const relatedQueriesCustom = (query, options) => __async2(null, null, function* () {
12066
+ var _a25;
12067
+ const res = yield fetch(options.customUrl, Object.assign(Object.assign({}, customRequestConfig({ customHeaders: options.customHeaders })), { body: JSON.stringify(Object.assign({ publicQuery: query }, (_a25 = options.customPayload) !== null && _a25 !== void 0 ? _a25 : {})) }));
12068
+ if (res.status < 400) {
12069
+ const data = yield res.json();
12070
+ return Object.assign(Object.assign({}, data), { success: true });
12071
+ }
12072
+ const errors = yield res.json();
12073
+ return { success: false, errors };
12074
+ });
12065
12075
  const queryByIds = (queryKey, ids, environment, customBaseUrl, customParams) => __async2(null, null, function* () {
12066
12076
  const idParam = ids.map((id) => `ids=${id}`).join("&");
12067
12077
  const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/ids?${idParam}`;
@@ -12284,6 +12294,10 @@ const LupaSearchSdk = {
12284
12294
  return transformSearchQueryRefinersResult(result2, options);
12285
12295
  }),
12286
12296
  queryRelated: (queryKey, publicQuery, options = null) => __async2(null, null, function* () {
12297
+ if (options === null || options === void 0 ? void 0 : options.customUrl) {
12298
+ const result3 = yield relatedQueriesCustom(publicQuery, options);
12299
+ return transformRelatedQueries(result3, options);
12300
+ }
12287
12301
  const result2 = yield relatedQueries(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12288
12302
  return transformRelatedQueries(result2, options);
12289
12303
  }),
@@ -38813,23 +38827,20 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
38813
38827
  return;
38814
38828
  }
38815
38829
  LupaSearchSdk.query(props.options.queryKey, query2, props.options.options).then((res) => {
38816
- var _a25, _b25, _c;
38830
+ var _a25, _b25, _c, _d, _e, _f, _g;
38817
38831
  if (res.success) {
38818
38832
  handleResults({ queryKey: props.options.queryKey, results: res });
38819
38833
  searchResultStore.add(requestId, __spreadValues2({}, res));
38820
38834
  searchResultStore.setRelatedQueriesApiEnabled((_a25 = res.hasRelatedQueries) != null ? _a25 : false);
38821
38835
  if (res.hasRelatedQueries && Boolean(props.options.relatedQueries)) {
38822
- searchResultStore.queryRelatedQueries(
38823
- props.options.queryKey,
38824
- publicQuery,
38825
- res,
38826
- props.options.options
38827
- );
38836
+ searchResultStore.queryRelatedQueries(props.options.queryKey, publicQuery, res, __spreadProps2(__spreadValues2({}, (_c = (_b25 = props.options) == null ? void 0 : _b25.options) != null ? _c : {}), {
38837
+ customUrl: ((_e = (_d = props.options) == null ? void 0 : _d.options) == null ? void 0 : _e.customRelatedQueriesUrl) || void 0
38838
+ }));
38828
38839
  }
38829
38840
  if (props.options.splitExpensiveRequests && res.refinementThreshold >= res.total) {
38830
38841
  queryRefiners(requestId, publicQuery);
38831
38842
  }
38832
- } else if ((_c = (_b25 = props.options) == null ? void 0 : _b25.options) == null ? void 0 : _c.onError) {
38843
+ } else if ((_g = (_f = props.options) == null ? void 0 : _f.options) == null ? void 0 : _g.onError) {
38833
38844
  props.options.options.onError(res);
38834
38845
  }
38835
38846
  }).catch((err) => {
@@ -41744,6 +41755,7 @@ const getSearchResultsComponent = ({
41744
41755
  customBaseUrl: searchResultOptions.customBaseUrl,
41745
41756
  customPayload: searchResultOptions.customPayload,
41746
41757
  customHeaders: searchResultOptions.customHeaders,
41758
+ customRelatedQueriesUrl: searchResultOptions.customRelatedQueriesUrl,
41747
41759
  onError: searchResultOptions.errorHandler
41748
41760
  },
41749
41761
  queryKey: searchResultOptions.queryKey,
@@ -12066,6 +12066,16 @@ var __async = (__this, __arguments, generator) => {
12066
12066
  const errors = yield res.json();
12067
12067
  return { success: false, errors };
12068
12068
  });
12069
+ const relatedQueriesCustom = (query, options) => __async2(null, null, function* () {
12070
+ var _a25;
12071
+ const res = yield fetch(options.customUrl, Object.assign(Object.assign({}, customRequestConfig({ customHeaders: options.customHeaders })), { body: JSON.stringify(Object.assign({ publicQuery: query }, (_a25 = options.customPayload) !== null && _a25 !== void 0 ? _a25 : {})) }));
12072
+ if (res.status < 400) {
12073
+ const data = yield res.json();
12074
+ return Object.assign(Object.assign({}, data), { success: true });
12075
+ }
12076
+ const errors = yield res.json();
12077
+ return { success: false, errors };
12078
+ });
12069
12079
  const queryByIds = (queryKey, ids, environment, customBaseUrl, customParams) => __async2(null, null, function* () {
12070
12080
  const idParam = ids.map((id) => `ids=${id}`).join("&");
12071
12081
  const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/ids?${idParam}`;
@@ -12288,6 +12298,10 @@ var __async = (__this, __arguments, generator) => {
12288
12298
  return transformSearchQueryRefinersResult(result2, options);
12289
12299
  }),
12290
12300
  queryRelated: (queryKey, publicQuery, options = null) => __async2(null, null, function* () {
12301
+ if (options === null || options === void 0 ? void 0 : options.customUrl) {
12302
+ const result3 = yield relatedQueriesCustom(publicQuery, options);
12303
+ return transformRelatedQueries(result3, options);
12304
+ }
12291
12305
  const result2 = yield relatedQueries(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12292
12306
  return transformRelatedQueries(result2, options);
12293
12307
  }),
@@ -38817,23 +38831,20 @@ and ensure you are accounting for this risk.
38817
38831
  return;
38818
38832
  }
38819
38833
  LupaSearchSdk.query(props.options.queryKey, query2, props.options.options).then((res) => {
38820
- var _a25, _b25, _c;
38834
+ var _a25, _b25, _c, _d, _e, _f, _g;
38821
38835
  if (res.success) {
38822
38836
  handleResults({ queryKey: props.options.queryKey, results: res });
38823
38837
  searchResultStore.add(requestId, __spreadValues2({}, res));
38824
38838
  searchResultStore.setRelatedQueriesApiEnabled((_a25 = res.hasRelatedQueries) != null ? _a25 : false);
38825
38839
  if (res.hasRelatedQueries && Boolean(props.options.relatedQueries)) {
38826
- searchResultStore.queryRelatedQueries(
38827
- props.options.queryKey,
38828
- publicQuery,
38829
- res,
38830
- props.options.options
38831
- );
38840
+ searchResultStore.queryRelatedQueries(props.options.queryKey, publicQuery, res, __spreadProps2(__spreadValues2({}, (_c = (_b25 = props.options) == null ? void 0 : _b25.options) != null ? _c : {}), {
38841
+ customUrl: ((_e = (_d = props.options) == null ? void 0 : _d.options) == null ? void 0 : _e.customRelatedQueriesUrl) || void 0
38842
+ }));
38832
38843
  }
38833
38844
  if (props.options.splitExpensiveRequests && res.refinementThreshold >= res.total) {
38834
38845
  queryRefiners(requestId, publicQuery);
38835
38846
  }
38836
- } else if ((_c = (_b25 = props.options) == null ? void 0 : _b25.options) == null ? void 0 : _c.onError) {
38847
+ } else if ((_g = (_f = props.options) == null ? void 0 : _f.options) == null ? void 0 : _g.onError) {
38837
38848
  props.options.options.onError(res);
38838
38849
  }
38839
38850
  }).catch((err) => {
@@ -41748,6 +41759,7 @@ and ensure you are accounting for this risk.
41748
41759
  customBaseUrl: searchResultOptions.customBaseUrl,
41749
41760
  customPayload: searchResultOptions.customPayload,
41750
41761
  customHeaders: searchResultOptions.customHeaders,
41762
+ customRelatedQueriesUrl: searchResultOptions.customRelatedQueriesUrl,
41751
41763
  onError: searchResultOptions.errorHandler
41752
41764
  },
41753
41765
  queryKey: searchResultOptions.queryKey,
@@ -33,6 +33,7 @@ export type SearchResultDemoOptions = {
33
33
  environment?: string;
34
34
  customUrl?: string;
35
35
  customBaseUrl?: string;
36
+ customRelatedQueriesUrl?: string;
36
37
  customPayload?: Record<string, unknown>;
37
38
  customHeaders?: Record<string, string>;
38
39
  gridConfiguration?: Record<string, number>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getlupa/client",
3
- "version": "1.25.4",
3
+ "version": "1.26.1",
4
4
  "main": "dist/lupaSearch.js",
5
5
  "module": "dist/lupaSearch.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "devDependencies": {
22
22
  "@getlupa/client-sdk": "^1.8.1",
23
- "@getlupa/vue": "0.25.3",
23
+ "@getlupa/vue": "0.25.4",
24
24
  "@rushstack/eslint-patch": "^1.12.0",
25
25
  "@tsconfig/node18": "^18.2.4",
26
26
  "@types/jsdom": "^21.1.7",