@airgap/coinlib-core 0.13.45-beta.2 → 0.13.45-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/actions/Action.js +30 -83
- package/actions/Action.js.map +1 -1
- package/actions/LinkedAction.js +18 -82
- package/actions/LinkedAction.js.map +1 -1
- package/actions/RepeatableAction.js +20 -83
- package/actions/RepeatableAction.js.map +1 -1
- package/actions/SimpleAction.js +12 -74
- package/actions/SimpleAction.js.map +1 -1
- package/actions/StateMachine.js +16 -17
- package/actions/StateMachine.js.map +1 -1
- package/data/KeyPair.d.ts +0 -1
- package/data/Lazy.js +15 -64
- package/data/Lazy.js.map +1 -1
- package/data/RPCBody.js +3 -6
- 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 +88 -130
- 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 +57 -61
- 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 +1 -2
- 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 +8 -10
- 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 +22 -28
- 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 +9 -10
- 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 +10 -11
- 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 +7 -8
- 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 +61 -63
- 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 +61 -63
- 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 +2 -3
- 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 +47 -76
- 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 +46 -61
- 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 +61 -106
- 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 +95 -100
- 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 +46 -75
- 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 +45 -70
- 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 +58 -63
- 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 +30 -33
- 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 +18 -20
- 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 +5 -12
- 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 +75 -76
- 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 +115 -178
- 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 +6 -9
- 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 +78 -83
- 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 +27 -36
- 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 +25 -26
- 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 +14 -230
- package/dependencies/src/cosmjs/index.js +373 -480
- package/dependencies/src/cosmjs/index.js.map +1 -1
- package/dependencies/src/eciesjs-0.3.9/src/index.d.ts +0 -1
- package/dependencies/src/eciesjs-0.3.9/src/index.js +15 -19
- 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 +0 -1
- package/dependencies/src/eciesjs-0.3.9/src/keys/PrivateKey.js +37 -28
- 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 +0 -1
- package/dependencies/src/eciesjs-0.3.9/src/keys/PublicKey.js +38 -30
- 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 +0 -1
- package/dependencies/src/eciesjs-0.3.9/src/utils.js +33 -24
- package/dependencies/src/eciesjs-0.3.9/src/utils.js.map +1 -1
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-key.js +42 -34
- 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 +6 -10
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-wallet.js.map +1 -1
- package/errors/coinlib-error.js +16 -37
- package/errors/coinlib-error.js.map +1 -1
- package/errors/index.d.ts +2 -2
- package/errors/index.js +89 -148
- 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 +7 -54
- package/protocols/BlockExplorerProtocol.js.map +1 -1
- package/protocols/CryptoClient.js +19 -78
- package/protocols/CryptoClient.js.map +1 -1
- package/protocols/Ed25519CryptoClient.js +30 -98
- package/protocols/Ed25519CryptoClient.js.map +1 -1
- package/protocols/ICoinSubProtocol.js +1 -1
- package/protocols/ICoinSubProtocol.js.map +1 -1
- package/protocols/NonExtendedProtocol.js +26 -29
- package/protocols/NonExtendedProtocol.js.map +1 -1
- package/protocols/Secp256k1CryptoClient.js +9 -73
- package/protocols/Secp256k1CryptoClient.js.map +1 -1
- package/protocols/Sr25519CryptoClient.js +12 -76
- package/protocols/Sr25519CryptoClient.js.map +1 -1
- package/utils/AES.js +81 -132
- package/utils/AES.js.map +1 -1
- package/utils/ErrorWithData.js +5 -23
- package/utils/ErrorWithData.js.map +1 -1
- package/utils/Network.js +1 -1
- package/utils/Network.js.map +1 -1
- package/utils/ProtocolBlockExplorer.js +3 -4
- package/utils/ProtocolBlockExplorer.js.map +1 -1
- package/utils/ProtocolNetwork.js +11 -16
- package/utils/ProtocolNetwork.js.map +1 -1
- package/utils/ProtocolSymbols.d.ts +1 -1
- package/utils/ProtocolSymbols.js +6 -6
- package/utils/ProtocolSymbols.js.map +1 -1
- package/utils/array.js +14 -15
- package/utils/array.js.map +1 -1
- package/utils/assert.js +8 -12
- package/utils/assert.js.map +1 -1
- package/utils/base64Check.d.ts +0 -1
- package/utils/base64Check.js +15 -15
- package/utils/base64Check.js.map +1 -1
- package/utils/blake2b.js +11 -14
- package/utils/blake2b.js.map +1 -1
- package/utils/buffer.d.ts +0 -1
- package/utils/buffer.js +1 -1
- package/utils/buffer.js.map +1 -1
- package/utils/cache.js +38 -87
- package/utils/cache.js.map +1 -1
- package/utils/error.js +2 -3
- package/utils/error.js.map +1 -1
- package/utils/hex.d.ts +1 -2
- package/utils/hex.js +31 -38
- package/utils/hex.js.map +1 -1
- package/utils/interfaces.js +3 -4
- package/utils/interfaces.js.map +1 -1
- package/utils/object.js +5 -7
- package/utils/object.js.map +1 -1
- package/utils/padStart.js +1 -2
- package/utils/padStart.js.map +1 -1
- package/utils/remote-data/HttpRemoteData.js +24 -107
- package/utils/remote-data/HttpRemoteData.js.map +1 -1
- package/utils/remote-data/IpfsRemoteData.js +32 -116
- package/utils/remote-data/IpfsRemoteData.js.map +1 -1
- package/utils/remote-data/RemoteData.d.ts +0 -1
- package/utils/remote-data/RemoteData.js +3 -4
- package/utils/remote-data/RemoteData.js.map +1 -1
- package/utils/remote-data/RemoteDataFactory.d.ts +2 -2
- package/utils/remote-data/RemoteDataFactory.js +13 -20
- package/utils/remote-data/RemoteDataFactory.js.map +1 -1
- package/utils/remote-data/Sha256RemoteData.d.ts +0 -1
- package/utils/remote-data/Sha256RemoteData.js +44 -117
- package/utils/remote-data/Sha256RemoteData.js.map +1 -1
- package/utils/string.js +8 -9
- package/utils/string.js.map +1 -1
- package/utils/type.js +3 -4
- package/utils/type.js.map +1 -1
- package/utils/xxhash.d.ts +0 -1
- package/utils/xxhash.js +9 -11
- package/utils/xxhash.js.map +1 -1
- package/wallet/AirGapCoinWallet.js +64 -183
- package/wallet/AirGapCoinWallet.js.map +1 -1
- package/wallet/AirGapMarketWallet.js +88 -201
- package/wallet/AirGapMarketWallet.js.map +1 -1
- package/wallet/AirGapNFTWallet.js +48 -165
- package/wallet/AirGapNFTWallet.js.map +1 -1
- package/wallet/AirGapWallet.js +58 -145
- package/wallet/AirGapWallet.js.map +1 -1
package/actions/Action.js
CHANGED
|
@@ -1,54 +1,21 @@
|
|
|
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
|
-
};
|
|
38
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.Action = exports.ActionState = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
4
|
+
const errors_1 = require("../errors");
|
|
5
|
+
const coinlib_error_1 = require("../errors/coinlib-error");
|
|
6
|
+
const StateMachine_1 = require("./StateMachine");
|
|
43
7
|
var ActionState;
|
|
44
8
|
(function (ActionState) {
|
|
45
9
|
ActionState[ActionState["READY"] = 0] = "READY";
|
|
46
10
|
ActionState[ActionState["EXECUTING"] = 1] = "EXECUTING";
|
|
47
11
|
ActionState[ActionState["COMPLETED"] = 2] = "COMPLETED";
|
|
48
12
|
ActionState[ActionState["CANCELLED"] = 3] = "CANCELLED";
|
|
49
|
-
})(ActionState
|
|
50
|
-
|
|
51
|
-
|
|
13
|
+
})(ActionState || (exports.ActionState = ActionState = {}));
|
|
14
|
+
class Action {
|
|
15
|
+
get identifier() {
|
|
16
|
+
return 'action';
|
|
17
|
+
}
|
|
18
|
+
constructor(context) {
|
|
52
19
|
this.stateMachine = new StateMachine_1.StateMachine(ActionState.READY, new Map([
|
|
53
20
|
[ActionState.READY, []],
|
|
54
21
|
[ActionState.EXECUTING, [ActionState.READY]],
|
|
@@ -57,63 +24,43 @@ var Action = /** @class */ (function () {
|
|
|
57
24
|
]));
|
|
58
25
|
this.context = context;
|
|
59
26
|
}
|
|
60
|
-
|
|
61
|
-
get: function () {
|
|
62
|
-
return 'action';
|
|
63
|
-
},
|
|
64
|
-
enumerable: false,
|
|
65
|
-
configurable: true
|
|
66
|
-
});
|
|
67
|
-
Action.prototype.getState = function () {
|
|
27
|
+
getState() {
|
|
68
28
|
return this.stateMachine.getState();
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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 () {
|
|
29
|
+
}
|
|
30
|
+
async start() {
|
|
31
|
+
try {
|
|
32
|
+
this.stateMachine.transitionTo(ActionState.EXECUTING);
|
|
33
|
+
const result = await this.perform();
|
|
34
|
+
this.handleSuccess(result);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
this.handleError(error);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
cancel() {
|
|
93
41
|
this.stateMachine.transitionTo(ActionState.CANCELLED);
|
|
94
42
|
if (this.onCancel) {
|
|
95
43
|
this.onCancel();
|
|
96
44
|
}
|
|
97
|
-
}
|
|
98
|
-
|
|
45
|
+
}
|
|
46
|
+
addValidTransition(from, to) {
|
|
99
47
|
this.stateMachine.addValidStateTransition(from, to);
|
|
100
|
-
}
|
|
101
|
-
|
|
48
|
+
}
|
|
49
|
+
handleSuccess(result) {
|
|
102
50
|
this.result = result;
|
|
103
51
|
this.stateMachine.transitionTo(ActionState.COMPLETED);
|
|
104
52
|
if (this.onComplete) {
|
|
105
53
|
this.onComplete(result);
|
|
106
54
|
}
|
|
107
|
-
}
|
|
108
|
-
|
|
55
|
+
}
|
|
56
|
+
handleError(error) {
|
|
109
57
|
this.error = error;
|
|
110
58
|
this.stateMachine.transitionTo(ActionState.COMPLETED);
|
|
111
59
|
if (this.onError) {
|
|
112
60
|
this.onError(error);
|
|
113
61
|
}
|
|
114
62
|
throw new errors_1.InvalidValueError(coinlib_error_1.Domain.ACTIONS, error.message);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
}());
|
|
63
|
+
}
|
|
64
|
+
}
|
|
118
65
|
exports.Action = Action;
|
|
119
66
|
//# 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,sCAA6C;AAC7C,2DAAgD;AAChD,iDAA6C;AAE7C,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,+CAAK,CAAA;IACL,uDAAS,CAAA;IACT,uDAAS,CAAA;IACT,uDAAS,CAAA;AACX,CAAC,EALW,WAAW,2BAAX,WAAW,QAKtB;AAED,MAAsB,MAAM;IAC1B,IAAW,UAAU;QACnB,OAAO,QAAQ,CAAA;IACjB,CAAC;IAoBD,YAAmB,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;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAA;IACrC,CAAC;IAEM,KAAK,CAAC,KAAK;QAChB,IAAI,CAAC;YACH,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;YACrD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAA;YACnC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;QAC5B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;QACzB,CAAC;IACH,CAAC;IAEM,MAAM;QACX,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;QACrD,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,IAAI,CAAC,QAAQ,EAAE,CAAA;QACjB,CAAC;IACH,CAAC;IAIS,kBAAkB,CAAC,IAAiB,EAAE,EAAe;QAC7D,IAAI,CAAC,YAAY,CAAC,uBAAuB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;IACrD,CAAC;IAEO,aAAa,CAAC,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,CAAC;YACpB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;QACzB,CAAC;IACH,CAAC;IAEO,WAAW,CAAC,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,CAAC;YACjB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QACrB,CAAC;QACD,MAAM,IAAI,0BAAiB,CAAC,sBAAM,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;IAC5D,CAAC;CACF;AAtED,wBAsEC"}
|
package/actions/LinkedAction.js
CHANGED
|
@@ -1,95 +1,31 @@
|
|
|
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
|
-
};
|
|
53
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
3
|
exports.LinkedAction = void 0;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
_this.action = action;
|
|
62
|
-
return _this;
|
|
4
|
+
const Action_1 = require("./Action");
|
|
5
|
+
class LinkedAction extends Action_1.Action {
|
|
6
|
+
constructor(action, linkedActionType) {
|
|
7
|
+
super();
|
|
8
|
+
this.linkedActionType = linkedActionType;
|
|
9
|
+
this.action = action;
|
|
63
10
|
}
|
|
64
|
-
|
|
11
|
+
getLinkedAction() {
|
|
65
12
|
return this.linkedAction;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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 () {
|
|
13
|
+
}
|
|
14
|
+
async perform() {
|
|
15
|
+
await this.action.start();
|
|
16
|
+
this.linkedAction = new this.linkedActionType(this.action.result);
|
|
17
|
+
await this.linkedAction.start();
|
|
18
|
+
return this.linkedAction.result;
|
|
19
|
+
}
|
|
20
|
+
cancel() {
|
|
84
21
|
if (this.action.getState() === Action_1.ActionState.EXECUTING) {
|
|
85
22
|
this.action.cancel();
|
|
86
23
|
}
|
|
87
24
|
else if (this.linkedAction !== undefined && this.linkedAction.getState() === Action_1.ActionState.EXECUTING) {
|
|
88
25
|
this.linkedAction.cancel();
|
|
89
26
|
}
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
}(Action_1.Action));
|
|
27
|
+
super.cancel();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
94
30
|
exports.LinkedAction = LinkedAction;
|
|
95
31
|
//# 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,qCAA8C;AAE9C,MAAa,YAA8B,SAAQ,eAAoB;IAIrE,YAAmB,MAA6B,EAAmB,gBAAmE;QACpI,KAAK,EAAE,CAAA;QAD0D,qBAAgB,GAAhB,gBAAgB,CAAmD;QAEpI,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAEM,eAAe;QACpB,OAAO,IAAI,CAAC,YAAY,CAAA;IAC1B,CAAC;IAES,KAAK,CAAC,OAAO;QACrB,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAA;QACzB,IAAI,CAAC,YAAY,GAAG,IAAI,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,MAAO,CAAC,CAAA;QAClE,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAA;QAE/B,OAAO,IAAI,CAAC,YAAY,CAAC,MAAO,CAAA;IAClC,CAAC;IAEM,MAAM;QACX,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,oBAAW,CAAC,SAAS,EAAE,CAAC;YACrD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAA;QACtB,CAAC;aAAM,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS,IAAI,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,KAAK,oBAAW,CAAC,SAAS,EAAE,CAAC;YACrG,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAA;QAC5B,CAAC;QACD,KAAK,CAAC,MAAM,EAAE,CAAA;IAChB,CAAC;CACF;AA7BD,oCA6BC"}
|
|
@@ -1,92 +1,29 @@
|
|
|
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
|
-
};
|
|
53
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
3
|
exports.RepeatableAction = void 0;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
4
|
+
const Action_1 = require("./Action");
|
|
5
|
+
class RepeatableAction extends Action_1.Action {
|
|
6
|
+
constructor(context, actionFactory) {
|
|
7
|
+
super(context);
|
|
8
|
+
this.actionFactory = actionFactory;
|
|
9
|
+
this.addValidTransition(Action_1.ActionState.EXECUTING, Action_1.ActionState.EXECUTING);
|
|
10
|
+
this.addValidTransition(Action_1.ActionState.COMPLETED, Action_1.ActionState.EXECUTING);
|
|
11
|
+
this.addValidTransition(Action_1.ActionState.CANCELLED, Action_1.ActionState.EXECUTING);
|
|
12
|
+
}
|
|
13
|
+
async perform() {
|
|
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;
|
|
65
20
|
}
|
|
66
|
-
|
|
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 () {
|
|
21
|
+
cancel() {
|
|
84
22
|
if (this.innerAction !== undefined && this.innerAction.getState() === Action_1.ActionState.EXECUTING) {
|
|
85
23
|
this.innerAction.cancel();
|
|
86
24
|
}
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
}(Action_1.Action));
|
|
25
|
+
super.cancel();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
91
28
|
exports.RepeatableAction = RepeatableAction;
|
|
92
29
|
//# 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,qCAA8C;AAE9C,MAAa,gBAAgD,SAAQ,eAAuB;IAI1F,YAAmB,OAAgB,EAAE,aAAiD;QACpF,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAClC,IAAI,CAAC,kBAAkB,CAAC,oBAAW,CAAC,SAAS,EAAE,oBAAW,CAAC,SAAS,CAAC,CAAA;QACrE,IAAI,CAAC,kBAAkB,CAAC,oBAAW,CAAC,SAAS,EAAE,oBAAW,CAAC,SAAS,CAAC,CAAA;QACrE,IAAI,CAAC,kBAAkB,CAAC,oBAAW,CAAC,SAAS,EAAE,oBAAW,CAAC,SAAS,CAAC,CAAA;IACvE,CAAC;IAES,KAAK,CAAC,OAAO;QACrB,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,IAAI,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,KAAK,oBAAW,CAAC,SAAS,EAAE,CAAC;YAC5F,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAA;QAC3B,CAAC;QACD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,aAAa,EAAE,CAAA;QACvC,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAA;QAE9B,OAAO,IAAI,CAAC,WAAW,CAAC,MAAO,CAAA;IACjC,CAAC;IAEM,MAAM;QACX,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,IAAI,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,KAAK,oBAAW,CAAC,SAAS,EAAE,CAAC;YAC5F,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAA;QAC3B,CAAC;QACD,KAAK,CAAC,MAAM,EAAE,CAAA;IAChB,CAAC;CACF;AA5BD,4CA4BC"}
|
package/actions/SimpleAction.js
CHANGED
|
@@ -1,80 +1,18 @@
|
|
|
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
|
-
};
|
|
53
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
3
|
exports.SimpleAction = void 0;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
4
|
+
const Action_1 = require("./Action");
|
|
5
|
+
class SimpleAction extends Action_1.Action {
|
|
6
|
+
get identifier() {
|
|
7
|
+
return 'simple-action';
|
|
8
|
+
}
|
|
9
|
+
constructor(promise) {
|
|
10
|
+
super();
|
|
11
|
+
this.promise = promise;
|
|
12
|
+
}
|
|
13
|
+
async perform() {
|
|
14
|
+
return this.promise();
|
|
62
15
|
}
|
|
63
|
-
|
|
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));
|
|
16
|
+
}
|
|
79
17
|
exports.SimpleAction = SimpleAction;
|
|
80
18
|
//# 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,qCAAiC;AAEjC,MAAa,YAAqB,SAAQ,eAAoB;IAC5D,IAAI,UAAU;QACZ,OAAO,eAAe,CAAA;IACxB,CAAC;IAID,YAAmB,OAA8B;QAC/C,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAES,KAAK,CAAC,OAAO;QACrB,OAAO,IAAI,CAAC,OAAO,EAAE,CAAA;IACvB,CAAC;CACF;AAfD,oCAeC"}
|
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
|
+
const errors_1 = require("../errors");
|
|
5
|
+
const coinlib_error_1 = require("../errors/coinlib-error");
|
|
6
|
+
class StateMachine {
|
|
7
|
+
constructor(initialState, validTransitions) {
|
|
8
8
|
this.state = initialState;
|
|
9
9
|
this.validTransitions = validTransitions;
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
transitionTo(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: ${this.state} -> ${state}`);
|
|
17
17
|
}
|
|
18
|
-
}
|
|
19
|
-
|
|
18
|
+
}
|
|
19
|
+
getState() {
|
|
20
20
|
return this.state;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
}
|
|
22
|
+
addValidStateTransition(from, to) {
|
|
23
|
+
const 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,15 +28,14 @@ var StateMachine = /** @class */ (function () {
|
|
|
28
28
|
else {
|
|
29
29
|
this.validTransitions.set(to, [from]);
|
|
30
30
|
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
}
|
|
32
|
+
canTransitionTo(state) {
|
|
33
|
+
const 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
|
-
|
|
40
|
-
}());
|
|
38
|
+
}
|
|
39
|
+
}
|
|
41
40
|
exports.StateMachine = StateMachine;
|
|
42
41
|
//# 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,sCAAgD;AAChD,2DAAgD;AAEhD,MAAa,YAAY;IAIvB,YAAY,YAAe,EAAE,gBAA6B;QACxD,IAAI,CAAC,KAAK,GAAG,YAAY,CAAA;QACzB,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAA;IAC1C,CAAC;IAEM,YAAY,CAAC,KAAQ;QAC1B,IAAI,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;YAChC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QACpB,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,6BAAoB,CAAC,sBAAM,CAAC,OAAO,EAAE,6BAA6B,IAAI,CAAC,KAAK,OAAO,KAAK,EAAE,CAAC,CAAA;QACvG,CAAC;IACH,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;IAEM,uBAAuB,CAAC,IAAO,EAAE,EAAK;QAC3C,MAAM,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,CAAC;YACxD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACjB,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;QACvC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;QACvC,CAAC;IACH,CAAC;IAEO,eAAe,CAAC,KAAQ;QAC9B,MAAM,MAAM,GAAoB,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QAChE,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA;QAC1C,CAAC;QAED,OAAO,KAAK,CAAA;IACd,CAAC;CACF;AAvCD,oCAuCC"}
|
package/data/KeyPair.d.ts
CHANGED