kv-test-lib 3.5.2-rc.2 → 3.5.2-rc.4
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/es5_dist/adapters/browser.js +7 -11
- package/es5_dist/adapters/browser.js.map +1 -1
- package/es5_dist/browser/browser.js +0 -4
- package/es5_dist/browser/browser.js.map +1 -1
- package/es5_dist/browser/cookies.js +0 -4
- package/es5_dist/browser/cookies.js.map +1 -1
- package/es5_dist/browser/persist.js +79 -96
- package/es5_dist/browser/persist.js.map +1 -1
- package/es5_dist/generated/buildInfo.js +1 -1
- package/es5_dist/generated/buildInfo.js.map +1 -1
- package/es5_dist/http.js +5 -9
- package/es5_dist/http.js.map +1 -1
- package/es5_dist/interfaces.js +0 -7
- package/es5_dist/interfaces.js.map +1 -1
- package/es5_dist/jobqueue.js +92 -112
- package/es5_dist/jobqueue.js.map +1 -1
- package/es5_dist/kochava.js +134 -366
- package/es5_dist/kochava.js.map +1 -1
- package/es5_dist/measurementEvent.js +1 -3
- package/es5_dist/measurementEvent.js.map +1 -1
- package/es5_dist/payloads/event.js +3 -7
- package/es5_dist/payloads/event.js.map +1 -1
- package/es5_dist/payloads/identityLink.js +3 -7
- package/es5_dist/payloads/identityLink.js.map +1 -1
- package/es5_dist/payloads/install.js +28 -46
- package/es5_dist/payloads/install.js.map +1 -1
- package/es5_dist/payloads/kvinit.js +25 -38
- package/es5_dist/payloads/kvinit.js.map +1 -1
- package/es5_dist/payloads/payload.js +0 -9
- package/es5_dist/payloads/payload.js.map +1 -1
- package/es5_dist/payloads/update.js +3 -7
- package/es5_dist/payloads/update.js.map +1 -1
- package/es5_dist/product.js +1 -16
- package/es5_dist/product.js.map +1 -1
- package/es5_dist/utils/log.js +1 -5
- package/es5_dist/utils/log.js.map +1 -1
- package/es5_dist/utils/utils.js +0 -7
- package/es5_dist/utils/utils.js.map +1 -1
- package/package.json +1 -1
package/es5_dist/jobqueue.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Authored by Brett Barinaga on 11/17/21.
|
|
3
|
-
Copyright (c) Kochava, Inc. All rights reserved.
|
|
4
|
-
*/
|
|
5
1
|
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
6
2
|
function adopt(value) {
|
|
7
3
|
return value instanceof P ? value : new P(function (resolve) {
|
|
@@ -99,10 +95,8 @@ function jobIsIdLinkJob(obj) {
|
|
|
99
95
|
function jobIsEventJob(obj) {
|
|
100
96
|
return 'eventName' in obj;
|
|
101
97
|
}
|
|
102
|
-
var JobQueue =
|
|
98
|
+
var JobQueue = function () {
|
|
103
99
|
function JobQueue() {
|
|
104
|
-
// Holds the pending retry-wait's resolve so stop() can wake the loop instead
|
|
105
|
-
// of clearing the timer and leaving the await pending forever.
|
|
106
100
|
this.fn_resolveWait = null;
|
|
107
101
|
this.updateQueue = [];
|
|
108
102
|
this.idLinkQueue = [];
|
|
@@ -116,10 +110,10 @@ var JobQueue = /** @class */function () {
|
|
|
116
110
|
return __generator(this, function (_a) {
|
|
117
111
|
switch (_a.label) {
|
|
118
112
|
case 0:
|
|
119
|
-
return [4
|
|
113
|
+
return [4, updatePersistedValue(PersistKey.EventQueue, JSON.stringify(this.eventQueue), false)];
|
|
120
114
|
case 1:
|
|
121
115
|
_a.sent();
|
|
122
|
-
return [2
|
|
116
|
+
return [2];
|
|
123
117
|
}
|
|
124
118
|
});
|
|
125
119
|
});
|
|
@@ -129,10 +123,10 @@ var JobQueue = /** @class */function () {
|
|
|
129
123
|
return __generator(this, function (_a) {
|
|
130
124
|
switch (_a.label) {
|
|
131
125
|
case 0:
|
|
132
|
-
return [4
|
|
126
|
+
return [4, updatePersistedValue(PersistKey.IdLinkQueue, JSON.stringify(this.idLinkQueue), false)];
|
|
133
127
|
case 1:
|
|
134
128
|
_a.sent();
|
|
135
|
-
return [2
|
|
129
|
+
return [2];
|
|
136
130
|
}
|
|
137
131
|
});
|
|
138
132
|
});
|
|
@@ -142,10 +136,10 @@ var JobQueue = /** @class */function () {
|
|
|
142
136
|
return __generator(this, function (_a) {
|
|
143
137
|
switch (_a.label) {
|
|
144
138
|
case 0:
|
|
145
|
-
return [4
|
|
139
|
+
return [4, updatePersistedValue(PersistKey.UpdateQueue, JSON.stringify(this.updateQueue), false)];
|
|
146
140
|
case 1:
|
|
147
141
|
_a.sent();
|
|
148
|
-
return [2
|
|
142
|
+
return [2];
|
|
149
143
|
}
|
|
150
144
|
});
|
|
151
145
|
});
|
|
@@ -156,49 +150,43 @@ var JobQueue = /** @class */function () {
|
|
|
156
150
|
return __generator(this, function (_k) {
|
|
157
151
|
switch (_k.label) {
|
|
158
152
|
case 0:
|
|
159
|
-
// Re-check invalidation between each load/persist block: the updateXJobs
|
|
160
|
-
// calls write the queues back, and a shutdown landing mid-sequence on
|
|
161
|
-
// asynchronous storage must not have later write-backs land post-wipe.
|
|
162
153
|
_a = this;
|
|
163
154
|
_c = (_b = JSON).parse;
|
|
164
|
-
return [4
|
|
155
|
+
return [4, getItem(PersistKey.UpdateQueue)];
|
|
165
156
|
case 1:
|
|
166
|
-
// Re-check invalidation between each load/persist block: the updateXJobs
|
|
167
|
-
// calls write the queues back, and a shutdown landing mid-sequence on
|
|
168
|
-
// asynchronous storage must not have later write-backs land post-wipe.
|
|
169
157
|
_a.updateQueue = _c.apply(_b, [_k.sent()]) || [];
|
|
170
|
-
if (instance.invalidatedBool) return [2
|
|
171
|
-
return [4
|
|
158
|
+
if (instance.invalidatedBool) return [2];
|
|
159
|
+
return [4, this.updateUpdateJobs(instance)];
|
|
172
160
|
case 2:
|
|
173
161
|
_k.sent();
|
|
174
162
|
Log.trace("Started Update Queue", JSON.parse(JSON.stringify(this.updateQueue)));
|
|
175
163
|
_d = this;
|
|
176
164
|
_f = (_e = JSON).parse;
|
|
177
|
-
return [4
|
|
165
|
+
return [4, getItem(PersistKey.IdLinkQueue)];
|
|
178
166
|
case 3:
|
|
179
167
|
_d.idLinkQueue = _f.apply(_e, [_k.sent()]) || [];
|
|
180
|
-
if (instance.invalidatedBool) return [2
|
|
181
|
-
return [4
|
|
168
|
+
if (instance.invalidatedBool) return [2];
|
|
169
|
+
return [4, this.updateIdLinkJobs(instance)];
|
|
182
170
|
case 4:
|
|
183
171
|
_k.sent();
|
|
184
172
|
Log.trace("Started IdLink Queue", JSON.parse(JSON.stringify(this.idLinkQueue)));
|
|
185
173
|
_g = this;
|
|
186
174
|
_j = (_h = JSON).parse;
|
|
187
|
-
return [4
|
|
175
|
+
return [4, getItem(PersistKey.EventQueue)];
|
|
188
176
|
case 5:
|
|
189
177
|
_g.eventQueue = _j.apply(_h, [_k.sent()]) || [];
|
|
190
|
-
if (instance.invalidatedBool) return [2
|
|
191
|
-
return [4
|
|
178
|
+
if (instance.invalidatedBool) return [2];
|
|
179
|
+
return [4, this.updateEventJobs(instance)];
|
|
192
180
|
case 6:
|
|
193
181
|
_k.sent();
|
|
194
182
|
Log.trace("Started Event Queue", JSON.parse(JSON.stringify(this.eventQueue)));
|
|
195
|
-
if (instance.invalidatedBool) return [2
|
|
183
|
+
if (instance.invalidatedBool) return [2];
|
|
196
184
|
this.stopped = false;
|
|
197
185
|
this.paused = false;
|
|
198
|
-
return [4
|
|
186
|
+
return [4, this.dequeueAndProcessJobs(instance)];
|
|
199
187
|
case 7:
|
|
200
188
|
_k.sent();
|
|
201
|
-
return [2
|
|
189
|
+
return [2];
|
|
202
190
|
}
|
|
203
191
|
});
|
|
204
192
|
});
|
|
@@ -206,8 +194,6 @@ var JobQueue = /** @class */function () {
|
|
|
206
194
|
JobQueue.prototype.stop = function () {
|
|
207
195
|
this.stopped = true;
|
|
208
196
|
if (this.timeOut) clearTimeout(this.timeOut);
|
|
209
|
-
// Wake any pending retry wait so the loop resumes and exits, rather than the
|
|
210
|
-
// await hanging forever on a cleared timer.
|
|
211
197
|
if (this.fn_resolveWait) {
|
|
212
198
|
var fn_resolve = this.fn_resolveWait;
|
|
213
199
|
this.fn_resolveWait = null;
|
|
@@ -226,7 +212,7 @@ var JobQueue = /** @class */function () {
|
|
|
226
212
|
case 0:
|
|
227
213
|
keyName = Object.keys(deviceIds)[0];
|
|
228
214
|
preStartBody = Update.constructPreStart(instance, deviceIds);
|
|
229
|
-
if (!(instance.installDone && instance.kvinitDone)) return [3
|
|
215
|
+
if (!(instance.installDone && instance.kvinitDone)) return [3, 3];
|
|
230
216
|
postStartBody = Update.constructPostStart(instance, preStartBody);
|
|
231
217
|
existingPostStart = -1;
|
|
232
218
|
for (i = 0; i < this.updateQueue.length; i++) {
|
|
@@ -249,13 +235,13 @@ var JobQueue = /** @class */function () {
|
|
|
249
235
|
deviceIds: deviceIds
|
|
250
236
|
});
|
|
251
237
|
}
|
|
252
|
-
return [4
|
|
238
|
+
return [4, this.persistUpdateQueue()];
|
|
253
239
|
case 1:
|
|
254
240
|
_a.sent();
|
|
255
|
-
return [4
|
|
241
|
+
return [4, this.dequeueAndProcessJobs(instance)];
|
|
256
242
|
case 2:
|
|
257
243
|
_a.sent();
|
|
258
|
-
return [2
|
|
244
|
+
return [2];
|
|
259
245
|
case 3:
|
|
260
246
|
existingPreStart = -1;
|
|
261
247
|
for (i = 0; i < this.updateQueue.length; i++) {
|
|
@@ -277,10 +263,10 @@ var JobQueue = /** @class */function () {
|
|
|
277
263
|
deviceIds: deviceIds
|
|
278
264
|
});
|
|
279
265
|
}
|
|
280
|
-
return [4
|
|
266
|
+
return [4, this.persistUpdateQueue()];
|
|
281
267
|
case 4:
|
|
282
268
|
_a.sent();
|
|
283
|
-
return [2
|
|
269
|
+
return [2];
|
|
284
270
|
}
|
|
285
271
|
});
|
|
286
272
|
});
|
|
@@ -292,7 +278,7 @@ var JobQueue = /** @class */function () {
|
|
|
292
278
|
switch (_a.label) {
|
|
293
279
|
case 0:
|
|
294
280
|
idLinkPreStartBody = IdLink.constructPreStart(instance, idLink);
|
|
295
|
-
if (!(instance.installDone && instance.kvinitDone)) return [3
|
|
281
|
+
if (!(instance.installDone && instance.kvinitDone)) return [3, 3];
|
|
296
282
|
postStartBody = IdLink.constructPostStart(instance, idLinkPreStartBody);
|
|
297
283
|
newJob_1 = {
|
|
298
284
|
id: uuidv4(),
|
|
@@ -303,13 +289,13 @@ var JobQueue = /** @class */function () {
|
|
|
303
289
|
idLink: idLink
|
|
304
290
|
};
|
|
305
291
|
this.idLinkQueue.push(newJob_1);
|
|
306
|
-
return [4
|
|
292
|
+
return [4, this.persistIdLinkQueue()];
|
|
307
293
|
case 1:
|
|
308
294
|
_a.sent();
|
|
309
|
-
return [4
|
|
295
|
+
return [4, this.dequeueAndProcessJobs(instance)];
|
|
310
296
|
case 2:
|
|
311
297
|
_a.sent();
|
|
312
|
-
return [2
|
|
298
|
+
return [2];
|
|
313
299
|
case 3:
|
|
314
300
|
newJob = {
|
|
315
301
|
id: uuidv4(),
|
|
@@ -320,10 +306,10 @@ var JobQueue = /** @class */function () {
|
|
|
320
306
|
idLink: idLink
|
|
321
307
|
};
|
|
322
308
|
this.idLinkQueue.push(newJob);
|
|
323
|
-
return [4
|
|
309
|
+
return [4, this.persistIdLinkQueue()];
|
|
324
310
|
case 4:
|
|
325
311
|
_a.sent();
|
|
326
|
-
return [2
|
|
312
|
+
return [2];
|
|
327
313
|
}
|
|
328
314
|
});
|
|
329
315
|
});
|
|
@@ -337,7 +323,7 @@ var JobQueue = /** @class */function () {
|
|
|
337
323
|
eventName = args[0];
|
|
338
324
|
eventData = args[1];
|
|
339
325
|
eventPreStartBody = Event.constructPreStart(instance, eventName, eventData);
|
|
340
|
-
if (!(instance.installDone && instance.kvinitDone)) return [3
|
|
326
|
+
if (!(instance.installDone && instance.kvinitDone)) return [3, 3];
|
|
341
327
|
postStartBody = Event.constructPostStart(instance, eventPreStartBody);
|
|
342
328
|
newJob = {
|
|
343
329
|
id: uuidv4(),
|
|
@@ -348,13 +334,13 @@ var JobQueue = /** @class */function () {
|
|
|
348
334
|
eventName: eventName
|
|
349
335
|
};
|
|
350
336
|
this.eventQueue.push(newJob);
|
|
351
|
-
return [4
|
|
337
|
+
return [4, this.persistEventQueue()];
|
|
352
338
|
case 1:
|
|
353
339
|
_a.sent();
|
|
354
|
-
return [4
|
|
340
|
+
return [4, this.dequeueAndProcessJobs(instance)];
|
|
355
341
|
case 2:
|
|
356
342
|
_a.sent();
|
|
357
|
-
return [2
|
|
343
|
+
return [2];
|
|
358
344
|
case 3:
|
|
359
345
|
newEventJob = {
|
|
360
346
|
id: uuidv4(),
|
|
@@ -365,10 +351,10 @@ var JobQueue = /** @class */function () {
|
|
|
365
351
|
eventName: eventName
|
|
366
352
|
};
|
|
367
353
|
this.eventQueue.push(newEventJob);
|
|
368
|
-
return [4
|
|
354
|
+
return [4, this.persistEventQueue()];
|
|
369
355
|
case 4:
|
|
370
356
|
_a.sent();
|
|
371
|
-
return [2
|
|
357
|
+
return [2];
|
|
372
358
|
}
|
|
373
359
|
});
|
|
374
360
|
});
|
|
@@ -379,40 +365,38 @@ var JobQueue = /** @class */function () {
|
|
|
379
365
|
return __generator(this, function (_a) {
|
|
380
366
|
switch (_a.label) {
|
|
381
367
|
case 0:
|
|
382
|
-
if (this.processing) return [2
|
|
383
|
-
if (this.paused) return [2
|
|
384
|
-
if (this.stopped) return [2
|
|
385
|
-
if (instance.invalidatedBool) return [2
|
|
368
|
+
if (this.processing) return [2, false];
|
|
369
|
+
if (this.paused) return [2, false];
|
|
370
|
+
if (this.stopped) return [2, false];
|
|
371
|
+
if (instance.invalidatedBool) return [2, false];
|
|
386
372
|
_a.label = 1;
|
|
387
373
|
case 1:
|
|
388
|
-
if (!(!this.stopped && !this.paused && !instance.invalidatedBool)) return [3
|
|
374
|
+
if (!(!this.stopped && !this.paused && !instance.invalidatedBool)) return [3, 5];
|
|
389
375
|
job = this.dequeueJob();
|
|
390
376
|
if (!job) {
|
|
391
|
-
return [2
|
|
377
|
+
return [2, false];
|
|
392
378
|
}
|
|
393
379
|
Log.trace("Dequeued Job: ", job);
|
|
394
380
|
this.processing = true;
|
|
395
|
-
return [4
|
|
381
|
+
return [4, this.processJob(instance, job)];
|
|
396
382
|
case 2:
|
|
397
383
|
result = _a.sent();
|
|
398
384
|
if (this.stopped) {
|
|
399
|
-
return [2
|
|
385
|
+
return [2, true];
|
|
400
386
|
}
|
|
401
|
-
// Don't write the queue back to storage after invalidation — it would
|
|
402
|
-
// clobber a freshly-reset instance's storage.
|
|
403
387
|
if (instance.invalidatedBool) {
|
|
404
|
-
return [2
|
|
388
|
+
return [2, true];
|
|
405
389
|
}
|
|
406
390
|
this.processing = false;
|
|
407
|
-
if (!result) return [3
|
|
408
|
-
return [4
|
|
391
|
+
if (!result) return [3, 4];
|
|
392
|
+
return [4, this.persistQueueForJob(job)];
|
|
409
393
|
case 3:
|
|
410
394
|
_a.sent();
|
|
411
395
|
_a.label = 4;
|
|
412
396
|
case 4:
|
|
413
|
-
return [3
|
|
397
|
+
return [3, 1];
|
|
414
398
|
case 5:
|
|
415
|
-
return [2
|
|
399
|
+
return [2, true];
|
|
416
400
|
}
|
|
417
401
|
});
|
|
418
402
|
});
|
|
@@ -426,26 +410,26 @@ var JobQueue = /** @class */function () {
|
|
|
426
410
|
return __generator(this, function (_a) {
|
|
427
411
|
switch (_a.label) {
|
|
428
412
|
case 0:
|
|
429
|
-
if (!jobIsUpdateJob(job)) return [3
|
|
430
|
-
return [4
|
|
413
|
+
if (!jobIsUpdateJob(job)) return [3, 2];
|
|
414
|
+
return [4, this.persistUpdateQueue()];
|
|
431
415
|
case 1:
|
|
432
416
|
_a.sent();
|
|
433
|
-
return [2
|
|
417
|
+
return [2];
|
|
434
418
|
case 2:
|
|
435
|
-
if (!jobIsIdLinkJob(job)) return [3
|
|
436
|
-
return [4
|
|
419
|
+
if (!jobIsIdLinkJob(job)) return [3, 4];
|
|
420
|
+
return [4, this.persistIdLinkQueue()];
|
|
437
421
|
case 3:
|
|
438
422
|
_a.sent();
|
|
439
|
-
return [2
|
|
423
|
+
return [2];
|
|
440
424
|
case 4:
|
|
441
|
-
if (!jobIsEventJob(job)) return [3
|
|
442
|
-
return [4
|
|
425
|
+
if (!jobIsEventJob(job)) return [3, 6];
|
|
426
|
+
return [4, this.persistEventQueue()];
|
|
443
427
|
case 5:
|
|
444
428
|
_a.sent();
|
|
445
|
-
return [2
|
|
429
|
+
return [2];
|
|
446
430
|
case 6:
|
|
447
431
|
Log.warn("persistQueueForJob: unrecognized job type, queue not persisted.");
|
|
448
|
-
return [2
|
|
432
|
+
return [2];
|
|
449
433
|
}
|
|
450
434
|
});
|
|
451
435
|
});
|
|
@@ -460,7 +444,7 @@ var JobQueue = /** @class */function () {
|
|
|
460
444
|
if (jobIsUpdateJob(job)) {
|
|
461
445
|
if (!instance.kochavaConfig.install.updates_enabled) {
|
|
462
446
|
Log.debug("updates_enabled is false, dropping update job.");
|
|
463
|
-
return [2
|
|
447
|
+
return [2, true];
|
|
464
448
|
}
|
|
465
449
|
updateKeyName = Object.keys(job.deviceIds)[0];
|
|
466
450
|
updateKeyAllowed = false;
|
|
@@ -473,14 +457,14 @@ var JobQueue = /** @class */function () {
|
|
|
473
457
|
}
|
|
474
458
|
if (!updateKeyAllowed) {
|
|
475
459
|
Log.debug("".concat(updateKeyName, " not in allow_custom_ids, dropping update job."));
|
|
476
|
-
return [2
|
|
460
|
+
return [2, true];
|
|
477
461
|
}
|
|
478
462
|
} else if (jobIsIdLinkJob(job)) {
|
|
479
463
|
for (_b = 0, _c = instance.kochavaConfig.privacy.deny_identity_links; _b < _c.length; _b++) {
|
|
480
464
|
denyIdLinkKey = _c[_b];
|
|
481
465
|
if (denyIdLinkKey === Object.keys(job.idLink)[0]) {
|
|
482
466
|
Log.debug("Denied identity_link ".concat(denyIdLinkKey, ", dropping request."));
|
|
483
|
-
return [2
|
|
467
|
+
return [2, true];
|
|
484
468
|
}
|
|
485
469
|
}
|
|
486
470
|
} else if (jobIsEventJob(job)) {
|
|
@@ -488,7 +472,7 @@ var JobQueue = /** @class */function () {
|
|
|
488
472
|
denyName = _e[_d];
|
|
489
473
|
if (denyName === job.eventName) {
|
|
490
474
|
Log.debug("Denied event_name ".concat(denyName, ", dropping request."));
|
|
491
|
-
return [2
|
|
475
|
+
return [2, true];
|
|
492
476
|
}
|
|
493
477
|
}
|
|
494
478
|
}
|
|
@@ -498,31 +482,28 @@ var JobQueue = /** @class */function () {
|
|
|
498
482
|
return __generator(this, function (_g) {
|
|
499
483
|
switch (_g.label) {
|
|
500
484
|
case 0:
|
|
501
|
-
// Halt fast if the instance was invalidated (shutdown) mid-flight.
|
|
502
485
|
if (instance.invalidatedBool) {
|
|
503
|
-
return [2
|
|
486
|
+
return [2, { value: true }];
|
|
504
487
|
}
|
|
505
|
-
if (!!instance.sdkDisabled) return [3
|
|
506
|
-
return [4
|
|
488
|
+
if (!!instance.sdkDisabled) return [3, 2];
|
|
489
|
+
return [4, this_1.attemptJob(instance, job)];
|
|
507
490
|
case 1:
|
|
508
491
|
success = _g.sent();
|
|
509
|
-
return [3
|
|
492
|
+
return [3, 3];
|
|
510
493
|
case 2:
|
|
511
494
|
success = true;
|
|
512
495
|
_g.label = 3;
|
|
513
496
|
case 3:
|
|
514
|
-
// If our job succeeded
|
|
515
497
|
if (success) {
|
|
516
|
-
// Job Done
|
|
517
498
|
Log.trace("Job processed successfully:", job);
|
|
518
|
-
return [2
|
|
499
|
+
return [2, { value: true }];
|
|
519
500
|
}
|
|
520
|
-
if (!!this_1.stopped) return [3
|
|
501
|
+
if (!!this_1.stopped) return [3, 5];
|
|
521
502
|
retryWaterfall = instance.kochavaConfig.networking.retry_waterfall;
|
|
522
503
|
retryIndex = job.retries > retryWaterfall.length - 1 ? retryWaterfall.length - 1 : job.retries;
|
|
523
504
|
retrySec_1 = retryWaterfall[retryIndex];
|
|
524
505
|
Log.error("Job failed, attempting again in ".concat(retrySec_1, " seconds"));
|
|
525
|
-
return [4
|
|
506
|
+
return [4, new Promise(function (resolve) {
|
|
526
507
|
_this.fn_resolveWait = resolve;
|
|
527
508
|
_this.timeOut = setTimeout(function () {
|
|
528
509
|
_this.fn_resolveWait = null;resolve();
|
|
@@ -533,24 +514,23 @@ var JobQueue = /** @class */function () {
|
|
|
533
514
|
job.retries++;
|
|
534
515
|
_g.label = 5;
|
|
535
516
|
case 5:
|
|
536
|
-
return [2
|
|
517
|
+
return [2];
|
|
537
518
|
}
|
|
538
519
|
});
|
|
539
520
|
};
|
|
540
521
|
this_1 = this;
|
|
541
522
|
_f.label = 1;
|
|
542
523
|
case 1:
|
|
543
|
-
return [5
|
|
524
|
+
return [5, _loop_1()];
|
|
544
525
|
case 2:
|
|
545
526
|
state_1 = _f.sent();
|
|
546
|
-
if (typeof state_1 === "object") return [2
|
|
527
|
+
if (typeof state_1 === "object") return [2, state_1.value];
|
|
547
528
|
_f.label = 3;
|
|
548
529
|
case 3:
|
|
549
|
-
if (!success && !this.stopped && !instance.invalidatedBool) return [3
|
|
530
|
+
if (!success && !this.stopped && !instance.invalidatedBool) return [3, 1];
|
|
550
531
|
_f.label = 4;
|
|
551
532
|
case 4:
|
|
552
|
-
|
|
553
|
-
return [2 /*return*/, true];
|
|
533
|
+
return [2, true];
|
|
554
534
|
}
|
|
555
535
|
});
|
|
556
536
|
});
|
|
@@ -560,23 +540,23 @@ var JobQueue = /** @class */function () {
|
|
|
560
540
|
return __generator(this, function (_a) {
|
|
561
541
|
switch (_a.label) {
|
|
562
542
|
case 0:
|
|
563
|
-
if (!(job.preStartBody.action === "update")) return [3
|
|
564
|
-
return [4
|
|
543
|
+
if (!(job.preStartBody.action === "update")) return [3, 2];
|
|
544
|
+
return [4, Update.send(instance, job)];
|
|
565
545
|
case 1:
|
|
566
|
-
return [2
|
|
546
|
+
return [2, _a.sent()];
|
|
567
547
|
case 2:
|
|
568
|
-
if (!(job.preStartBody.action === "identityLink")) return [3
|
|
569
|
-
return [4
|
|
548
|
+
if (!(job.preStartBody.action === "identityLink")) return [3, 4];
|
|
549
|
+
return [4, IdLink.send(instance, job)];
|
|
570
550
|
case 3:
|
|
571
|
-
return [2
|
|
551
|
+
return [2, _a.sent()];
|
|
572
552
|
case 4:
|
|
573
|
-
if (!(job.preStartBody.action === "event")) return [3
|
|
574
|
-
return [4
|
|
553
|
+
if (!(job.preStartBody.action === "event")) return [3, 6];
|
|
554
|
+
return [4, Event.send(instance, job.preStartBody, job.postStartBody)];
|
|
575
555
|
case 5:
|
|
576
|
-
return [2
|
|
556
|
+
return [2, _a.sent()];
|
|
577
557
|
case 6:
|
|
578
558
|
Log.warn("Invalid action in job from jobqueue, cancelling.");
|
|
579
|
-
return [2
|
|
559
|
+
return [2, true];
|
|
580
560
|
}
|
|
581
561
|
});
|
|
582
562
|
});
|
|
@@ -593,10 +573,10 @@ var JobQueue = /** @class */function () {
|
|
|
593
573
|
job.postStartBody = Update.constructPostStart(instance, job.preStartBody);
|
|
594
574
|
}
|
|
595
575
|
}
|
|
596
|
-
return [4
|
|
576
|
+
return [4, this.persistUpdateQueue()];
|
|
597
577
|
case 1:
|
|
598
578
|
_b.sent();
|
|
599
|
-
return [2
|
|
579
|
+
return [2];
|
|
600
580
|
}
|
|
601
581
|
});
|
|
602
582
|
});
|
|
@@ -613,10 +593,10 @@ var JobQueue = /** @class */function () {
|
|
|
613
593
|
job.postStartBody = IdLink.constructPostStart(instance, job.preStartBody);
|
|
614
594
|
}
|
|
615
595
|
}
|
|
616
|
-
return [4
|
|
596
|
+
return [4, this.persistIdLinkQueue()];
|
|
617
597
|
case 1:
|
|
618
598
|
_b.sent();
|
|
619
|
-
return [2
|
|
599
|
+
return [2];
|
|
620
600
|
}
|
|
621
601
|
});
|
|
622
602
|
});
|
|
@@ -633,10 +613,10 @@ var JobQueue = /** @class */function () {
|
|
|
633
613
|
job.postStartBody = Event.constructPostStart(instance, job.preStartBody);
|
|
634
614
|
}
|
|
635
615
|
}
|
|
636
|
-
return [4
|
|
616
|
+
return [4, this.persistEventQueue()];
|
|
637
617
|
case 1:
|
|
638
618
|
_b.sent();
|
|
639
|
-
return [2
|
|
619
|
+
return [2];
|
|
640
620
|
}
|
|
641
621
|
});
|
|
642
622
|
});
|