@lifi/sdk 3.0.0-alpha.1 → 3.0.0-alpha.11
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/cjs/LiFi.js +222 -261
- package/dist/cjs/LiFi.js.map +1 -0
- package/dist/cjs/allowance/getAllowance.js +13 -16
- package/dist/cjs/allowance/getAllowance.js.map +1 -0
- package/dist/cjs/allowance/index.js +5 -17
- package/dist/cjs/allowance/index.js.map +1 -0
- package/dist/cjs/allowance/setAllowance.js +33 -18
- package/dist/cjs/allowance/setAllowance.js.map +1 -0
- package/dist/cjs/allowance/types.js +1 -0
- package/dist/cjs/allowance/types.js.map +1 -0
- package/dist/cjs/balance/getBalance.js +14 -14
- package/dist/cjs/balance/getBalance.js.map +1 -0
- package/dist/cjs/balance/getTokenBalance.js +3 -3
- package/dist/cjs/balance/getTokenBalance.js.map +1 -0
- package/dist/cjs/balance/index.js +4 -16
- package/dist/cjs/balance/index.js.map +1 -0
- package/dist/cjs/connectors.js +7 -35
- package/dist/cjs/connectors.js.map +1 -0
- package/dist/cjs/constants.js +2 -4
- package/dist/cjs/constants.js.map +1 -0
- package/dist/cjs/execution/BaseStepExecutor.js +54 -0
- package/dist/cjs/execution/BaseStepExecutor.js.map +1 -0
- package/dist/cjs/execution/EVMStepExecutor.js +271 -0
- package/dist/cjs/execution/EVMStepExecutor.js.map +1 -0
- package/dist/cjs/execution/RouteExecutionManager.js +196 -179
- package/dist/cjs/execution/RouteExecutionManager.js.map +1 -0
- package/dist/cjs/execution/StatusManager.js +142 -135
- package/dist/cjs/execution/StatusManager.js.map +1 -0
- package/dist/cjs/execution/StepExecutionManager.js +223 -229
- package/dist/cjs/execution/StepExecutionManager.js.map +1 -0
- package/dist/cjs/execution/checkAllowance.js +9 -10
- package/dist/cjs/execution/checkAllowance.js.map +1 -0
- package/dist/cjs/execution/checkBalance.js +5 -5
- package/dist/cjs/execution/checkBalance.js.map +1 -0
- package/dist/cjs/execution/index.js +4 -15
- package/dist/cjs/execution/index.js.map +1 -0
- package/dist/cjs/execution/multisig.js +6 -8
- package/dist/cjs/execution/multisig.js.map +1 -0
- package/dist/cjs/execution/prepareRestart.js +2 -44
- package/dist/cjs/execution/prepareRestart.js.map +1 -0
- package/dist/cjs/execution/stepComparison.js +5 -17
- package/dist/cjs/execution/stepComparison.js.map +1 -0
- package/dist/cjs/execution/switchChain.js +4 -21
- package/dist/cjs/execution/switchChain.js.map +1 -0
- package/dist/cjs/{types/internal.types.js → execution/types.js} +1 -0
- package/dist/cjs/execution/types.js.map +1 -0
- package/dist/cjs/execution/utils.js +1 -9
- package/dist/cjs/execution/utils.js.map +1 -0
- package/dist/cjs/execution/waitForReceivingTransaction.js +9 -11
- package/dist/cjs/execution/waitForReceivingTransaction.js.map +1 -0
- package/dist/cjs/helpers.js +11 -25
- package/dist/cjs/helpers.js.map +1 -0
- package/dist/cjs/index.js +16 -22
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/providers/EVM.js +35 -0
- package/dist/cjs/providers/EVM.js.map +1 -0
- package/dist/cjs/providers/Solana.js +38 -0
- package/dist/cjs/providers/Solana.js.map +1 -0
- package/dist/cjs/providers/index.js +5 -0
- package/dist/cjs/providers/index.js.map +1 -0
- package/dist/cjs/providers/types.js +9 -0
- package/dist/cjs/providers/types.js.map +1 -0
- package/dist/cjs/request.js +19 -16
- package/dist/cjs/request.js.map +1 -0
- package/dist/cjs/services/ApiService.js +72 -90
- package/dist/cjs/services/ApiService.js.map +1 -0
- package/dist/cjs/services/ChainsService.js +19 -9
- package/dist/cjs/services/ChainsService.js.map +1 -0
- package/dist/cjs/services/ConfigService.js +94 -65
- package/dist/cjs/services/ConfigService.js.map +1 -0
- package/dist/cjs/typeguards.js +1 -0
- package/dist/cjs/typeguards.js.map +1 -0
- package/dist/cjs/types/abi.js +1 -0
- package/dist/cjs/types/abi.js.map +1 -0
- package/dist/cjs/types/index.js +4 -20
- package/dist/cjs/types/index.js.map +1 -0
- package/dist/cjs/types/internal.js +3 -0
- package/dist/cjs/types/internal.js.map +1 -0
- package/dist/cjs/utils/errors.js +25 -3
- package/dist/cjs/utils/errors.js.map +1 -0
- package/dist/cjs/utils/getMaxPriorityFeePerGas.js +3 -2
- package/dist/cjs/utils/getMaxPriorityFeePerGas.js.map +1 -0
- package/dist/cjs/utils/index.js +7 -19
- package/dist/cjs/utils/index.js.map +1 -0
- package/dist/cjs/utils/median.js +1 -0
- package/dist/cjs/utils/median.js.map +1 -0
- package/dist/cjs/utils/parseError.js +39 -79
- package/dist/cjs/utils/parseError.js.map +1 -0
- package/dist/cjs/utils/utils.js +5 -11
- package/dist/cjs/utils/utils.js.map +1 -0
- package/dist/cjs/version.js +2 -1
- package/dist/cjs/version.js.map +1 -0
- package/dist/esm/LiFi.js +375 -0
- package/dist/esm/LiFi.js.map +1 -0
- package/dist/{allowance → esm/allowance}/getAllowance.js +5 -4
- package/dist/esm/allowance/getAllowance.js.map +1 -0
- package/dist/esm/allowance/index.js +4 -0
- package/dist/esm/allowance/index.js.map +1 -0
- package/dist/{allowance → esm/allowance}/setAllowance.js +28 -11
- package/dist/esm/allowance/setAllowance.js.map +1 -0
- package/dist/esm/allowance/types.js +2 -0
- package/dist/esm/allowance/types.js.map +1 -0
- package/dist/{balance → esm/balance}/getBalance.js +5 -5
- package/dist/esm/balance/getBalance.js.map +1 -0
- package/dist/{balance → esm/balance}/getTokenBalance.js +2 -1
- package/dist/esm/balance/getTokenBalance.js.map +1 -0
- package/dist/esm/balance/index.js +3 -0
- package/dist/esm/balance/index.js.map +1 -0
- package/dist/{connectors.js → esm/connectors.js} +3 -2
- package/dist/esm/connectors.js.map +1 -0
- package/dist/{constants.js → esm/constants.js} +1 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/execution/BaseStepExecutor.js +51 -0
- package/dist/esm/execution/BaseStepExecutor.js.map +1 -0
- package/dist/esm/execution/EVMStepExecutor.js +299 -0
- package/dist/esm/execution/EVMStepExecutor.js.map +1 -0
- package/dist/esm/execution/RouteExecutionManager.js +268 -0
- package/dist/esm/execution/RouteExecutionManager.js.map +1 -0
- package/dist/esm/execution/StatusManager.js +216 -0
- package/dist/esm/execution/StatusManager.js.map +1 -0
- package/dist/esm/execution/StepExecutionManager.js +280 -0
- package/dist/esm/execution/StepExecutionManager.js.map +1 -0
- package/dist/{execution → esm/execution}/checkAllowance.js +5 -4
- package/dist/esm/execution/checkAllowance.js.map +1 -0
- package/dist/{execution → esm/execution}/checkBalance.js +3 -2
- package/dist/esm/execution/checkBalance.js.map +1 -0
- package/dist/esm/execution/index.js +3 -0
- package/dist/esm/execution/index.js.map +1 -0
- package/dist/{execution → esm/execution}/multisig.js +3 -2
- package/dist/esm/execution/multisig.js.map +1 -0
- package/dist/esm/execution/prepareRestart.js +64 -0
- package/dist/esm/execution/prepareRestart.js.map +1 -0
- package/dist/{execution → esm/execution}/stepComparison.js +4 -3
- package/dist/esm/execution/stepComparison.js.map +1 -0
- package/dist/{execution → esm/execution}/switchChain.js +3 -1
- package/dist/esm/execution/switchChain.js.map +1 -0
- package/dist/esm/execution/types.js +2 -0
- package/dist/esm/execution/types.js.map +1 -0
- package/dist/{execution → esm/execution}/utils.js +1 -0
- package/dist/esm/execution/utils.js.map +1 -0
- package/dist/{execution → esm/execution}/waitForReceivingTransaction.js +5 -4
- package/dist/esm/execution/waitForReceivingTransaction.js.map +1 -0
- package/dist/{helpers.js → esm/helpers.js} +4 -3
- package/dist/esm/helpers.js.map +1 -0
- package/dist/esm/index.js +10 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/providers/EVM.js +30 -0
- package/dist/esm/providers/EVM.js.map +1 -0
- package/dist/esm/providers/Solana.js +34 -0
- package/dist/esm/providers/Solana.js.map +1 -0
- package/dist/esm/providers/index.js +2 -0
- package/dist/esm/providers/index.js.map +1 -0
- package/dist/esm/providers/types.js +6 -0
- package/dist/esm/providers/types.js.map +1 -0
- package/dist/{request.js → esm/request.js} +16 -9
- package/dist/esm/request.js.map +1 -0
- package/dist/{services → esm/services}/ApiService.js +29 -28
- package/dist/esm/services/ApiService.js.map +1 -0
- package/dist/{services → esm/services}/ChainsService.js +16 -4
- package/dist/esm/services/ChainsService.js.map +1 -0
- package/dist/esm/services/ConfigService.js +143 -0
- package/dist/esm/services/ConfigService.js.map +1 -0
- package/dist/{typeguards.js → esm/typeguards.js} +1 -0
- package/dist/esm/typeguards.js.map +1 -0
- package/dist/{types → esm/types}/abi.js +1 -0
- package/dist/esm/types/abi.js.map +1 -0
- package/dist/esm/types/index.js +3 -0
- package/dist/esm/types/index.js.map +1 -0
- package/dist/esm/types/internal.js +2 -0
- package/dist/esm/types/internal.js.map +1 -0
- package/dist/{utils → esm/utils}/errors.js +25 -0
- package/dist/esm/utils/errors.js.map +1 -0
- package/dist/{utils → esm/utils}/getMaxPriorityFeePerGas.js +2 -1
- package/dist/esm/utils/getMaxPriorityFeePerGas.js.map +1 -0
- package/dist/esm/utils/index.js +6 -0
- package/dist/esm/utils/index.js.map +1 -0
- package/dist/{utils → esm/utils}/median.js +1 -0
- package/dist/esm/utils/median.js.map +1 -0
- package/dist/{utils → esm/utils}/parseError.js +4 -3
- package/dist/esm/utils/parseError.js.map +1 -0
- package/dist/{utils → esm/utils}/utils.js +2 -1
- package/dist/esm/utils/utils.js.map +1 -0
- package/dist/esm/version.js +3 -0
- package/dist/esm/version.js.map +1 -0
- package/dist/{LiFi.d.ts → types/LiFi.d.ts} +29 -21
- package/dist/types/LiFi.d.ts.map +1 -0
- package/dist/{cjs → types}/allowance/getAllowance.d.ts +2 -1
- package/dist/types/allowance/getAllowance.d.ts.map +1 -0
- package/dist/types/allowance/index.d.ts +4 -0
- package/dist/types/allowance/index.d.ts.map +1 -0
- package/dist/types/allowance/setAllowance.d.ts +7 -0
- package/dist/types/allowance/setAllowance.d.ts.map +1 -0
- package/dist/{allowance → types/allowance}/types.d.ts +1 -0
- package/dist/types/allowance/types.d.ts.map +1 -0
- package/dist/{balance → types/balance}/getBalance.d.ts +1 -0
- package/dist/types/balance/getBalance.d.ts.map +1 -0
- package/dist/{balance → types/balance}/getTokenBalance.d.ts +1 -0
- package/dist/types/balance/getTokenBalance.d.ts.map +1 -0
- package/dist/types/balance/index.d.ts +3 -0
- package/dist/types/balance/index.d.ts.map +1 -0
- package/dist/{cjs → types}/connectors.d.ts +2 -1
- package/dist/types/connectors.d.ts.map +1 -0
- package/dist/{cjs → types}/constants.d.ts +1 -0
- package/dist/types/constants.d.ts.map +1 -0
- package/dist/types/execution/BaseStepExecutor.d.ts +13 -0
- package/dist/types/execution/BaseStepExecutor.d.ts.map +1 -0
- package/dist/types/execution/EVMStepExecutor.d.ts +14 -0
- package/dist/types/execution/EVMStepExecutor.d.ts.map +1 -0
- package/dist/{cjs → types}/execution/RouteExecutionManager.d.ts +10 -8
- package/dist/types/execution/RouteExecutionManager.d.ts.map +1 -0
- package/dist/{execution → types/execution}/StatusManager.d.ts +9 -7
- package/dist/types/execution/StatusManager.d.ts.map +1 -0
- package/dist/{execution → types/execution}/StepExecutionManager.d.ts +4 -3
- package/dist/types/execution/StepExecutionManager.d.ts.map +1 -0
- package/dist/types/execution/checkAllowance.d.ts +6 -0
- package/dist/types/execution/checkAllowance.d.ts.map +1 -0
- package/dist/types/execution/checkBalance.d.ts +3 -0
- package/dist/types/execution/checkBalance.d.ts.map +1 -0
- package/dist/types/execution/index.d.ts +3 -0
- package/dist/types/execution/index.d.ts.map +1 -0
- package/dist/types/execution/multisig.d.ts +5 -0
- package/dist/types/execution/multisig.d.ts.map +1 -0
- package/dist/types/execution/prepareRestart.d.ts +3 -0
- package/dist/types/execution/prepareRestart.d.ts.map +1 -0
- package/dist/{cjs → types}/execution/stepComparison.d.ts +6 -4
- package/dist/types/execution/stepComparison.d.ts.map +1 -0
- package/dist/{cjs → types}/execution/switchChain.d.ts +6 -4
- package/dist/types/execution/switchChain.d.ts.map +1 -0
- package/dist/types/{internal.types.d.ts → execution/types.d.ts} +38 -98
- package/dist/types/execution/types.d.ts.map +1 -0
- package/dist/{execution → types/execution}/utils.d.ts +3 -2
- package/dist/types/execution/utils.d.ts.map +1 -0
- package/dist/types/execution/waitForReceivingTransaction.d.ts +4 -0
- package/dist/types/execution/waitForReceivingTransaction.d.ts.map +1 -0
- package/dist/{helpers.d.ts → types/helpers.d.ts} +4 -3
- package/dist/types/helpers.d.ts.map +1 -0
- package/dist/types/index.d.ts +9 -3
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/providers/EVM.d.ts +11 -0
- package/dist/types/providers/EVM.d.ts.map +1 -0
- package/dist/types/providers/Solana.d.ts +10 -0
- package/dist/types/providers/Solana.d.ts.map +1 -0
- package/dist/types/providers/index.d.ts +2 -0
- package/dist/types/providers/index.d.ts.map +1 -0
- package/dist/types/providers/types.d.ts +13 -0
- package/dist/types/providers/types.d.ts.map +1 -0
- package/dist/{request.d.ts → types/request.d.ts} +1 -0
- package/dist/types/request.d.ts.map +1 -0
- package/dist/{services → types/services}/ApiService.d.ts +5 -5
- package/dist/types/services/ApiService.d.ts.map +1 -0
- package/dist/{cjs → types}/services/ChainsService.d.ts +2 -1
- package/dist/types/services/ChainsService.d.ts.map +1 -0
- package/dist/{services → types/services}/ConfigService.d.ts +10 -6
- package/dist/types/services/ConfigService.d.ts.map +1 -0
- package/dist/{cjs → types}/typeguards.d.ts +3 -2
- package/dist/types/typeguards.d.ts.map +1 -0
- package/dist/{cjs → types}/types/abi.d.ts +1 -0
- package/dist/types/types/abi.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +3 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/dist/types/types/internal.d.ts +61 -0
- package/dist/types/types/internal.d.ts.map +1 -0
- package/dist/{cjs → types}/utils/errors.d.ts +1 -0
- package/dist/types/utils/errors.d.ts.map +1 -0
- package/dist/{cjs → types}/utils/getMaxPriorityFeePerGas.d.ts +1 -0
- package/dist/types/utils/getMaxPriorityFeePerGas.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +6 -0
- package/dist/types/utils/index.d.ts.map +1 -0
- package/dist/{cjs → types}/utils/median.d.ts +1 -0
- package/dist/types/utils/median.d.ts.map +1 -0
- package/dist/{cjs → types}/utils/parseError.d.ts +6 -5
- package/dist/types/utils/parseError.d.ts.map +1 -0
- package/dist/{cjs → types}/utils/utils.d.ts +1 -0
- package/dist/types/utils/utils.d.ts.map +1 -0
- package/dist/types/version.d.ts +3 -0
- package/dist/types/version.d.ts.map +1 -0
- package/package.json +37 -96
- package/dist/LiFi.js +0 -246
- package/dist/allowance/getAllowance.d.ts +0 -6
- package/dist/allowance/index.d.ts +0 -3
- package/dist/allowance/index.js +0 -3
- package/dist/allowance/setAllowance.d.ts +0 -5
- package/dist/allowance/types.js +0 -1
- package/dist/balance/index.d.ts +0 -2
- package/dist/balance/index.js +0 -2
- package/dist/cjs/LiFi.d.ts +0 -171
- package/dist/cjs/allowance/index.d.ts +0 -3
- package/dist/cjs/allowance/setAllowance.d.ts +0 -5
- package/dist/cjs/allowance/types.d.ts +0 -27
- package/dist/cjs/balance/getBalance.d.ts +0 -2
- package/dist/cjs/balance/getTokenBalance.d.ts +0 -8
- package/dist/cjs/balance/index.d.ts +0 -2
- package/dist/cjs/execution/StatusManager.d.ts +0 -67
- package/dist/cjs/execution/StepExecutionManager.d.ts +0 -7
- package/dist/cjs/execution/StepExecutor.d.ts +0 -15
- package/dist/cjs/execution/StepExecutor.js +0 -62
- package/dist/cjs/execution/checkAllowance.d.ts +0 -4
- package/dist/cjs/execution/checkBalance.d.ts +0 -2
- package/dist/cjs/execution/index.d.ts +0 -1
- package/dist/cjs/execution/multisig.d.ts +0 -4
- package/dist/cjs/execution/prepareRestart.d.ts +0 -3
- package/dist/cjs/execution/utils.d.ts +0 -12
- package/dist/cjs/execution/waitForReceivingTransaction.d.ts +0 -3
- package/dist/cjs/helpers.d.ts +0 -18
- package/dist/cjs/index.d.ts +0 -5
- package/dist/cjs/request.d.ts +0 -9
- package/dist/cjs/services/ApiService.d.ts +0 -17
- package/dist/cjs/services/ConfigService.d.ts +0 -23
- package/dist/cjs/types/index.d.ts +0 -4
- package/dist/cjs/types/internal.types.d.ts +0 -143
- package/dist/cjs/utils/index.d.ts +0 -5
- package/dist/cjs/version.d.ts +0 -2
- package/dist/connectors.d.ts +0 -8
- package/dist/constants.d.ts +0 -6
- package/dist/execution/RouteExecutionManager.d.ts +0 -59
- package/dist/execution/RouteExecutionManager.js +0 -195
- package/dist/execution/StatusManager.js +0 -167
- package/dist/execution/StepExecutionManager.js +0 -260
- package/dist/execution/StepExecutor.d.ts +0 -15
- package/dist/execution/StepExecutor.js +0 -58
- package/dist/execution/checkAllowance.d.ts +0 -4
- package/dist/execution/checkBalance.d.ts +0 -2
- package/dist/execution/index.d.ts +0 -1
- package/dist/execution/index.js +0 -1
- package/dist/execution/multisig.d.ts +0 -4
- package/dist/execution/prepareRestart.d.ts +0 -3
- package/dist/execution/prepareRestart.js +0 -61
- package/dist/execution/stepComparison.d.ts +0 -14
- package/dist/execution/switchChain.d.ts +0 -21
- package/dist/execution/waitForReceivingTransaction.d.ts +0 -3
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -6
- package/dist/services/ChainsService.d.ts +0 -11
- package/dist/services/ConfigService.js +0 -99
- package/dist/typeguards.d.ts +0 -4
- package/dist/types/abi.d.ts +0 -5
- package/dist/types/index.js +0 -4
- package/dist/types/internal.types.js +0 -1
- package/dist/utils/errors.d.ts +0 -107
- package/dist/utils/getMaxPriorityFeePerGas.d.ts +0 -2
- package/dist/utils/index.d.ts +0 -5
- package/dist/utils/index.js +0 -5
- package/dist/utils/median.d.ts +0 -1
- package/dist/utils/parseError.d.ts +0 -37
- package/dist/utils/utils.d.ts +0 -10
- package/dist/version.d.ts +0 -2
- package/dist/version.js +0 -2
|
@@ -1,155 +1,161 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StatusManager = void 0;
|
|
4
|
-
const types_1 = require("
|
|
5
|
-
const
|
|
6
|
-
/**
|
|
7
|
-
* Manages status updates of a route and provides various functions for tracking processes
|
|
8
|
-
* @param {Route} route The route this StatusManger belongs to.
|
|
9
|
-
* @param {InternalExecutionSettings} settings The ExecutionSettings for this route.
|
|
10
|
-
* @param {InternalUpdateRouteCallback} internalUpdateRouteCallback Internal callback to propage route changes.
|
|
11
|
-
* @returns {StatusManager} An instance of StatusManager.
|
|
12
|
-
*/
|
|
4
|
+
const types_1 = require("@lifi/types");
|
|
5
|
+
const utils_js_1 = require("./utils.js");
|
|
13
6
|
class StatusManager {
|
|
14
7
|
constructor(route, settings, internalUpdateRouteCallback) {
|
|
15
|
-
this
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if (status && process.status !== status) {
|
|
49
|
-
process.status = status;
|
|
8
|
+
Object.defineProperty(this, "route", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
configurable: true,
|
|
11
|
+
writable: true,
|
|
12
|
+
value: void 0
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(this, "settings", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
configurable: true,
|
|
17
|
+
writable: true,
|
|
18
|
+
value: void 0
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(this, "internalUpdateRouteCallback", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
configurable: true,
|
|
23
|
+
writable: true,
|
|
24
|
+
value: void 0
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(this, "shouldUpdate", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
configurable: true,
|
|
29
|
+
writable: true,
|
|
30
|
+
value: true
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(this, "initExecutionObject", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
configurable: true,
|
|
35
|
+
writable: true,
|
|
36
|
+
value: (step) => {
|
|
37
|
+
const currentExecution = step.execution || structuredClone(types_1.emptyExecution);
|
|
38
|
+
if (!step.execution) {
|
|
39
|
+
step.execution = currentExecution;
|
|
40
|
+
step.execution.status = 'PENDING';
|
|
50
41
|
this.updateStepInRoute(step);
|
|
51
42
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
message: (0, utils_1.getProcessMessage)(type, status ?? 'STARTED'),
|
|
58
|
-
status: status ?? 'STARTED',
|
|
59
|
-
};
|
|
60
|
-
step.execution.process.push(newProcess);
|
|
61
|
-
this.updateStepInRoute(step);
|
|
62
|
-
return newProcess;
|
|
63
|
-
};
|
|
64
|
-
/**
|
|
65
|
-
* Update a process object.
|
|
66
|
-
* @param step The step where the process should be updated
|
|
67
|
-
* @param type The process type to update
|
|
68
|
-
* @param status The status the process gets.
|
|
69
|
-
* @param [params] Additional parameters to append to the process.
|
|
70
|
-
* @returns The update process
|
|
71
|
-
*/
|
|
72
|
-
this.updateProcess = (step, type, status, params) => {
|
|
73
|
-
if (!step.execution) {
|
|
74
|
-
throw new Error("Can't update an empty step execution.");
|
|
75
|
-
}
|
|
76
|
-
const currentProcess = step?.execution?.process.find((p) => p.type === type);
|
|
77
|
-
if (!currentProcess) {
|
|
78
|
-
throw new Error("Can't find a process for the given type.");
|
|
79
|
-
}
|
|
80
|
-
switch (status) {
|
|
81
|
-
case 'CANCELLED':
|
|
82
|
-
currentProcess.doneAt = Date.now();
|
|
83
|
-
break;
|
|
84
|
-
case 'FAILED':
|
|
85
|
-
currentProcess.doneAt = Date.now();
|
|
86
|
-
step.execution.status = 'FAILED';
|
|
87
|
-
break;
|
|
88
|
-
case 'DONE':
|
|
89
|
-
currentProcess.doneAt = Date.now();
|
|
90
|
-
break;
|
|
91
|
-
case 'PENDING':
|
|
92
|
-
step.execution.status = 'PENDING';
|
|
93
|
-
break;
|
|
94
|
-
case 'ACTION_REQUIRED':
|
|
95
|
-
step.execution.status = 'ACTION_REQUIRED';
|
|
96
|
-
break;
|
|
97
|
-
default:
|
|
98
|
-
break;
|
|
43
|
+
if (currentExecution.status === 'FAILED') {
|
|
44
|
+
currentExecution.status = 'PENDING';
|
|
45
|
+
this.updateStepInRoute(step);
|
|
46
|
+
}
|
|
47
|
+
return currentExecution;
|
|
99
48
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
49
|
+
});
|
|
50
|
+
Object.defineProperty(this, "findOrCreateProcess", {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
configurable: true,
|
|
53
|
+
writable: true,
|
|
54
|
+
value: (step, type, status) => {
|
|
55
|
+
if (!step.execution?.process) {
|
|
56
|
+
throw new Error("Execution hasn't been initialized.");
|
|
57
|
+
}
|
|
58
|
+
const process = step.execution.process.find((p) => p.type === type);
|
|
59
|
+
if (process) {
|
|
60
|
+
if (status && process.status !== status) {
|
|
61
|
+
process.status = status;
|
|
62
|
+
this.updateStepInRoute(step);
|
|
63
|
+
}
|
|
64
|
+
return process;
|
|
106
65
|
}
|
|
66
|
+
const newProcess = {
|
|
67
|
+
type: type,
|
|
68
|
+
startedAt: Date.now(),
|
|
69
|
+
message: (0, utils_js_1.getProcessMessage)(type, status ?? 'STARTED'),
|
|
70
|
+
status: status ?? 'STARTED',
|
|
71
|
+
};
|
|
72
|
+
step.execution.process.push(newProcess);
|
|
73
|
+
this.updateStepInRoute(step);
|
|
74
|
+
return newProcess;
|
|
107
75
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
76
|
+
});
|
|
77
|
+
Object.defineProperty(this, "updateProcess", {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
configurable: true,
|
|
80
|
+
writable: true,
|
|
81
|
+
value: (step, type, status, params) => {
|
|
82
|
+
if (!step.execution) {
|
|
83
|
+
throw new Error("Can't update an empty step execution.");
|
|
84
|
+
}
|
|
85
|
+
const currentProcess = step?.execution?.process.find((p) => p.type === type);
|
|
86
|
+
if (!currentProcess) {
|
|
87
|
+
throw new Error("Can't find a process for the given type.");
|
|
88
|
+
}
|
|
89
|
+
switch (status) {
|
|
90
|
+
case 'CANCELLED':
|
|
91
|
+
currentProcess.doneAt = Date.now();
|
|
92
|
+
break;
|
|
93
|
+
case 'FAILED':
|
|
94
|
+
currentProcess.doneAt = Date.now();
|
|
95
|
+
step.execution.status = 'FAILED';
|
|
96
|
+
break;
|
|
97
|
+
case 'DONE':
|
|
98
|
+
currentProcess.doneAt = Date.now();
|
|
99
|
+
break;
|
|
100
|
+
case 'PENDING':
|
|
101
|
+
step.execution.status = 'PENDING';
|
|
102
|
+
break;
|
|
103
|
+
case 'ACTION_REQUIRED':
|
|
104
|
+
step.execution.status = 'ACTION_REQUIRED';
|
|
105
|
+
break;
|
|
106
|
+
default:
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
currentProcess.status = status;
|
|
110
|
+
currentProcess.message = (0, utils_js_1.getProcessMessage)(type, status);
|
|
111
|
+
if (params) {
|
|
112
|
+
for (const [key, value] of Object.entries(params)) {
|
|
113
|
+
currentProcess[key] = value;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
step.execution.process = [
|
|
117
|
+
...step?.execution?.process.filter((process) => process.status === 'DONE'),
|
|
118
|
+
...step?.execution?.process.filter((process) => process.status !== 'DONE'),
|
|
119
|
+
];
|
|
120
|
+
this.updateStepInRoute(step);
|
|
121
|
+
return currentProcess;
|
|
124
122
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
123
|
+
});
|
|
124
|
+
Object.defineProperty(this, "removeProcess", {
|
|
125
|
+
enumerable: true,
|
|
126
|
+
configurable: true,
|
|
127
|
+
writable: true,
|
|
128
|
+
value: (step, type) => {
|
|
129
|
+
if (!step.execution) {
|
|
130
|
+
throw new Error("Execution hasn't been initialized.");
|
|
131
|
+
}
|
|
132
|
+
const index = step.execution.process.findIndex((p) => p.type === type);
|
|
133
|
+
step.execution.process.splice(index, 1);
|
|
134
|
+
this.updateStepInRoute(step);
|
|
132
135
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
+
});
|
|
137
|
+
Object.defineProperty(this, "updateStepInRoute", {
|
|
138
|
+
enumerable: true,
|
|
139
|
+
configurable: true,
|
|
140
|
+
writable: true,
|
|
141
|
+
value: (step) => {
|
|
142
|
+
if (!this.shouldUpdate) {
|
|
143
|
+
return step;
|
|
144
|
+
}
|
|
145
|
+
const stepIndex = this.route.steps.findIndex((routeStep) => routeStep.id === step.id);
|
|
146
|
+
if (stepIndex === -1) {
|
|
147
|
+
throw new Error("Couldn't find a step to update.");
|
|
148
|
+
}
|
|
149
|
+
this.route.steps[stepIndex] = Object.assign(this.route.steps[stepIndex], step);
|
|
150
|
+
this.settings.updateRouteHook(this.route);
|
|
151
|
+
this.internalUpdateRouteCallback(this.route);
|
|
152
|
+
return this.route.steps[stepIndex];
|
|
136
153
|
}
|
|
137
|
-
|
|
138
|
-
this.settings.updateRouteHook(this.route);
|
|
139
|
-
this.internalUpdateRouteCallback(this.route);
|
|
140
|
-
return this.route.steps[stepIndex];
|
|
141
|
-
};
|
|
154
|
+
});
|
|
142
155
|
this.route = route;
|
|
143
156
|
this.settings = settings;
|
|
144
157
|
this.internalUpdateRouteCallback = internalUpdateRouteCallback;
|
|
145
158
|
}
|
|
146
|
-
/**
|
|
147
|
-
* Updates the execution object of a Step.
|
|
148
|
-
* @param step The current step in execution
|
|
149
|
-
* @param status The status for the execution
|
|
150
|
-
* @param receipt Optional. Information about received tokens
|
|
151
|
-
* @returns The step with the updated execution object
|
|
152
|
-
*/
|
|
153
159
|
updateExecution(step, status, receipt) {
|
|
154
160
|
if (!step.execution) {
|
|
155
161
|
throw Error("Can't update empty execution.");
|
|
@@ -169,3 +175,4 @@ class StatusManager {
|
|
|
169
175
|
}
|
|
170
176
|
}
|
|
171
177
|
exports.StatusManager = StatusManager;
|
|
178
|
+
//# sourceMappingURL=StatusManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatusManager.js","sourceRoot":"","sources":["../../../src/execution/StatusManager.ts"],"names":[],"mappings":";;;AASA,uCAA4C;AAE5C,yCAA8C;AAoC9C,MAAa,aAAa;IAMxB,YACE,KAAY,EACZ,QAAmC,EACnC,2BAAwD;QARzC;;;;;WAAY;QACZ;;;;;WAAmC;QACnC;;;;;WAAwD;QACjE;;;;mBAAe,IAAI;WAAA;QAiB3B;;;;mBAAsB,CAAC,IAAc,EAAa,EAAE;gBAClD,MAAM,gBAAgB,GACpB,IAAI,CAAC,SAAS,IAAI,eAAe,CAAY,sBAAc,CAAC,CAAA;gBAE9D,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;oBACnB,IAAI,CAAC,SAAS,GAAG,gBAAgB,CAAA;oBACjC,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,SAAS,CAAA;oBACjC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAA;iBAC7B;gBAGD,IAAI,gBAAgB,CAAC,MAAM,KAAK,QAAQ,EAAE;oBACxC,gBAAgB,CAAC,MAAM,GAAG,SAAS,CAAA;oBACnC,IAAI,CAAC,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