recombee-api-client 3.2.0 → 4.0.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.
- package/README.md +2 -2
- package/lib/api-client.js +49 -37
- package/lib/requests/delete-item.js +1 -1
- package/lib/requests/delete-more-items.js +44 -0
- package/lib/requests/delete-user.js +1 -1
- package/lib/requests/index.js +2 -2
- package/lib/requests/recommend-items-to-user.js +1 -1
- package/lib/requests/update-more-items.js +53 -0
- package/package.json +2 -3
- package/test/add-bookmark-test.js +24 -12
- package/test/add-cart-addition-test.js +24 -12
- package/test/add-detail-view-test.js +24 -12
- package/test/add-group-test.js +12 -6
- package/test/add-item-property-test.js +12 -6
- package/test/add-item-test.js +12 -6
- package/test/add-purchase-test.js +24 -12
- package/test/add-rating-test.js +30 -15
- package/test/add-search-synonym-test.js +6 -3
- package/test/add-series-test.js +12 -6
- package/test/add-user-property-test.js +12 -6
- package/test/add-user-test.js +12 -6
- package/test/delete-bookmark-test.js +6 -3
- package/test/delete-cart-addition-test.js +6 -3
- package/test/delete-detail-view-test.js +6 -3
- package/test/delete-group-test.js +18 -9
- package/test/delete-item-property-test.js +18 -9
- package/test/delete-item-test.js +18 -9
- package/test/{user-based-recommendation-batch_test.js → delete-more-items-batch_test.js} +4 -10
- package/test/delete-more-items-callback_test.js +37 -0
- package/test/delete-more-items-test.js +33 -0
- package/test/delete-purchase-test.js +6 -3
- package/test/delete-rating-test.js +6 -3
- package/test/delete-search-synonym-test.js +6 -3
- package/test/delete-series-test.js +18 -9
- package/test/delete-user-property-test.js +18 -9
- package/test/delete-user-test.js +18 -9
- package/test/delete-view-portion-test.js +6 -3
- package/test/insert-to-group-test.js +6 -3
- package/test/insert-to-series-test.js +6 -3
- package/test/merge-users-test.js +6 -3
- package/test/remove-from-group-test.js +6 -3
- package/test/remove-from-series-test.js +12 -6
- package/test/set-environment.js +6 -4
- package/test/set-item-values-test.js +6 -3
- package/test/set-user-values-test.js +6 -3
- package/test/set-view-portion-test.js +30 -15
- package/test/{item-based-recommendation-batch_test.js → update-more-items-batch_test.js} +4 -10
- package/test/update-more-items-callback_test.js +37 -0
- package/test/update-more-items-test.js +33 -0
- package/lib/requests/item-based-recommendation.js +0 -187
- package/lib/requests/user-based-recommendation.js +0 -168
- package/test/item-based-recommendation-callback_test.js +0 -65
- package/test/item-based-recommendation-test.js +0 -53
- package/test/user-based-recommendation-callback_test.js +0 -65
- package/test/user-based-recommendation-test.js +0 -53
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ client.send(new AddDetailView,
|
|
|
44
44
|
var recombee = require('recombee-api-client');
|
|
45
45
|
var rqs = recombee.requests;
|
|
46
46
|
|
|
47
|
-
var client = new recombee.ApiClient('--my-database-id--', '--db-private-token--');
|
|
47
|
+
var client = new recombee.ApiClient('--my-database-id--', '--db-private-token--', {region: 'us-west'});
|
|
48
48
|
|
|
49
49
|
// Prepare some userIDs and itemIDs
|
|
50
50
|
const NUM = 100;
|
|
@@ -96,7 +96,7 @@ client.send(new rqs.Batch(purchases))
|
|
|
96
96
|
var recombee = require('recombee-api-client');
|
|
97
97
|
var rqs = recombee.requests;
|
|
98
98
|
|
|
99
|
-
var client = new recombee.ApiClient('--my-database-id--', '--db-private-token--');
|
|
99
|
+
var client = new recombee.ApiClient('--my-database-id--', '--db-private-token--', {region: 'ap-se'});
|
|
100
100
|
const NUM = 100;
|
|
101
101
|
|
|
102
102
|
// We will use computers as items in this example
|
package/lib/api-client.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const jsSHA = require("jssha");
|
|
4
|
-
const
|
|
5
|
-
const rp_errors = require('request-promise/errors');
|
|
4
|
+
const got = require('got');
|
|
6
5
|
|
|
7
6
|
const api_errors = require('./errors');
|
|
8
7
|
const requests = require('./requests');
|
|
@@ -17,15 +16,17 @@ class ApiClient {
|
|
|
17
16
|
* Construct the client
|
|
18
17
|
* @param {string} databaseId - ID of your database
|
|
19
18
|
* @param {string} secretToken - Corresponding secret token
|
|
20
|
-
* @param {boolean} alwaysUseHttps - If true, all requests are sent using HTTPS (default: true)
|
|
21
19
|
* @param {Object} options - Other custom options
|
|
22
20
|
*/
|
|
23
|
-
constructor (databaseId, token,
|
|
21
|
+
constructor (databaseId, token, options) {
|
|
24
22
|
this.databaseId = databaseId;
|
|
25
23
|
this.token = token;
|
|
26
|
-
this.alwaysUseHttps = (alwaysUseHttps === undefined) ? true : alwaysUseHttps;
|
|
27
24
|
this.options = options || {};
|
|
28
|
-
|
|
25
|
+
|
|
26
|
+
if (Object.getPrototypeOf(this.options) !== Object.prototype) throw new Error(`options must be given as an Object (${this.options} given instead)`);
|
|
27
|
+
|
|
28
|
+
this.protocol = this.options.protocol || 'https';
|
|
29
|
+
this.baseUri = this._getBaseUri()
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
/**
|
|
@@ -41,50 +42,69 @@ class ApiClient {
|
|
|
41
42
|
let url = this._buildRequestUrl(request);
|
|
42
43
|
let options = {
|
|
43
44
|
method: request.method,
|
|
44
|
-
|
|
45
|
+
url: url,
|
|
45
46
|
headers: {'Accept': 'application/json',
|
|
46
47
|
'Content-Type': 'application/json',
|
|
47
|
-
'User-Agent': 'recombee-node-api-client/
|
|
48
|
-
timeout: request.timeout
|
|
49
|
-
resolveWithFullResponse: true,
|
|
50
|
-
json: true
|
|
48
|
+
'User-Agent': 'recombee-node-api-client/4.0.0'},
|
|
49
|
+
timeout: request.timeout
|
|
51
50
|
};
|
|
52
51
|
|
|
53
|
-
if (
|
|
54
|
-
options.
|
|
55
|
-
|
|
56
|
-
if (request.bodyParameters())
|
|
57
|
-
options.body = request.bodyParameters();
|
|
52
|
+
if (Object.entries(request.bodyParameters()).length > 0)
|
|
53
|
+
options.json = request.bodyParameters();
|
|
58
54
|
|
|
59
|
-
return
|
|
60
|
-
.
|
|
55
|
+
return got(options)
|
|
56
|
+
.json()
|
|
61
57
|
.then((response)=> {
|
|
62
58
|
return new Promise( (resolve) => {
|
|
63
59
|
if (callback) { return callback(null, response); }
|
|
64
60
|
return resolve(response);
|
|
65
61
|
});
|
|
66
62
|
})
|
|
67
|
-
.catch(
|
|
68
|
-
|
|
63
|
+
.catch((error) => {
|
|
64
|
+
if (error instanceof got.HTTPError) {
|
|
65
|
+
error = new api_errors.ResponseError(request, error.response.statusCode, error.response.body);
|
|
69
66
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
throw error;
|
|
67
|
+
else if (error instanceof got.RequestError) {
|
|
68
|
+
if(error.code === 'ETIMEDOUT' || error.code === 'ESOCKETTIMEDOUT') {
|
|
69
|
+
error = new api_errors.TimeoutError(request, error);
|
|
70
|
+
}
|
|
75
71
|
}
|
|
76
|
-
))
|
|
77
|
-
.catch((error) => {
|
|
78
72
|
if (callback) {return callback(error)};
|
|
79
73
|
throw error;
|
|
80
74
|
});
|
|
81
75
|
}
|
|
82
76
|
|
|
77
|
+
_getRegionalBaseUri(region) {
|
|
78
|
+
const uri = {
|
|
79
|
+
'ap-se': 'rapi-ap-se.recombee.com',
|
|
80
|
+
'ca-east': 'rapi-ca-east.recombee.com',
|
|
81
|
+
'eu-west': 'rapi-eu-west.recombee.com',
|
|
82
|
+
'us-west': 'rapi-us-west.recombee.com'
|
|
83
|
+
}[region.toLowerCase()];
|
|
84
|
+
|
|
85
|
+
if (uri === undefined) {
|
|
86
|
+
throw new Error(`Region "${region}" is unknown. You may need to update the version of the SDK.`)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return uri;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
_getBaseUri() {
|
|
93
|
+
let baseUri = process.env.RAPI_URI || this.options.baseUri;
|
|
94
|
+
if (this.options.region) {
|
|
95
|
+
if (baseUri) {
|
|
96
|
+
throw new Error('baseUri and region cannot be specified at the same time');
|
|
97
|
+
}
|
|
98
|
+
baseUri = this._getRegionalBaseUri(this.options.region);
|
|
99
|
+
}
|
|
100
|
+
return baseUri || 'rapi.recombee.com';
|
|
101
|
+
}
|
|
102
|
+
|
|
83
103
|
_buildRequestUrl(request) {
|
|
84
|
-
let
|
|
104
|
+
let usedProtocol = (request.ensureHttps) ? 'https' : this.protocol;
|
|
85
105
|
let reqUrl = request.path + this._encodeRequestQueryParams(request);
|
|
86
106
|
let signedUrl = this._signUrl(reqUrl);
|
|
87
|
-
return
|
|
107
|
+
return usedProtocol + '://' + this.baseUri + signedUrl;
|
|
88
108
|
}
|
|
89
109
|
|
|
90
110
|
_encodeRequestQueryParams(request) {
|
|
@@ -161,14 +181,6 @@ class ApiClient {
|
|
|
161
181
|
});
|
|
162
182
|
}
|
|
163
183
|
|
|
164
|
-
_parseResponse(response) {
|
|
165
|
-
return new Promise(
|
|
166
|
-
function (resolve, reject) {
|
|
167
|
-
resolve(response.body);
|
|
168
|
-
}
|
|
169
|
-
);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
184
|
_signUrl (req_part) {
|
|
173
185
|
let url = '/' + this.databaseId + req_part;
|
|
174
186
|
url += (req_part.indexOf("?") == -1 ? "?" : "&" ) + "hmac_timestamp=" + parseInt(new Date().getTime() / 1000);
|
|
@@ -8,7 +8,7 @@ const rqs = require("./request");
|
|
|
8
8
|
/**
|
|
9
9
|
* Deletes an item of given `itemId` from the catalog.
|
|
10
10
|
* If there are any *purchases*, *ratings*, *bookmarks*, *cart additions* or *detail views* of the item present in the database, they will be deleted in cascade as well. Also, if the item is present in some *series*, it will be removed from all the *series* where present.
|
|
11
|
-
* If an item becomes obsolete/no longer available, it is
|
|
11
|
+
* If an item becomes obsolete/no longer available, it is meaningful to keep it in the catalog (along with all the interaction data, which are very useful), and **only exclude the item from recommendations**. In such a case, use [ReQL filter](https://docs.recombee.com/reql.html) instead of deleting the item completely.
|
|
12
12
|
*/
|
|
13
13
|
class DeleteItem extends rqs.Request {
|
|
14
14
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
This file is auto-generated, do not edit
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
'use strict';
|
|
6
|
+
const rqs = require("./request");
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Delete all the items that pass the filter.
|
|
10
|
+
* If an item becomes obsolete/no longer available, it is meaningful to **keep it in the catalog** (along with all the interaction data, which are very useful), and **only exclude the item from recommendations**. In such a case, use [ReQL filter](https://docs.recombee.com/reql.html) instead of deleting the item completely.
|
|
11
|
+
*/
|
|
12
|
+
class DeleteMoreItems extends rqs.Request {
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Construct the request
|
|
16
|
+
* @param {string} filter - A [ReQL](https://docs.recombee.com/reql.html) expression, which return `true` for the items that shall be updated.
|
|
17
|
+
*/
|
|
18
|
+
constructor(filter) {
|
|
19
|
+
super('DELETE', '/more-items/', 1000, false);
|
|
20
|
+
this.filter = filter;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Get body parameters
|
|
25
|
+
* @return {Object} The values of body parameters (name of parameter: value of the parameter)
|
|
26
|
+
*/
|
|
27
|
+
bodyParameters() {
|
|
28
|
+
let params = {};
|
|
29
|
+
params.filter = this.filter;
|
|
30
|
+
|
|
31
|
+
return params;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Get query parameters
|
|
36
|
+
* @return {Object} The values of query parameters (name of parameter: value of the parameter)
|
|
37
|
+
*/
|
|
38
|
+
queryParameters() {
|
|
39
|
+
let params = {};
|
|
40
|
+
return params;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
exports.DeleteMoreItems = DeleteMoreItems
|
|
@@ -13,7 +13,7 @@ class DeleteUser extends rqs.Request {
|
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Construct the request
|
|
16
|
-
* @param {string} userId - ID of the user to be
|
|
16
|
+
* @param {string} userId - ID of the user to be deleted.
|
|
17
17
|
*/
|
|
18
18
|
constructor(userId) {
|
|
19
19
|
super('DELETE', `/users/${userId}`, 1000, false);
|
package/lib/requests/index.js
CHANGED
|
@@ -12,6 +12,8 @@ exports.AddItemProperty = require("./add-item-property").AddItemProperty;
|
|
|
12
12
|
exports.DeleteItemProperty = require("./delete-item-property").DeleteItemProperty;
|
|
13
13
|
exports.GetItemPropertyInfo = require("./get-item-property-info").GetItemPropertyInfo;
|
|
14
14
|
exports.ListItemProperties = require("./list-item-properties").ListItemProperties;
|
|
15
|
+
exports.UpdateMoreItems = require("./update-more-items").UpdateMoreItems;
|
|
16
|
+
exports.DeleteMoreItems = require("./delete-more-items").DeleteMoreItems;
|
|
15
17
|
exports.AddSeries = require("./add-series").AddSeries;
|
|
16
18
|
exports.DeleteSeries = require("./delete-series").DeleteSeries;
|
|
17
19
|
exports.ListSeries = require("./list-series").ListSeries;
|
|
@@ -63,8 +65,6 @@ exports.RecommendItemsToItem = require("./recommend-items-to-item").RecommendIte
|
|
|
63
65
|
exports.RecommendNextItems = require("./recommend-next-items").RecommendNextItems;
|
|
64
66
|
exports.RecommendUsersToUser = require("./recommend-users-to-user").RecommendUsersToUser;
|
|
65
67
|
exports.RecommendUsersToItem = require("./recommend-users-to-item").RecommendUsersToItem;
|
|
66
|
-
exports.UserBasedRecommendation = require("./user-based-recommendation").UserBasedRecommendation;
|
|
67
|
-
exports.ItemBasedRecommendation = require("./item-based-recommendation").ItemBasedRecommendation;
|
|
68
68
|
exports.SearchItems = require("./search-items").SearchItems;
|
|
69
69
|
exports.AddSearchSynonym = require("./add-search-synonym").AddSearchSynonym;
|
|
70
70
|
exports.ListSearchSynonyms = require("./list-search-synonyms").ListSearchSynonyms;
|
|
@@ -110,7 +110,7 @@ class RecommendItemsToUser extends rqs.Request {
|
|
|
110
110
|
* - Description: **Expert option** Specifies the threshold of how much relevant must the recommended items be to the user. Possible values one of: "low", "medium", "high". The default value is "low", meaning that the system attempts to recommend number of items equal to *count* at any cost. If there are not enough data (such as interactions or item properties), this may even lead to bestseller-based recommendations to be appended to reach the full *count*. This behavior may be suppressed by using "medium" or "high" values. In such case, the system only recommends items of at least the requested relevance, and may return less than *count* items when there is not enough data to fulfill it.
|
|
111
111
|
* - *rotationRate*
|
|
112
112
|
* - Type: number
|
|
113
|
-
* - Description: **Expert option** If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per-request in backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example `rotationRate=0.2` for only slight rotation of recommended items. Default: `0
|
|
113
|
+
* - Description: **Expert option** If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per-request in backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example `rotationRate=0.2` for only slight rotation of recommended items. Default: `0`.
|
|
114
114
|
* - *rotationTime*
|
|
115
115
|
* - Type: number
|
|
116
116
|
* - Description: **Expert option** Taking *rotationRate* into account, specifies how long time it takes to an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized. Default: `7200.0`.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*
|
|
2
|
+
This file is auto-generated, do not edit
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
'use strict';
|
|
6
|
+
const rqs = require("./request");
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Update (some) property values of all the items that pass the filter.
|
|
10
|
+
* Example: *Setting all the items that are older than a week as unavailable*
|
|
11
|
+
* ```
|
|
12
|
+
* {
|
|
13
|
+
* "filter": "'releaseDate' < now() - 7*24*3600",
|
|
14
|
+
* "changes": {"available": false}
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
class UpdateMoreItems extends rqs.Request {
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Construct the request
|
|
22
|
+
* @param {string} filter - A [ReQL](https://docs.recombee.com/reql.html) expression, which return `true` for the items that shall be updated.
|
|
23
|
+
* @param {} changes - A dictionary where the keys are properties which shall be updated.
|
|
24
|
+
*/
|
|
25
|
+
constructor(filter, changes) {
|
|
26
|
+
super('POST', '/more-items/', 1000, false);
|
|
27
|
+
this.filter = filter;
|
|
28
|
+
this.changes = changes;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Get body parameters
|
|
33
|
+
* @return {Object} The values of body parameters (name of parameter: value of the parameter)
|
|
34
|
+
*/
|
|
35
|
+
bodyParameters() {
|
|
36
|
+
let params = {};
|
|
37
|
+
params.filter = this.filter;
|
|
38
|
+
params.changes = this.changes;
|
|
39
|
+
|
|
40
|
+
return params;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Get query parameters
|
|
45
|
+
* @return {Object} The values of query parameters (name of parameter: value of the parameter)
|
|
46
|
+
*/
|
|
47
|
+
queryParameters() {
|
|
48
|
+
let params = {};
|
|
49
|
+
return params;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
exports.UpdateMoreItems = UpdateMoreItems
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "recombee-api-client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Node.js client (SDK) for easy use of the Recombee recommendation API",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -26,8 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"homepage": "https://github.com/Recombee/node-api-client#readme",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"
|
|
30
|
-
"request": "^2.88.0",
|
|
29
|
+
"got": "^11.8.2",
|
|
31
30
|
"jssha": "^2.3.0"
|
|
32
31
|
},
|
|
33
32
|
"devDependencies": {
|
|
@@ -55,9 +55,12 @@ describe('AddBookmark', function(){
|
|
|
55
55
|
chai.fail();
|
|
56
56
|
done();
|
|
57
57
|
})
|
|
58
|
-
.catch(
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
.catch((err) => {
|
|
59
|
+
if (err instanceof recombee.errors.ResponseError) {
|
|
60
|
+
chai.equal(err.statusCode, 404);
|
|
61
|
+
done();
|
|
62
|
+
}
|
|
63
|
+
throw err;
|
|
61
64
|
});
|
|
62
65
|
});
|
|
63
66
|
|
|
@@ -69,9 +72,12 @@ describe('AddBookmark', function(){
|
|
|
69
72
|
chai.fail();
|
|
70
73
|
done();
|
|
71
74
|
})
|
|
72
|
-
.catch(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
.catch((err) => {
|
|
76
|
+
if (err instanceof recombee.errors.ResponseError) {
|
|
77
|
+
chai.equal(err.statusCode, 404);
|
|
78
|
+
done();
|
|
79
|
+
}
|
|
80
|
+
throw err;
|
|
75
81
|
});
|
|
76
82
|
});
|
|
77
83
|
|
|
@@ -83,9 +89,12 @@ describe('AddBookmark', function(){
|
|
|
83
89
|
chai.fail();
|
|
84
90
|
done();
|
|
85
91
|
})
|
|
86
|
-
.catch(
|
|
87
|
-
|
|
88
|
-
|
|
92
|
+
.catch((err) => {
|
|
93
|
+
if (err instanceof recombee.errors.ResponseError) {
|
|
94
|
+
chai.equal(err.statusCode, 400);
|
|
95
|
+
done();
|
|
96
|
+
}
|
|
97
|
+
throw err;
|
|
89
98
|
});
|
|
90
99
|
});
|
|
91
100
|
|
|
@@ -99,9 +108,12 @@ describe('AddBookmark', function(){
|
|
|
99
108
|
chai.fail();
|
|
100
109
|
done();
|
|
101
110
|
})
|
|
102
|
-
.catch(
|
|
103
|
-
|
|
104
|
-
|
|
111
|
+
.catch((err) => {
|
|
112
|
+
if (err instanceof recombee.errors.ResponseError) {
|
|
113
|
+
chai.equal(err.statusCode, 409);
|
|
114
|
+
done();
|
|
115
|
+
}
|
|
116
|
+
throw err;
|
|
105
117
|
});
|
|
106
118
|
});
|
|
107
119
|
});
|
|
@@ -55,9 +55,12 @@ describe('AddCartAddition', function(){
|
|
|
55
55
|
chai.fail();
|
|
56
56
|
done();
|
|
57
57
|
})
|
|
58
|
-
.catch(
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
.catch((err) => {
|
|
59
|
+
if (err instanceof recombee.errors.ResponseError) {
|
|
60
|
+
chai.equal(err.statusCode, 404);
|
|
61
|
+
done();
|
|
62
|
+
}
|
|
63
|
+
throw err;
|
|
61
64
|
});
|
|
62
65
|
});
|
|
63
66
|
|
|
@@ -69,9 +72,12 @@ describe('AddCartAddition', function(){
|
|
|
69
72
|
chai.fail();
|
|
70
73
|
done();
|
|
71
74
|
})
|
|
72
|
-
.catch(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
.catch((err) => {
|
|
76
|
+
if (err instanceof recombee.errors.ResponseError) {
|
|
77
|
+
chai.equal(err.statusCode, 404);
|
|
78
|
+
done();
|
|
79
|
+
}
|
|
80
|
+
throw err;
|
|
75
81
|
});
|
|
76
82
|
});
|
|
77
83
|
|
|
@@ -83,9 +89,12 @@ describe('AddCartAddition', function(){
|
|
|
83
89
|
chai.fail();
|
|
84
90
|
done();
|
|
85
91
|
})
|
|
86
|
-
.catch(
|
|
87
|
-
|
|
88
|
-
|
|
92
|
+
.catch((err) => {
|
|
93
|
+
if (err instanceof recombee.errors.ResponseError) {
|
|
94
|
+
chai.equal(err.statusCode, 400);
|
|
95
|
+
done();
|
|
96
|
+
}
|
|
97
|
+
throw err;
|
|
89
98
|
});
|
|
90
99
|
});
|
|
91
100
|
|
|
@@ -99,9 +108,12 @@ describe('AddCartAddition', function(){
|
|
|
99
108
|
chai.fail();
|
|
100
109
|
done();
|
|
101
110
|
})
|
|
102
|
-
.catch(
|
|
103
|
-
|
|
104
|
-
|
|
111
|
+
.catch((err) => {
|
|
112
|
+
if (err instanceof recombee.errors.ResponseError) {
|
|
113
|
+
chai.equal(err.statusCode, 409);
|
|
114
|
+
done();
|
|
115
|
+
}
|
|
116
|
+
throw err;
|
|
105
117
|
});
|
|
106
118
|
});
|
|
107
119
|
});
|
|
@@ -55,9 +55,12 @@ describe('AddDetailView', function(){
|
|
|
55
55
|
chai.fail();
|
|
56
56
|
done();
|
|
57
57
|
})
|
|
58
|
-
.catch(
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
.catch((err) => {
|
|
59
|
+
if (err instanceof recombee.errors.ResponseError) {
|
|
60
|
+
chai.equal(err.statusCode, 404);
|
|
61
|
+
done();
|
|
62
|
+
}
|
|
63
|
+
throw err;
|
|
61
64
|
});
|
|
62
65
|
});
|
|
63
66
|
|
|
@@ -69,9 +72,12 @@ describe('AddDetailView', function(){
|
|
|
69
72
|
chai.fail();
|
|
70
73
|
done();
|
|
71
74
|
})
|
|
72
|
-
.catch(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
.catch((err) => {
|
|
76
|
+
if (err instanceof recombee.errors.ResponseError) {
|
|
77
|
+
chai.equal(err.statusCode, 404);
|
|
78
|
+
done();
|
|
79
|
+
}
|
|
80
|
+
throw err;
|
|
75
81
|
});
|
|
76
82
|
});
|
|
77
83
|
|
|
@@ -83,9 +89,12 @@ describe('AddDetailView', function(){
|
|
|
83
89
|
chai.fail();
|
|
84
90
|
done();
|
|
85
91
|
})
|
|
86
|
-
.catch(
|
|
87
|
-
|
|
88
|
-
|
|
92
|
+
.catch((err) => {
|
|
93
|
+
if (err instanceof recombee.errors.ResponseError) {
|
|
94
|
+
chai.equal(err.statusCode, 400);
|
|
95
|
+
done();
|
|
96
|
+
}
|
|
97
|
+
throw err;
|
|
89
98
|
});
|
|
90
99
|
});
|
|
91
100
|
|
|
@@ -99,9 +108,12 @@ describe('AddDetailView', function(){
|
|
|
99
108
|
chai.fail();
|
|
100
109
|
done();
|
|
101
110
|
})
|
|
102
|
-
.catch(
|
|
103
|
-
|
|
104
|
-
|
|
111
|
+
.catch((err) => {
|
|
112
|
+
if (err instanceof recombee.errors.ResponseError) {
|
|
113
|
+
chai.equal(err.statusCode, 409);
|
|
114
|
+
done();
|
|
115
|
+
}
|
|
116
|
+
throw err;
|
|
105
117
|
});
|
|
106
118
|
});
|
|
107
119
|
});
|
package/test/add-group-test.js
CHANGED
|
@@ -37,9 +37,12 @@ describe('AddGroup', function(){
|
|
|
37
37
|
chai.fail();
|
|
38
38
|
done();
|
|
39
39
|
})
|
|
40
|
-
.catch(
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
.catch((err) => {
|
|
41
|
+
if (err instanceof recombee.errors.ResponseError) {
|
|
42
|
+
chai.equal(err.statusCode, 400);
|
|
43
|
+
done();
|
|
44
|
+
}
|
|
45
|
+
throw err;
|
|
43
46
|
});
|
|
44
47
|
});
|
|
45
48
|
|
|
@@ -53,9 +56,12 @@ describe('AddGroup', function(){
|
|
|
53
56
|
chai.fail();
|
|
54
57
|
done();
|
|
55
58
|
})
|
|
56
|
-
.catch(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
.catch((err) => {
|
|
60
|
+
if (err instanceof recombee.errors.ResponseError) {
|
|
61
|
+
chai.equal(err.statusCode, 409);
|
|
62
|
+
done();
|
|
63
|
+
}
|
|
64
|
+
throw err;
|
|
59
65
|
});
|
|
60
66
|
});
|
|
61
67
|
});
|
|
@@ -41,9 +41,12 @@ describe('AddItemProperty', function(){
|
|
|
41
41
|
chai.fail();
|
|
42
42
|
done();
|
|
43
43
|
})
|
|
44
|
-
.catch(
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
.catch((err) => {
|
|
45
|
+
if (err instanceof recombee.errors.ResponseError) {
|
|
46
|
+
chai.equal(err.statusCode, 400);
|
|
47
|
+
done();
|
|
48
|
+
}
|
|
49
|
+
throw err;
|
|
47
50
|
});
|
|
48
51
|
});
|
|
49
52
|
|
|
@@ -57,9 +60,12 @@ describe('AddItemProperty', function(){
|
|
|
57
60
|
chai.fail();
|
|
58
61
|
done();
|
|
59
62
|
})
|
|
60
|
-
.catch(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
.catch((err) => {
|
|
64
|
+
if (err instanceof recombee.errors.ResponseError) {
|
|
65
|
+
chai.equal(err.statusCode, 409);
|
|
66
|
+
done();
|
|
67
|
+
}
|
|
68
|
+
throw err;
|
|
63
69
|
});
|
|
64
70
|
});
|
|
65
71
|
});
|
package/test/add-item-test.js
CHANGED
|
@@ -37,9 +37,12 @@ describe('AddItem', function(){
|
|
|
37
37
|
chai.fail();
|
|
38
38
|
done();
|
|
39
39
|
})
|
|
40
|
-
.catch(
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
.catch((err) => {
|
|
41
|
+
if (err instanceof recombee.errors.ResponseError) {
|
|
42
|
+
chai.equal(err.statusCode, 400);
|
|
43
|
+
done();
|
|
44
|
+
}
|
|
45
|
+
throw err;
|
|
43
46
|
});
|
|
44
47
|
});
|
|
45
48
|
|
|
@@ -53,9 +56,12 @@ describe('AddItem', function(){
|
|
|
53
56
|
chai.fail();
|
|
54
57
|
done();
|
|
55
58
|
})
|
|
56
|
-
.catch(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
.catch((err) => {
|
|
60
|
+
if (err instanceof recombee.errors.ResponseError) {
|
|
61
|
+
chai.equal(err.statusCode, 409);
|
|
62
|
+
done();
|
|
63
|
+
}
|
|
64
|
+
throw err;
|
|
59
65
|
});
|
|
60
66
|
});
|
|
61
67
|
});
|