@airgap/coinlib-core 0.13.45-beta.3 → 0.13.45-beta.5
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/actions/Action.js +83 -30
- package/actions/Action.js.map +1 -1
- package/actions/LinkedAction.js +82 -18
- package/actions/LinkedAction.js.map +1 -1
- package/actions/RepeatableAction.js +83 -20
- package/actions/RepeatableAction.js.map +1 -1
- package/actions/SimpleAction.js +74 -12
- package/actions/SimpleAction.js.map +1 -1
- package/actions/StateMachine.js +17 -16
- package/actions/StateMachine.js.map +1 -1
- package/data/KeyPair.d.ts +1 -0
- package/data/Lazy.js +64 -15
- package/data/Lazy.js.map +1 -1
- package/data/RPCBody.js +6 -3
- package/data/RPCBody.js.map +1 -1
- package/dependencies/src/@stablelib/binary-1.0.1/packages/binary/binary.d.ts +12 -12
- package/dependencies/src/@stablelib/binary-1.0.1/packages/binary/binary.js +130 -88
- package/dependencies/src/@stablelib/binary-1.0.1/packages/binary/binary.js.map +1 -1
- package/dependencies/src/@stablelib/blake2b-1.0.1/packages/blake2b/blake2b.d.ts +3 -3
- package/dependencies/src/@stablelib/blake2b-1.0.1/packages/blake2b/blake2b.js +61 -57
- package/dependencies/src/@stablelib/blake2b-1.0.1/packages/blake2b/blake2b.js.map +1 -1
- package/dependencies/src/@stablelib/ed25519-1.0.3/packages/ed25519/ed25519.js +96 -96
- package/dependencies/src/@stablelib/ed25519-1.0.3/packages/ed25519/ed25519.js.map +1 -1
- package/dependencies/src/@stablelib/hash-1.0.1/packages/hash/hash.js +2 -1
- package/dependencies/src/@stablelib/hash-1.0.1/packages/hash/hash.js.map +1 -1
- package/dependencies/src/@stablelib/int-1.0.1/packages/int/int.js +10 -8
- package/dependencies/src/@stablelib/int-1.0.1/packages/int/int.js.map +1 -1
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/random.js +28 -22
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/random.js.map +1 -1
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/browser.js +10 -9
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/browser.js.map +1 -1
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/node.js +11 -10
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/node.js.map +1 -1
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/system.js +8 -7
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/system.js.map +1 -1
- package/dependencies/src/@stablelib/sha512/packages/sha512/sha512.d.ts +3 -3
- package/dependencies/src/@stablelib/sha512/packages/sha512/sha512.js +63 -61
- package/dependencies/src/@stablelib/sha512/packages/sha512/sha512.js.map +1 -1
- package/dependencies/src/@stablelib/sha512-1.0.1/packages/sha512/sha512.d.ts +4 -4
- package/dependencies/src/@stablelib/sha512-1.0.1/packages/sha512/sha512.js +63 -61
- package/dependencies/src/@stablelib/sha512-1.0.1/packages/sha512/sha512.js.map +1 -1
- package/dependencies/src/@stablelib/wipe-1.0.1/packages/wipe/wipe.d.ts +1 -1
- package/dependencies/src/@stablelib/wipe-1.0.1/packages/wipe/wipe.js +3 -2
- package/dependencies/src/@stablelib/wipe-1.0.1/packages/wipe/wipe.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/codec.js +111 -111
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/codec.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/constants.js +15 -15
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/constants.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/decoder.d.ts +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/decoder.js +76 -47
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/decoder.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/encoder.d.ts +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/encoder.js +61 -46
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/encoder.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/error.js +106 -61
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/error.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/interface.d.ts +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/michelson/codec.d.ts +6 -6
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/michelson/codec.js +100 -95
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/michelson/codec.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/codec-proto14.js +33 -33
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/codec-proto14.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/constants-proto14.js +9 -9
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/constants-proto14.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/decoder-proto14.d.ts +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/decoder-proto14.js +75 -46
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/decoder-proto14.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/encoder-proto14.d.ts +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/encoder-proto14.js +70 -45
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/encoder-proto14.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/michelson/codec-proto14.js +41 -41
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/michelson/codec-proto14.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/protocols.js +4 -4
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/protocols.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/schema/operation.d.ts +2 -2
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/schema/operation.js +63 -58
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/schema/operation.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/taquito-local-forging.js +33 -30
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/taquito-local-forging.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/uint8array-consumer.js +20 -18
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/uint8array-consumer.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/utils.d.ts +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/utils.js +12 -5
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/utils.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/validator.js +13 -13
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/validator.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/opkind.js +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/opkind.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/types.d.ts +78 -78
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/types.js +2 -2
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/types.js.map +1 -1
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/constants.d.ts +45 -45
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/constants.js +76 -75
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/constants.js.map +1 -1
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/errors.js +178 -115
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/errors.js.map +1 -1
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/format.d.ts +1 -1
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/format.js +9 -6
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/format.js.map +1 -1
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/taquito-utils.js +83 -78
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/taquito-utils.js.map +1 -1
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/validators.js +36 -27
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/validators.js.map +1 -1
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/verify-signature.d.ts +1 -1
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/verify-signature.js +26 -25
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/verify-signature.js.map +1 -1
- package/dependencies/src/cosmjs/index.d.ts +230 -14
- package/dependencies/src/cosmjs/index.js +480 -373
- package/dependencies/src/cosmjs/index.js.map +1 -1
- package/dependencies/src/eciesjs-0.3.9/src/index.d.ts +1 -0
- package/dependencies/src/eciesjs-0.3.9/src/index.js +19 -15
- package/dependencies/src/eciesjs-0.3.9/src/index.js.map +1 -1
- package/dependencies/src/eciesjs-0.3.9/src/keys/PrivateKey.d.ts +1 -0
- package/dependencies/src/eciesjs-0.3.9/src/keys/PrivateKey.js +28 -37
- package/dependencies/src/eciesjs-0.3.9/src/keys/PrivateKey.js.map +1 -1
- package/dependencies/src/eciesjs-0.3.9/src/keys/PublicKey.d.ts +1 -0
- package/dependencies/src/eciesjs-0.3.9/src/keys/PublicKey.js +30 -38
- package/dependencies/src/eciesjs-0.3.9/src/keys/PublicKey.js.map +1 -1
- package/dependencies/src/eciesjs-0.3.9/src/utils.d.ts +1 -0
- package/dependencies/src/eciesjs-0.3.9/src/utils.js +24 -33
- package/dependencies/src/eciesjs-0.3.9/src/utils.js.map +1 -1
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-key.js +34 -42
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-key.js.map +1 -1
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-wallet.js +10 -6
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-wallet.js.map +1 -1
- package/errors/coinlib-error.d.ts +2 -1
- package/errors/coinlib-error.js +38 -16
- package/errors/coinlib-error.js.map +1 -1
- package/errors/index.d.ts +2 -2
- package/errors/index.js +148 -89
- package/errors/index.js.map +1 -1
- package/index.js +19 -19
- package/index.js.map +1 -1
- package/interfaces/IAirGapSignedTransaction.d.ts +1 -1
- package/interfaces/IAirGapTransaction.js +3 -3
- package/interfaces/IAirGapTransaction.js.map +1 -1
- package/networks.js +9 -9
- package/networks.js.map +1 -1
- package/package.json +1 -1
- package/protocols/BlockExplorerProtocol.js +54 -7
- package/protocols/BlockExplorerProtocol.js.map +1 -1
- package/protocols/CryptoClient.js +78 -19
- package/protocols/CryptoClient.js.map +1 -1
- package/protocols/Ed25519CryptoClient.js +98 -30
- package/protocols/Ed25519CryptoClient.js.map +1 -1
- package/protocols/ICoinSubProtocol.js +1 -1
- package/protocols/ICoinSubProtocol.js.map +1 -1
- package/protocols/NonExtendedProtocol.js +29 -26
- package/protocols/NonExtendedProtocol.js.map +1 -1
- package/protocols/Secp256k1CryptoClient.js +73 -9
- package/protocols/Secp256k1CryptoClient.js.map +1 -1
- package/protocols/Sr25519CryptoClient.js +76 -12
- package/protocols/Sr25519CryptoClient.js.map +1 -1
- package/utils/AES.js +132 -81
- package/utils/AES.js.map +1 -1
- package/utils/ErrorWithData.js +23 -5
- package/utils/ErrorWithData.js.map +1 -1
- package/utils/Network.js +1 -1
- package/utils/Network.js.map +1 -1
- package/utils/ProtocolBlockExplorer.js +4 -3
- package/utils/ProtocolBlockExplorer.js.map +1 -1
- package/utils/ProtocolNetwork.js +16 -11
- package/utils/ProtocolNetwork.js.map +1 -1
- package/utils/ProtocolSymbols.d.ts +3 -1
- package/utils/ProtocolSymbols.js +8 -6
- package/utils/ProtocolSymbols.js.map +1 -1
- package/utils/array.js +15 -14
- package/utils/array.js.map +1 -1
- package/utils/assert.js +12 -8
- package/utils/assert.js.map +1 -1
- package/utils/base64Check.d.ts +1 -0
- package/utils/base64Check.js +15 -15
- package/utils/base64Check.js.map +1 -1
- package/utils/blake2b.js +14 -11
- package/utils/blake2b.js.map +1 -1
- package/utils/buffer.d.ts +1 -0
- package/utils/buffer.js +1 -1
- package/utils/buffer.js.map +1 -1
- package/utils/cache.js +87 -38
- package/utils/cache.js.map +1 -1
- package/utils/error.js +3 -2
- package/utils/error.js.map +1 -1
- package/utils/hex.d.ts +2 -1
- package/utils/hex.js +38 -31
- package/utils/hex.js.map +1 -1
- package/utils/interfaces.js +4 -3
- package/utils/interfaces.js.map +1 -1
- package/utils/object.js +7 -5
- package/utils/object.js.map +1 -1
- package/utils/padStart.js +2 -1
- package/utils/padStart.js.map +1 -1
- package/utils/remote-data/HttpRemoteData.js +107 -24
- package/utils/remote-data/HttpRemoteData.js.map +1 -1
- package/utils/remote-data/IpfsRemoteData.js +116 -32
- package/utils/remote-data/IpfsRemoteData.js.map +1 -1
- package/utils/remote-data/RemoteData.d.ts +1 -0
- package/utils/remote-data/RemoteData.js +4 -3
- package/utils/remote-data/RemoteData.js.map +1 -1
- package/utils/remote-data/RemoteDataFactory.d.ts +2 -2
- package/utils/remote-data/RemoteDataFactory.js +20 -13
- package/utils/remote-data/RemoteDataFactory.js.map +1 -1
- package/utils/remote-data/Sha256RemoteData.d.ts +1 -0
- package/utils/remote-data/Sha256RemoteData.js +117 -44
- package/utils/remote-data/Sha256RemoteData.js.map +1 -1
- package/utils/string.js +9 -8
- package/utils/string.js.map +1 -1
- package/utils/type.js +4 -3
- package/utils/type.js.map +1 -1
- package/utils/xxhash.d.ts +1 -0
- package/utils/xxhash.js +11 -9
- package/utils/xxhash.js.map +1 -1
- package/wallet/AirGapCoinWallet.js +183 -64
- package/wallet/AirGapCoinWallet.js.map +1 -1
- package/wallet/AirGapMarketWallet.js +201 -88
- package/wallet/AirGapMarketWallet.js.map +1 -1
- package/wallet/AirGapNFTWallet.js +165 -48
- package/wallet/AirGapNFTWallet.js.map +1 -1
- package/wallet/AirGapWallet.js +145 -58
- package/wallet/AirGapWallet.js.map +1 -1
package/actions/Action.js
CHANGED
|
@@ -1,21 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
2
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
39
|
exports.Action = exports.ActionState = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
40
|
+
var errors_1 = require("../errors");
|
|
41
|
+
var coinlib_error_1 = require("../errors/coinlib-error");
|
|
42
|
+
var StateMachine_1 = require("./StateMachine");
|
|
7
43
|
var ActionState;
|
|
8
44
|
(function (ActionState) {
|
|
9
45
|
ActionState[ActionState["READY"] = 0] = "READY";
|
|
10
46
|
ActionState[ActionState["EXECUTING"] = 1] = "EXECUTING";
|
|
11
47
|
ActionState[ActionState["COMPLETED"] = 2] = "COMPLETED";
|
|
12
48
|
ActionState[ActionState["CANCELLED"] = 3] = "CANCELLED";
|
|
13
|
-
})(ActionState
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return 'action';
|
|
17
|
-
}
|
|
18
|
-
constructor(context) {
|
|
49
|
+
})(ActionState = exports.ActionState || (exports.ActionState = {}));
|
|
50
|
+
var Action = /** @class */ (function () {
|
|
51
|
+
function Action(context) {
|
|
19
52
|
this.stateMachine = new StateMachine_1.StateMachine(ActionState.READY, new Map([
|
|
20
53
|
[ActionState.READY, []],
|
|
21
54
|
[ActionState.EXECUTING, [ActionState.READY]],
|
|
@@ -24,43 +57,63 @@ class Action {
|
|
|
24
57
|
]));
|
|
25
58
|
this.context = context;
|
|
26
59
|
}
|
|
27
|
-
|
|
60
|
+
Object.defineProperty(Action.prototype, "identifier", {
|
|
61
|
+
get: function () {
|
|
62
|
+
return 'action';
|
|
63
|
+
},
|
|
64
|
+
enumerable: false,
|
|
65
|
+
configurable: true
|
|
66
|
+
});
|
|
67
|
+
Action.prototype.getState = function () {
|
|
28
68
|
return this.stateMachine.getState();
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
69
|
+
};
|
|
70
|
+
Action.prototype.start = function () {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
72
|
+
var result, error_1;
|
|
73
|
+
return __generator(this, function (_a) {
|
|
74
|
+
switch (_a.label) {
|
|
75
|
+
case 0:
|
|
76
|
+
_a.trys.push([0, 2, , 3]);
|
|
77
|
+
this.stateMachine.transitionTo(ActionState.EXECUTING);
|
|
78
|
+
return [4 /*yield*/, this.perform()];
|
|
79
|
+
case 1:
|
|
80
|
+
result = _a.sent();
|
|
81
|
+
this.handleSuccess(result);
|
|
82
|
+
return [3 /*break*/, 3];
|
|
83
|
+
case 2:
|
|
84
|
+
error_1 = _a.sent();
|
|
85
|
+
this.handleError(error_1);
|
|
86
|
+
return [3 /*break*/, 3];
|
|
87
|
+
case 3: return [2 /*return*/];
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
Action.prototype.cancel = function () {
|
|
41
93
|
this.stateMachine.transitionTo(ActionState.CANCELLED);
|
|
42
94
|
if (this.onCancel) {
|
|
43
95
|
this.onCancel();
|
|
44
96
|
}
|
|
45
|
-
}
|
|
46
|
-
addValidTransition(from, to) {
|
|
97
|
+
};
|
|
98
|
+
Action.prototype.addValidTransition = function (from, to) {
|
|
47
99
|
this.stateMachine.addValidStateTransition(from, to);
|
|
48
|
-
}
|
|
49
|
-
handleSuccess(result) {
|
|
100
|
+
};
|
|
101
|
+
Action.prototype.handleSuccess = function (result) {
|
|
50
102
|
this.result = result;
|
|
51
103
|
this.stateMachine.transitionTo(ActionState.COMPLETED);
|
|
52
104
|
if (this.onComplete) {
|
|
53
105
|
this.onComplete(result);
|
|
54
106
|
}
|
|
55
|
-
}
|
|
56
|
-
handleError(error) {
|
|
107
|
+
};
|
|
108
|
+
Action.prototype.handleError = function (error) {
|
|
57
109
|
this.error = error;
|
|
58
110
|
this.stateMachine.transitionTo(ActionState.COMPLETED);
|
|
59
111
|
if (this.onError) {
|
|
60
112
|
this.onError(error);
|
|
61
113
|
}
|
|
62
114
|
throw new errors_1.InvalidValueError(coinlib_error_1.Domain.ACTIONS, error.message);
|
|
63
|
-
}
|
|
64
|
-
|
|
115
|
+
};
|
|
116
|
+
return Action;
|
|
117
|
+
}());
|
|
65
118
|
exports.Action = Action;
|
|
66
119
|
//# sourceMappingURL=Action.js.map
|
package/actions/Action.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Action.js","sourceRoot":"","sources":["../../src/actions/Action.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Action.js","sourceRoot":"","sources":["../../src/actions/Action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAA6C;AAC7C,yDAAgD;AAChD,+CAA6C;AAE7C,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,+CAAK,CAAA;IACL,uDAAS,CAAA;IACT,uDAAS,CAAA;IACT,uDAAS,CAAA;AACX,CAAC,EALW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAKtB;AAED;IAuBE,gBAAmB,OAAgB;QAVlB,iBAAY,GAA8B,IAAI,2BAAY,CACzE,WAAW,CAAC,KAAK,EACjB,IAAI,GAAG,CAA6B;YAClC,CAAC,WAAW,CAAC,KAAK,EAAE,EAAE,CAAC;YACvB,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;YAC5C,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;YAChD,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;SACpE,CAAC,CACH,CAAA;QAGC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAxBD,sBAAW,8BAAU;aAArB;YACE,OAAO,QAAQ,CAAA;QACjB,CAAC;;;OAAA;IAwBM,yBAAQ,GAAf;QACE,OAAO,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAA;IACrC,CAAC;IAEY,sBAAK,GAAlB;;;;;;;wBAEI,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;wBACtC,qBAAM,IAAI,CAAC,OAAO,EAAE,EAAA;;wBAA7B,MAAM,GAAG,SAAoB;wBACnC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;;;;wBAE1B,IAAI,CAAC,WAAW,CAAC,OAAK,CAAC,CAAA;;;;;;KAE1B;IAEM,uBAAM,GAAb;QACE,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;QACrD,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,IAAI,CAAC,QAAQ,EAAE,CAAA;SAChB;IACH,CAAC;IAIS,mCAAkB,GAA5B,UAA6B,IAAiB,EAAE,EAAe;QAC7D,IAAI,CAAC,YAAY,CAAC,uBAAuB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;IACrD,CAAC;IAEO,8BAAa,GAArB,UAAsB,MAAc;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;QACrD,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;SACxB;IACH,CAAC;IAEO,4BAAW,GAAnB,UAAoB,KAAY;QAC9B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;QACrD,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;SACpB;QACD,MAAM,IAAI,0BAAiB,CAAC,sBAAM,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;IAC5D,CAAC;IACH,aAAC;AAAD,CAAC,AAtED,IAsEC;AAtEqB,wBAAM"}
|
package/actions/LinkedAction.js
CHANGED
|
@@ -1,31 +1,95 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (_) try {
|
|
33
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
2
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
54
|
exports.LinkedAction = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
55
|
+
var Action_1 = require("./Action");
|
|
56
|
+
var LinkedAction = /** @class */ (function (_super) {
|
|
57
|
+
__extends(LinkedAction, _super);
|
|
58
|
+
function LinkedAction(action, linkedActionType) {
|
|
59
|
+
var _this = _super.call(this) || this;
|
|
60
|
+
_this.linkedActionType = linkedActionType;
|
|
61
|
+
_this.action = action;
|
|
62
|
+
return _this;
|
|
10
63
|
}
|
|
11
|
-
getLinkedAction() {
|
|
64
|
+
LinkedAction.prototype.getLinkedAction = function () {
|
|
12
65
|
return this.linkedAction;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
66
|
+
};
|
|
67
|
+
LinkedAction.prototype.perform = function () {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
69
|
+
return __generator(this, function (_a) {
|
|
70
|
+
switch (_a.label) {
|
|
71
|
+
case 0: return [4 /*yield*/, this.action.start()];
|
|
72
|
+
case 1:
|
|
73
|
+
_a.sent();
|
|
74
|
+
this.linkedAction = new this.linkedActionType(this.action.result);
|
|
75
|
+
return [4 /*yield*/, this.linkedAction.start()];
|
|
76
|
+
case 2:
|
|
77
|
+
_a.sent();
|
|
78
|
+
return [2 /*return*/, this.linkedAction.result];
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
LinkedAction.prototype.cancel = function () {
|
|
21
84
|
if (this.action.getState() === Action_1.ActionState.EXECUTING) {
|
|
22
85
|
this.action.cancel();
|
|
23
86
|
}
|
|
24
87
|
else if (this.linkedAction !== undefined && this.linkedAction.getState() === Action_1.ActionState.EXECUTING) {
|
|
25
88
|
this.linkedAction.cancel();
|
|
26
89
|
}
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
90
|
+
_super.prototype.cancel.call(this);
|
|
91
|
+
};
|
|
92
|
+
return LinkedAction;
|
|
93
|
+
}(Action_1.Action));
|
|
30
94
|
exports.LinkedAction = LinkedAction;
|
|
31
95
|
//# sourceMappingURL=LinkedAction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkedAction.js","sourceRoot":"","sources":["../../src/actions/LinkedAction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LinkedAction.js","sourceRoot":"","sources":["../../src/actions/LinkedAction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAA8C;AAE9C;IAAmD,gCAAoB;IAIrE,sBAAmB,MAA6B,EAAmB,gBAAmE;QAAtI,YACE,iBAAO,SAER;QAHkE,sBAAgB,GAAhB,gBAAgB,CAAmD;QAEpI,KAAI,CAAC,MAAM,GAAG,MAAM,CAAA;;IACtB,CAAC;IAEM,sCAAe,GAAtB;QACE,OAAO,IAAI,CAAC,YAAY,CAAA;IAC1B,CAAC;IAEe,8BAAO,GAAvB;;;;4BACE,qBAAM,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,EAAA;;wBAAzB,SAAyB,CAAA;wBACzB,IAAI,CAAC,YAAY,GAAG,IAAI,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,MAAO,CAAC,CAAA;wBAClE,qBAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,EAAA;;wBAA/B,SAA+B,CAAA;wBAE/B,sBAAO,IAAI,CAAC,YAAY,CAAC,MAAO,EAAA;;;;KACjC;IAEM,6BAAM,GAAb;QACE,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,oBAAW,CAAC,SAAS,EAAE;YACpD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAA;SACrB;aAAM,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS,IAAI,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,KAAK,oBAAW,CAAC,SAAS,EAAE;YACpG,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAA;SAC3B;QACD,iBAAM,MAAM,WAAE,CAAA;IAChB,CAAC;IACH,mBAAC;AAAD,CAAC,AA7BD,CAAmD,eAAM,GA6BxD;AA7BY,oCAAY"}
|
|
@@ -1,29 +1,92 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (_) try {
|
|
33
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
2
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
54
|
exports.RepeatableAction = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (this.innerAction !== undefined && this.innerAction.getState() === Action_1.ActionState.EXECUTING) {
|
|
15
|
-
this.innerAction.cancel();
|
|
16
|
-
}
|
|
17
|
-
this.innerAction = this.actionFactory();
|
|
18
|
-
await this.innerAction.start();
|
|
19
|
-
return this.innerAction.result;
|
|
55
|
+
var Action_1 = require("./Action");
|
|
56
|
+
var RepeatableAction = /** @class */ (function (_super) {
|
|
57
|
+
__extends(RepeatableAction, _super);
|
|
58
|
+
function RepeatableAction(context, actionFactory) {
|
|
59
|
+
var _this = _super.call(this, context) || this;
|
|
60
|
+
_this.actionFactory = actionFactory;
|
|
61
|
+
_this.addValidTransition(Action_1.ActionState.EXECUTING, Action_1.ActionState.EXECUTING);
|
|
62
|
+
_this.addValidTransition(Action_1.ActionState.COMPLETED, Action_1.ActionState.EXECUTING);
|
|
63
|
+
_this.addValidTransition(Action_1.ActionState.CANCELLED, Action_1.ActionState.EXECUTING);
|
|
64
|
+
return _this;
|
|
20
65
|
}
|
|
21
|
-
|
|
66
|
+
RepeatableAction.prototype.perform = function () {
|
|
67
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
68
|
+
return __generator(this, function (_a) {
|
|
69
|
+
switch (_a.label) {
|
|
70
|
+
case 0:
|
|
71
|
+
if (this.innerAction !== undefined && this.innerAction.getState() === Action_1.ActionState.EXECUTING) {
|
|
72
|
+
this.innerAction.cancel();
|
|
73
|
+
}
|
|
74
|
+
this.innerAction = this.actionFactory();
|
|
75
|
+
return [4 /*yield*/, this.innerAction.start()];
|
|
76
|
+
case 1:
|
|
77
|
+
_a.sent();
|
|
78
|
+
return [2 /*return*/, this.innerAction.result];
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
RepeatableAction.prototype.cancel = function () {
|
|
22
84
|
if (this.innerAction !== undefined && this.innerAction.getState() === Action_1.ActionState.EXECUTING) {
|
|
23
85
|
this.innerAction.cancel();
|
|
24
86
|
}
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
87
|
+
_super.prototype.cancel.call(this);
|
|
88
|
+
};
|
|
89
|
+
return RepeatableAction;
|
|
90
|
+
}(Action_1.Action));
|
|
28
91
|
exports.RepeatableAction = RepeatableAction;
|
|
29
92
|
//# sourceMappingURL=RepeatableAction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepeatableAction.js","sourceRoot":"","sources":["../../src/actions/RepeatableAction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RepeatableAction.js","sourceRoot":"","sources":["../../src/actions/RepeatableAction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAA8C;AAE9C;IAAqE,oCAAuB;IAI1F,0BAAmB,OAAgB,EAAE,aAAiD;QAAtF,YACE,kBAAM,OAAO,CAAC,SAKf;QAJC,KAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAClC,KAAI,CAAC,kBAAkB,CAAC,oBAAW,CAAC,SAAS,EAAE,oBAAW,CAAC,SAAS,CAAC,CAAA;QACrE,KAAI,CAAC,kBAAkB,CAAC,oBAAW,CAAC,SAAS,EAAE,oBAAW,CAAC,SAAS,CAAC,CAAA;QACrE,KAAI,CAAC,kBAAkB,CAAC,oBAAW,CAAC,SAAS,EAAE,oBAAW,CAAC,SAAS,CAAC,CAAA;;IACvE,CAAC;IAEe,kCAAO,GAAvB;;;;;wBACE,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,IAAI,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,KAAK,oBAAW,CAAC,SAAS,EAAE;4BAC3F,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAA;yBAC1B;wBACD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,aAAa,EAAE,CAAA;wBACvC,qBAAM,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,EAAA;;wBAA9B,SAA8B,CAAA;wBAE9B,sBAAO,IAAI,CAAC,WAAW,CAAC,MAAO,EAAA;;;;KAChC;IAEM,iCAAM,GAAb;QACE,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,IAAI,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,KAAK,oBAAW,CAAC,SAAS,EAAE;YAC3F,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAA;SAC1B;QACD,iBAAM,MAAM,WAAE,CAAA;IAChB,CAAC;IACH,uBAAC;AAAD,CAAC,AA5BD,CAAqE,eAAM,GA4B1E;AA5BY,4CAAgB"}
|
package/actions/SimpleAction.js
CHANGED
|
@@ -1,18 +1,80 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (_) try {
|
|
33
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
2
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
54
|
exports.SimpleAction = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
this.promise = promise;
|
|
12
|
-
}
|
|
13
|
-
async perform() {
|
|
14
|
-
return this.promise();
|
|
55
|
+
var Action_1 = require("./Action");
|
|
56
|
+
var SimpleAction = /** @class */ (function (_super) {
|
|
57
|
+
__extends(SimpleAction, _super);
|
|
58
|
+
function SimpleAction(promise) {
|
|
59
|
+
var _this = _super.call(this) || this;
|
|
60
|
+
_this.promise = promise;
|
|
61
|
+
return _this;
|
|
15
62
|
}
|
|
16
|
-
|
|
63
|
+
Object.defineProperty(SimpleAction.prototype, "identifier", {
|
|
64
|
+
get: function () {
|
|
65
|
+
return 'simple-action';
|
|
66
|
+
},
|
|
67
|
+
enumerable: false,
|
|
68
|
+
configurable: true
|
|
69
|
+
});
|
|
70
|
+
SimpleAction.prototype.perform = function () {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
72
|
+
return __generator(this, function (_a) {
|
|
73
|
+
return [2 /*return*/, this.promise()];
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
return SimpleAction;
|
|
78
|
+
}(Action_1.Action));
|
|
17
79
|
exports.SimpleAction = SimpleAction;
|
|
18
80
|
//# sourceMappingURL=SimpleAction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SimpleAction.js","sourceRoot":"","sources":["../../src/actions/SimpleAction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SimpleAction.js","sourceRoot":"","sources":["../../src/actions/SimpleAction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAiC;AAEjC;IAA0C,gCAAoB;IAO5D,sBAAmB,OAA8B;QAAjD,YACE,iBAAO,SAER;QADC,KAAI,CAAC,OAAO,GAAG,OAAO,CAAA;;IACxB,CAAC;IATD,sBAAI,oCAAU;aAAd;YACE,OAAO,eAAe,CAAA;QACxB,CAAC;;;OAAA;IASe,8BAAO,GAAvB;;;gBACE,sBAAO,IAAI,CAAC,OAAO,EAAE,EAAA;;;KACtB;IACH,mBAAC;AAAD,CAAC,AAfD,CAA0C,eAAM,GAe/C;AAfY,oCAAY"}
|
package/actions/StateMachine.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StateMachine = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
var errors_1 = require("../errors");
|
|
5
|
+
var coinlib_error_1 = require("../errors/coinlib-error");
|
|
6
|
+
var StateMachine = /** @class */ (function () {
|
|
7
|
+
function StateMachine(initialState, validTransitions) {
|
|
8
8
|
this.state = initialState;
|
|
9
9
|
this.validTransitions = validTransitions;
|
|
10
10
|
}
|
|
11
|
-
transitionTo(state) {
|
|
11
|
+
StateMachine.prototype.transitionTo = function (state) {
|
|
12
12
|
if (this.canTransitionTo(state)) {
|
|
13
13
|
this.state = state;
|
|
14
14
|
}
|
|
15
15
|
else {
|
|
16
|
-
throw new errors_1.OperationFailedError(coinlib_error_1.Domain.ACTIONS,
|
|
16
|
+
throw new errors_1.OperationFailedError(coinlib_error_1.Domain.ACTIONS, "Invalid state transition: ".concat(this.state, " -> ").concat(state));
|
|
17
17
|
}
|
|
18
|
-
}
|
|
19
|
-
getState() {
|
|
18
|
+
};
|
|
19
|
+
StateMachine.prototype.getState = function () {
|
|
20
20
|
return this.state;
|
|
21
|
-
}
|
|
22
|
-
addValidStateTransition(from, to) {
|
|
23
|
-
|
|
21
|
+
};
|
|
22
|
+
StateMachine.prototype.addValidStateTransition = function (from, to) {
|
|
23
|
+
var states = this.validTransitions.get(to);
|
|
24
24
|
if (states !== undefined && states.indexOf(from) === -1) {
|
|
25
25
|
states.push(from);
|
|
26
26
|
this.validTransitions.set(to, states);
|
|
@@ -28,14 +28,15 @@ class StateMachine {
|
|
|
28
28
|
else {
|
|
29
29
|
this.validTransitions.set(to, [from]);
|
|
30
30
|
}
|
|
31
|
-
}
|
|
32
|
-
canTransitionTo(state) {
|
|
33
|
-
|
|
31
|
+
};
|
|
32
|
+
StateMachine.prototype.canTransitionTo = function (state) {
|
|
33
|
+
var states = this.validTransitions.get(state);
|
|
34
34
|
if (states !== undefined) {
|
|
35
35
|
return states.indexOf(this.state) !== -1;
|
|
36
36
|
}
|
|
37
37
|
return false;
|
|
38
|
-
}
|
|
39
|
-
|
|
38
|
+
};
|
|
39
|
+
return StateMachine;
|
|
40
|
+
}());
|
|
40
41
|
exports.StateMachine = StateMachine;
|
|
41
42
|
//# sourceMappingURL=StateMachine.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StateMachine.js","sourceRoot":"","sources":["../../src/actions/StateMachine.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"StateMachine.js","sourceRoot":"","sources":["../../src/actions/StateMachine.ts"],"names":[],"mappings":";;;AAAA,oCAAgD;AAChD,yDAAgD;AAEhD;IAIE,sBAAY,YAAe,EAAE,gBAA6B;QACxD,IAAI,CAAC,KAAK,GAAG,YAAY,CAAA;QACzB,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAA;IAC1C,CAAC;IAEM,mCAAY,GAAnB,UAAoB,KAAQ;QAC1B,IAAI,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE;YAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;SACnB;aAAM;YACL,MAAM,IAAI,6BAAoB,CAAC,sBAAM,CAAC,OAAO,EAAE,oCAA6B,IAAI,CAAC,KAAK,iBAAO,KAAK,CAAE,CAAC,CAAA;SACtG;IACH,CAAC;IAEM,+BAAQ,GAAf;QACE,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;IAEM,8CAAuB,GAA9B,UAA+B,IAAO,EAAE,EAAK;QAC3C,IAAM,MAAM,GAAoB,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;QAC7D,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE;YACvD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACjB,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;SACtC;aAAM;YACL,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;SACtC;IACH,CAAC;IAEO,sCAAe,GAAvB,UAAwB,KAAQ;QAC9B,IAAM,MAAM,GAAoB,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QAChE,IAAI,MAAM,KAAK,SAAS,EAAE;YACxB,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA;SACzC;QAED,OAAO,KAAK,CAAA;IACd,CAAC;IACH,mBAAC;AAAD,CAAC,AAvCD,IAuCC;AAvCY,oCAAY"}
|
package/data/KeyPair.d.ts
CHANGED