mbd-studio-sdk 3.5.0 → 3.7.0

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.
@@ -89,13 +89,13 @@ export class Features {
89
89
  this.log(msg);
90
90
  throw new Error(msg);
91
91
  }
92
- result.took_frontend = frontendTime;
92
+ result.took_sdk = frontendTime;
93
93
  this.lastCall = { endpoint, payload };
94
94
  this.lastResult = result;
95
95
  const res = result.result;
96
96
  if (!res) throw new Error('Features.execute: result.result is undefined');
97
97
  const infos = {
98
- took_frontend_ms: result.took_frontend,
98
+ took_sdk_ms: result.took_sdk,
99
99
  took_backend_ms: res.took_backend ?? 0,
100
100
  took_dynamo_user_ms: res.took_dynamo_user ?? 0,
101
101
  took_dynamo_items_ms: res.took_dynamo_items ?? 0,
@@ -238,14 +238,14 @@ export class Ranking {
238
238
  this.log(msg);
239
239
  throw new Error(msg);
240
240
  }
241
- result.took_frontend = frontendTime;
241
+ result.took_sdk = frontendTime;
242
242
  this.lastCall = { endpoint, payload };
243
243
  this.lastResult = result;
244
244
  const res = result.result;
245
245
  if (!res) throw new Error('Ranking.execute: response result is undefined');
246
246
  const resultItems = res.items || [];
247
247
  this._log('Ranking result:');
248
- this._log(` took_frontend_ms: ${result.took_frontend}`);
248
+ this._log(` took_sdk_ms: ${result.took_sdk}`);
249
249
  this._log(` items: ${resultItems.length}`);
250
250
  return res;
251
251
  }
@@ -80,13 +80,13 @@ export class Scoring {
80
80
  this.log(msg);
81
81
  throw new Error(msg);
82
82
  }
83
- result.took_frontend = frontendTime;
83
+ result.took_sdk = frontendTime;
84
84
  this.lastCall = { endpoint, payload };
85
85
  this.lastResult = result;
86
86
  const res = result.result;
87
87
  if (res === undefined) throw new Error('Scoring.execute: result.result is undefined');
88
88
  this._log('Scoring result:');
89
- this._log(` took_frontend_ms: ${result.took_frontend}`);
89
+ this._log(` took_sdk: ${result.took_sdk}`);
90
90
  this._log(` Array length: ${res.length}`);
91
91
  return res;
92
92
  }
@@ -87,7 +87,6 @@ export class Search {
87
87
  headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${this._apiKey}` },
88
88
  body: JSON.stringify(payload),
89
89
  });
90
- const frontendTime = Math.round(performance.now() - startTime);
91
90
  if (!response.ok) {
92
91
  const text = await response.text();
93
92
  let message = `Search API error: ${response.status} ${response.statusText}`;
@@ -101,7 +100,8 @@ export class Search {
101
100
  this.log(msg);
102
101
  throw new Error(msg);
103
102
  }
104
- result.took_frontend = frontendTime;
103
+ const frontendTime = Math.round(performance.now() - startTime);
104
+ result.took_sdk = frontendTime;
105
105
  this.lastCall = { endpoint, payload };
106
106
  this.lastResult = result;
107
107
  if (!result.result) throw new Error('Search.execute: result.result is undefined');
@@ -109,17 +109,17 @@ export class Search {
109
109
  const infos = {
110
110
  total_hits: res?.total_hits ?? 0,
111
111
  fetched_hits: res?.hits?.length ?? 0,
112
- took_es_ms: res?.took_es ?? 0,
113
- took_backend_ms: res?.took_backend ?? 0,
114
- took_frontend_ms: result.took_frontend,
112
+ took_es: res?.took_es ?? 0,
113
+ took_backend: res?.took_backend ?? 0,
114
+ took_sdk: result.took_sdk,
115
115
  max_score: res?.max_score ?? 0,
116
116
  };
117
117
  this._log('Search result:');
118
118
  this._log(` total_hits: ${infos.total_hits}`);
119
119
  this._log(` fetched_hits: ${infos.fetched_hits}`);
120
- this._log(` took_es_ms: ${infos.took_es_ms}`);
121
- this._log(` took_backend_ms: ${infos.took_backend_ms}`);
122
- this._log(` took_frontend_ms: ${infos.took_frontend_ms}`);
120
+ this._log(` took_es: ${infos.took_es}`);
121
+ this._log(` took_backend: ${infos.took_backend}`);
122
+ this._log(` took_sdk: ${infos.took_sdk}`);
123
123
  this._log(` max_score: ${infos.max_score}`);
124
124
  return res.hits;
125
125
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mbd-studio-sdk",
3
- "version": "3.5.0",
3
+ "version": "3.7.0",
4
4
  "description": "SDK for Embed Recommendation Engine APIs",
5
5
  "keywords": [
6
6
  "web3",