bruce-models 4.8.0 → 4.8.1
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/dist/bruce-models.es5.js +65 -1
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +65 -1
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/server/pending-action.js +64 -0
- package/dist/lib/server/pending-action.js.map +1 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/server/pending-action.d.ts +33 -0
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -10548,6 +10548,70 @@
|
|
|
10548
10548
|
});
|
|
10549
10549
|
}
|
|
10550
10550
|
PendingAction.Cancel = Cancel;
|
|
10551
|
+
/**
|
|
10552
|
+
* Resolves when the Pending Action is no longer running.
|
|
10553
|
+
* @param params
|
|
10554
|
+
*
|
|
10555
|
+
* @example
|
|
10556
|
+
* try {
|
|
10557
|
+
* const { action } = await PendingAction.OnCompletion({ actionId: 123 });
|
|
10558
|
+
* }
|
|
10559
|
+
* catch (e) {
|
|
10560
|
+
* // Threw because the action failed to be found.
|
|
10561
|
+
* // Most likely scenarios are invalid actionId or server connection issues.
|
|
10562
|
+
* // If it's related to server connection issues then wait a bit and relaunch.
|
|
10563
|
+
* }
|
|
10564
|
+
*
|
|
10565
|
+
* // Here is how you can stop the loop on early disposal.
|
|
10566
|
+
* let disposed = false;
|
|
10567
|
+
* const { action } = await PendingAction.OnCompletion({
|
|
10568
|
+
* actionId: 123,
|
|
10569
|
+
* isDisposed: () => {
|
|
10570
|
+
* return disposed;
|
|
10571
|
+
* }
|
|
10572
|
+
* });
|
|
10573
|
+
* // Action will resolve as null if it was disposed early.
|
|
10574
|
+
*/
|
|
10575
|
+
function OnCompletion(params) {
|
|
10576
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
10577
|
+
let { api, actionId, req: reqParams, interval: intMs, isDisposed } = params;
|
|
10578
|
+
if (!actionId) {
|
|
10579
|
+
throw ("Action ID is required.");
|
|
10580
|
+
}
|
|
10581
|
+
if (!api) {
|
|
10582
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
10583
|
+
}
|
|
10584
|
+
if (!intMs || intMs <= 0) {
|
|
10585
|
+
intMs = 3000;
|
|
10586
|
+
}
|
|
10587
|
+
const res = yield new Promise((res, rej) => {
|
|
10588
|
+
let interval = setInterval(() => __awaiter(this, void 0, void 0, function* () {
|
|
10589
|
+
if (isDisposed && isDisposed()) {
|
|
10590
|
+
clearInterval(interval);
|
|
10591
|
+
res(null);
|
|
10592
|
+
}
|
|
10593
|
+
try {
|
|
10594
|
+
const { action } = yield Get({
|
|
10595
|
+
api,
|
|
10596
|
+
actionId,
|
|
10597
|
+
req: reqParams
|
|
10598
|
+
});
|
|
10599
|
+
if (action.Status !== EStatus.InProgress) {
|
|
10600
|
+
clearInterval(interval);
|
|
10601
|
+
res(action);
|
|
10602
|
+
}
|
|
10603
|
+
}
|
|
10604
|
+
catch (e) {
|
|
10605
|
+
rej(e);
|
|
10606
|
+
}
|
|
10607
|
+
}), intMs);
|
|
10608
|
+
});
|
|
10609
|
+
return {
|
|
10610
|
+
action: res
|
|
10611
|
+
};
|
|
10612
|
+
});
|
|
10613
|
+
}
|
|
10614
|
+
PendingAction.OnCompletion = OnCompletion;
|
|
10551
10615
|
})(exports.PendingAction || (exports.PendingAction = {}));
|
|
10552
10616
|
|
|
10553
10617
|
// Some dead accounts that we don't want to show in the UI.
|
|
@@ -13916,7 +13980,7 @@
|
|
|
13916
13980
|
})(exports.DataSource || (exports.DataSource = {}));
|
|
13917
13981
|
|
|
13918
13982
|
// This is updated with the package.json version on build.
|
|
13919
|
-
const VERSION = "4.8.
|
|
13983
|
+
const VERSION = "4.8.1";
|
|
13920
13984
|
|
|
13921
13985
|
exports.VERSION = VERSION;
|
|
13922
13986
|
exports.AbstractApi = AbstractApi;
|