keuss 2.2.1 → 2.2.3

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/Pipeline/Queue.js CHANGED
@@ -118,7 +118,8 @@ class PipelinedMongoQueue extends Queue {
118
118
  query._id = (_.isString(id) ? new mongo.ObjectId (id) : id);
119
119
  }
120
120
  catch (e) {
121
- return cb ('id [' + id + '] can not be used as rollback id: ' + e);
121
+ // fallback to custom id, as is
122
+ query._id = id;
122
123
  }
123
124
 
124
125
  this._col.deleteOne (query, {})
@@ -144,7 +145,8 @@ class PipelinedMongoQueue extends Queue {
144
145
  query._id = (_.isString(id) ? new mongo.ObjectId (id) : id);
145
146
  }
146
147
  catch (e) {
147
- return cb ('id [' + id + '] can not be used as rollback id: ' + e);
148
+ // fallback to custom id, as is
149
+ query._id = id;
148
150
  }
149
151
 
150
152
  const update = {
@@ -276,7 +278,8 @@ class PipelinedMongoQueue extends Queue {
276
278
  query._id = (_.isString(id) ? new mongo.ObjectId (id) : id);
277
279
  }
278
280
  catch (e) {
279
- return cb ('id [' + id + '] can not be used as remove id: ' + e);
281
+ // fallback to custom id, as is
282
+ query._id = id;
280
283
  }
281
284
 
282
285
  this._col.deleteOne (query, {})
package/backends/mongo.js CHANGED
@@ -117,7 +117,8 @@ c
117
117
  query._id = (_.isString(id) ? new mongo.ObjectId (id) : id);
118
118
  }
119
119
  catch (e) {
120
- return cb ('id [' + id + '] can not be used as rollback id: ' + e);
120
+ // fallback to custom id, as is
121
+ query._id = id;
121
122
  }
122
123
 
123
124
  this._col.deleteOne (query, {})
@@ -145,7 +146,8 @@ c
145
146
  query ._id = (_.isString(id) ? new mongo.ObjectId (id) : id);
146
147
  }
147
148
  catch (e) {
148
- return cb ('id [' + id + '] can not be used as rollback id: ' + e);
149
+ // fallback to custom id, as is
150
+ query._id = id;
149
151
  }
150
152
 
151
153
  const update = {
@@ -244,7 +246,8 @@ c
244
246
  query._id = (_.isString(id) ? new mongo.ObjectId (id) : id);
245
247
  }
246
248
  catch (e) {
247
- return cb ('id [' + id + '] can not be used as remove id: ' + e);
249
+ // fallback to custom id, as is
250
+ query._id = id;
248
251
  }
249
252
 
250
253
  this._col.deleteOne (query, {})
@@ -177,8 +177,6 @@ class PGQueue extends Queue {
177
177
  //////////////////////////////////
178
178
  // commit previous reserve, by p.id
179
179
  commit (id, cb) {
180
- if (!uuid.validate (id)) return cb ('id [' + id + '] can not be used as commit id: not a valid UUID');
181
-
182
180
  this._pool.query (`
183
181
  DELETE FROM ${this._tbl_name}
184
182
  WHERE _id = $1
@@ -200,8 +198,6 @@ class PGQueue extends Queue {
200
198
  next_t = null;
201
199
  }
202
200
 
203
- if (!uuid.validate (id)) return cb ('id [' + id + '] can not be used as rollback id: not a valid UUID');
204
-
205
201
  const nxt = (next_t ? new Date (next_t) : Queue.now ());
206
202
 
207
203
  this._pool.query (`
@@ -301,8 +297,6 @@ class PGQueue extends Queue {
301
297
  //////////////////////////////////////////////
302
298
  // remove by id
303
299
  remove (id, cb) {
304
- if (!uuid.validate (id)) return cb ('id [' + id + '] can not be used as remove id: not a valid UUID');
305
-
306
300
  this._pool.query (`
307
301
  DELETE FROM ${this._tbl_name}
308
302
  WHERE _id = $1
@@ -125,7 +125,8 @@ class PersistentMongoQueue extends Queue {
125
125
  query._id = (_.isString(id) ? new mongo.ObjectId (id) : id);
126
126
  }
127
127
  catch (e) {
128
- return cb ('id [' + id + '] can not be used as rollback id: ' + e);
128
+ // fallback to custom id, as is
129
+ query._id = id;
129
130
  }
130
131
 
131
132
  const updt = {
@@ -160,7 +161,8 @@ class PersistentMongoQueue extends Queue {
160
161
  query._id = (_.isString(id) ? new mongo.ObjectId (id) : id);
161
162
  }
162
163
  catch (e) {
163
- return cb ('id [' + id + '] can not be used as rollback id: ' + e);
164
+ // fallback to custom id, as is
165
+ query._id = id;
164
166
  }
165
167
 
166
168
  const update = {
@@ -247,7 +249,8 @@ class PersistentMongoQueue extends Queue {
247
249
  query._id = (_.isString(id) ? new mongo.ObjectId (id) : id);
248
250
  }
249
251
  catch (e) {
250
- return cb ('id [' + id + '] can not be used as remove id: ' + e);
252
+ // fallback to custom id, as is
253
+ query._id = id;
251
254
  }
252
255
 
253
256
  const updt = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keuss",
3
- "version": "2.2.1",
3
+ "version": "2.2.3",
4
4
  "keywords": [
5
5
  "queue",
6
6
  "persistent",
@@ -32,17 +32,17 @@
32
32
  "async-lock": "~1.4.1",
33
33
  "debug": "~4.3.6",
34
34
  "ioredis": "~5.4.1",
35
- "lodash": "~4.17.21",
35
+ "lodash": "~4.18.1",
36
36
  "mitt": "~3.0.1",
37
37
  "mongodb": "^6.0.0",
38
- "uuid": "~8.3.2",
38
+ "uuid": "11.1.1",
39
39
  "pg": "~8.12.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "chance": "~1.1.13",
43
43
  "mocha": "~11.7.5",
44
44
  "should": "~13.2.3",
45
- "nyc": "~17.1.0"
45
+ "nyc": "~18.0.0"
46
46
  },
47
47
  "scripts": {
48
48
  "test": "docker compose up -d; sleep 5; mocha --reporter spec --check-leaks --no-timeouts --exit test/ ; docker compose down",