Skip to content
This repository was archived by the owner on Jun 25, 2025. It is now read-only.

Commit e9231fe

Browse files
committed
Added app_uuid and index_uuid in item
- The server is the responsible to put this value, and this JS library should provide hydration support and getters - To version 0.2.24
1 parent 0baf225 commit e9231fe

File tree

12 files changed

+209
-54
lines changed

12 files changed

+209
-54
lines changed

dist/apisearch.js

Lines changed: 39 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/apisearch.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/apisearch.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/apisearch.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/Model/Item.d.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { Coordinate } from "./Coordinate";
22
import { ItemUUID } from "./ItemUUID";
3+
import { AppUUID } from "./AppUUID";
4+
import { IndexUUID } from "./IndexUUID";
35
/**
46
* Item class
57
*/
@@ -15,6 +17,8 @@ export declare class Item {
1517
private highlights;
1618
private promoted;
1719
private score;
20+
private appUUID;
21+
private indexUUID;
1822
/**
1923
* Constructor
2024
*
@@ -211,6 +215,18 @@ export declare class Item {
211215
* @return {number}
212216
*/
213217
getScore(): number;
218+
/**
219+
* Set appUUID
220+
*
221+
* @return {AppUUID}
222+
*/
223+
getAppUUID(): AppUUID;
224+
/**
225+
* Set indexUUID
226+
*
227+
* @return {IndexUUID}
228+
*/
229+
getIndexUUID(): IndexUUID;
214230
/**
215231
* To array
216232
*/
@@ -226,6 +242,8 @@ export declare class Item {
226242
is_promoted?: boolean;
227243
distance?: number;
228244
score?: number;
245+
app_uuid?: {};
246+
index_uuid?: {};
229247
};
230248
/**
231249
* Create from array

lib/Model/Item.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ var tslib_1 = require("tslib");
44
var InvalidFormatError_1 = require("../Error/InvalidFormatError");
55
var Coordinate_1 = require("./Coordinate");
66
var ItemUUID_1 = require("./ItemUUID");
7+
var AppUUID_1 = require("./AppUUID");
8+
var IndexUUID_1 = require("./IndexUUID");
79
/**
810
* Item class
911
*/
@@ -289,6 +291,22 @@ var Item = /** @class */ (function () {
289291
Item.prototype.getScore = function () {
290292
return this.score;
291293
};
294+
/**
295+
* Set appUUID
296+
*
297+
* @return {AppUUID}
298+
*/
299+
Item.prototype.getAppUUID = function () {
300+
return this.appUUID;
301+
};
302+
/**
303+
* Set indexUUID
304+
*
305+
* @return {IndexUUID}
306+
*/
307+
Item.prototype.getIndexUUID = function () {
308+
return this.indexUUID;
309+
};
292310
/**
293311
* To array
294312
*/
@@ -326,6 +344,12 @@ var Item = /** @class */ (function () {
326344
if (typeof this.score != "undefined") {
327345
itemAsArray.score = this.score;
328346
}
347+
if (typeof this.appUUID != "undefined") {
348+
itemAsArray.app_uuid = this.appUUID.toArray();
349+
}
350+
if (typeof this.indexUUID != "undefined") {
351+
itemAsArray.index_uuid = this.indexUUID.toArray();
352+
}
329353
return itemAsArray;
330354
};
331355
/**
@@ -362,6 +386,14 @@ var Item = /** @class */ (function () {
362386
array.score != null) {
363387
item.score = array.score;
364388
}
389+
if (typeof array.app_uuid != "undefined" &&
390+
array.app_uuid != null) {
391+
item.appUUID = AppUUID_1.AppUUID.createFromArray(array.app_uuid);
392+
}
393+
if (typeof array.index_uuid != "undefined" &&
394+
array.index_uuid != null) {
395+
item.indexUUID = IndexUUID_1.IndexUUID.createFromArray(array.index_uuid);
396+
}
365397
return item;
366398
};
367399
/**

lib/Query/Query.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ export declare class Query {
194194
*
195195
* @param filterName
196196
* @param field
197-
* @param options
197+
* @param ranges
198198
* @param values
199199
* @param applicationType
200200
* @param rangeType
@@ -203,7 +203,7 @@ export declare class Query {
203203
*
204204
* @return {Query}
205205
*/
206-
filterByRange(filterName: string, field: string, options: string[], values: any[], applicationType?: number, rangeType?: string, aggregate?: boolean, aggregationSort?: string[]): Query;
206+
filterByRange(filterName: string, field: string, ranges: string[], values: any[], applicationType?: number, rangeType?: string, aggregate?: boolean, aggregationSort?: string[]): Query;
207207
/**
208208
* Filter by date range
209209
*
@@ -265,15 +265,15 @@ export declare class Query {
265265
*
266266
* @param filterName
267267
* @param field
268-
* @param options
268+
* @param ranges
269269
* @param applicationType
270270
* @param rangeType
271271
* @param aggregationSort
272272
* @param limit
273273
*
274274
* @return {Query}
275275
*/
276-
aggregateByRange(filterName: string, field: string, options: string[], applicationType: number, rangeType?: string, aggregationSort?: string[], limit?: number): Query;
276+
aggregateByRange(filterName: string, field: string, ranges: string[], applicationType: number, rangeType?: string, aggregationSort?: string[], limit?: number): Query;
277277
/**
278278
* Aggregate by date range
279279
*

lib/Query/Query.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ var Query = /** @class */ (function () {
323323
*
324324
* @param filterName
325325
* @param field
326-
* @param options
326+
* @param ranges
327327
* @param values
328328
* @param applicationType
329329
* @param rangeType
@@ -332,7 +332,7 @@ var Query = /** @class */ (function () {
332332
*
333333
* @return {Query}
334334
*/
335-
Query.prototype.filterByRange = function (filterName, field, options, values, applicationType, rangeType, aggregate, aggregationSort) {
335+
Query.prototype.filterByRange = function (filterName, field, ranges, values, applicationType, rangeType, aggregate, aggregationSort) {
336336
var _a;
337337
if (applicationType === void 0) { applicationType = Filter_2.FILTER_AT_LEAST_ONE; }
338338
if (rangeType === void 0) { rangeType = Filter_2.FILTER_TYPE_RANGE; }
@@ -346,7 +346,7 @@ var Query = /** @class */ (function () {
346346
delete this.filters[filterName];
347347
}
348348
if (aggregate) {
349-
this.aggregateByRange(filterName, fieldPath, options, applicationType, rangeType, aggregationSort);
349+
this.aggregateByRange(filterName, fieldPath, ranges, applicationType, rangeType, aggregationSort);
350350
}
351351
return this;
352352
};
@@ -440,23 +440,23 @@ var Query = /** @class */ (function () {
440440
*
441441
* @param filterName
442442
* @param field
443-
* @param options
443+
* @param ranges
444444
* @param applicationType
445445
* @param rangeType
446446
* @param aggregationSort
447447
* @param limit
448448
*
449449
* @return {Query}
450450
*/
451-
Query.prototype.aggregateByRange = function (filterName, field, options, applicationType, rangeType, aggregationSort, limit) {
451+
Query.prototype.aggregateByRange = function (filterName, field, ranges, applicationType, rangeType, aggregationSort, limit) {
452452
var _a;
453453
if (rangeType === void 0) { rangeType = Filter_2.FILTER_TYPE_RANGE; }
454454
if (aggregationSort === void 0) { aggregationSort = Aggregation_2.AGGREGATION_SORT_BY_COUNT_DESC; }
455455
if (limit === void 0) { limit = Aggregation_2.AGGREGATION_NO_LIMIT; }
456-
if (options.length === 0) {
456+
if (ranges.length === 0) {
457457
return this;
458458
}
459-
this.aggregations = tslib_1.__assign(tslib_1.__assign({}, this.aggregations), (_a = {}, _a[filterName] = Aggregation_1.Aggregation.create(filterName, Item_1.Item.getPathByField(field), applicationType, rangeType, options, aggregationSort, limit), _a));
459+
this.aggregations = tslib_1.__assign(tslib_1.__assign({}, this.aggregations), (_a = {}, _a[filterName] = Aggregation_1.Aggregation.create(filterName, Item_1.Item.getPathByField(field), applicationType, rangeType, ranges, aggregationSort, limit), _a));
460460
return this;
461461
};
462462
/**

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "apisearch",
3-
"version": "0.2.23",
3+
"version": "0.2.24",
44
"description": "Javascript client for Apisearch.",
55
"main": "lib/index.js",
66
"types": "lib/index.d.ts",

0 commit comments

Comments
 (0)