@docknetwork/wallet-sdk-data-store 0.4.19 → 1.4.0
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/jest.config.ts +0 -1
- package/lib/configs.d.ts.map +1 -1
- package/lib/configs.js +4 -9
- package/lib/configs.js.map +1 -1
- package/lib/helpers.d.ts +5 -4
- package/lib/helpers.d.ts.map +1 -1
- package/lib/helpers.js +53 -44
- package/lib/helpers.js.map +1 -1
- package/lib/index.d.ts +12 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +44 -48
- package/lib/index.js.map +1 -1
- package/lib/logger.d.ts +2 -0
- package/lib/logger.d.ts.map +1 -1
- package/lib/logger.js +6 -0
- package/lib/logger.js.map +1 -1
- package/lib/types.d.ts +41 -2
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js +8 -0
- package/lib/types.js.map +1 -1
- package/package.json +3 -2
- package/src/configs.ts +4 -9
- package/src/helpers.ts +17 -42
- package/src/index.ts +40 -31
- package/src/logger.ts +6 -0
- package/src/types.ts +46 -3
- package/test/mock-local-storage.ts +1 -1
- package/test/wallet.json +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/LICENSE +0 -39
- package/lib/entities/document/create-document.d.ts +0 -10
- package/lib/entities/document/create-document.d.ts.map +0 -1
- package/lib/entities/document/create-document.js +0 -111
- package/lib/entities/document/create-document.js.map +0 -1
- package/lib/entities/document/document.entity.d.ts +0 -11
- package/lib/entities/document/document.entity.d.ts.map +0 -1
- package/lib/entities/document/document.entity.js +0 -55
- package/lib/entities/document/document.entity.js.map +0 -1
- package/lib/entities/document/get-all-documents.d.ts +0 -11
- package/lib/entities/document/get-all-documents.d.ts.map +0 -1
- package/lib/entities/document/get-all-documents.js +0 -78
- package/lib/entities/document/get-all-documents.js.map +0 -1
- package/lib/entities/document/get-documens-by-type.d.ts +0 -10
- package/lib/entities/document/get-documens-by-type.d.ts.map +0 -1
- package/lib/entities/document/get-documens-by-type.js +0 -71
- package/lib/entities/document/get-documens-by-type.js.map +0 -1
- package/lib/entities/document/get-document-by-id.d.ts +0 -13
- package/lib/entities/document/get-document-by-id.d.ts.map +0 -1
- package/lib/entities/document/get-document-by-id.js +0 -92
- package/lib/entities/document/get-document-by-id.js.map +0 -1
- package/lib/entities/document/get-document-correlations.d.ts +0 -10
- package/lib/entities/document/get-document-correlations.d.ts.map +0 -1
- package/lib/entities/document/get-document-correlations.js +0 -78
- package/lib/entities/document/get-document-correlations.js.map +0 -1
- package/lib/entities/document/helpers.d.ts +0 -30
- package/lib/entities/document/helpers.d.ts.map +0 -1
- package/lib/entities/document/helpers.js +0 -196
- package/lib/entities/document/helpers.js.map +0 -1
- package/lib/entities/document/index.d.ts +0 -10
- package/lib/entities/document/index.d.ts.map +0 -1
- package/lib/entities/document/index.js +0 -26
- package/lib/entities/document/index.js.map +0 -1
- package/lib/entities/document/remove-document.d.ts +0 -15
- package/lib/entities/document/remove-document.d.ts.map +0 -1
- package/lib/entities/document/remove-document.js +0 -94
- package/lib/entities/document/remove-document.js.map +0 -1
- package/lib/entities/document/update-document.d.ts +0 -10
- package/lib/entities/document/update-document.d.ts.map +0 -1
- package/lib/entities/document/update-document.js +0 -72
- package/lib/entities/document/update-document.js.map +0 -1
- package/lib/entities/document-type.entity.d.ts +0 -6
- package/lib/entities/document-type.entity.d.ts.map +0 -1
- package/lib/entities/document-type.entity.js +0 -32
- package/lib/entities/document-type.entity.js.map +0 -1
- package/lib/entities/log.entity.d.ts +0 -15
- package/lib/entities/log.entity.d.ts.map +0 -1
- package/lib/entities/log.entity.js +0 -108
- package/lib/entities/log.entity.js.map +0 -1
- package/lib/entities/network.entity.d.ts +0 -6
- package/lib/entities/network.entity.d.ts.map +0 -1
- package/lib/entities/network.entity.js +0 -35
- package/lib/entities/network.entity.js.map +0 -1
- package/lib/entities/transaction.entity.d.ts +0 -24
- package/lib/entities/transaction.entity.d.ts.map +0 -1
- package/lib/entities/transaction.entity.js +0 -139
- package/lib/entities/transaction.entity.js.map +0 -1
- package/lib/entities/wallet.entity.d.ts +0 -10
- package/lib/entities/wallet.entity.d.ts.map +0 -1
- package/lib/entities/wallet.entity.js +0 -109
- package/lib/entities/wallet.entity.js.map +0 -1
- package/lib/migration/bootstrap-tables.d.ts +0 -3
- package/lib/migration/bootstrap-tables.d.ts.map +0 -1
- package/lib/migration/bootstrap-tables.js +0 -8
- package/lib/migration/bootstrap-tables.js.map +0 -1
- package/lib/migration/index.d.ts +0 -8
- package/lib/migration/index.d.ts.map +0 -1
- package/lib/migration/index.js +0 -132
- package/lib/migration/index.js.map +0 -1
- package/lib/migration/migration1/index.d.ts +0 -16
- package/lib/migration/migration1/index.d.ts.map +0 -1
- package/lib/migration/migration1/index.js +0 -110
- package/lib/migration/migration1/index.js.map +0 -1
- package/lib/migration/migration1/migrate-v1-data.d.ts +0 -8
- package/lib/migration/migration1/migrate-v1-data.d.ts.map +0 -1
- package/lib/migration/migration1/migrate-v1-data.js +0 -171
- package/lib/migration/migration1/migrate-v1-data.js.map +0 -1
- package/lib/migration/migration1/v1-data-store.d.ts +0 -15
- package/lib/migration/migration1/v1-data-store.d.ts.map +0 -1
- package/lib/migration/migration1/v1-data-store.js +0 -80
- package/lib/migration/migration1/v1-data-store.js.map +0 -1
- package/lib/migrations/1691498362273-bootstrap.d.ts +0 -7
- package/lib/migrations/1691498362273-bootstrap.d.ts.map +0 -1
- package/lib/migrations/1691498362273-bootstrap.js +0 -178
- package/lib/migrations/1691498362273-bootstrap.js.map +0 -1
- package/lib/migrations/index.d.ts +0 -4
- package/lib/migrations/index.d.ts.map +0 -1
- package/lib/migrations/index.js +0 -5
- package/lib/migrations/index.js.map +0 -1
- package/lib/migrations-data-source.d.ts +0 -3
- package/lib/migrations-data-source.d.ts.map +0 -1
- package/lib/migrations-data-source.js +0 -8
- package/lib/migrations-data-source.js.map +0 -1
- package/lib/typeorm.d.ts +0 -2
- package/lib/typeorm.d.ts.map +0 -1
- package/lib/typeorm.js +0 -18
- package/lib/typeorm.js.map +0 -1
- package/setup-tests.ts +0 -0
- package/src/entities/document/create-document.ts +0 -72
- package/src/entities/document/decument.entity.test.ts +0 -135
- package/src/entities/document/document.entity.ts +0 -40
- package/src/entities/document/get-all-documents.ts +0 -39
- package/src/entities/document/get-documens-by-type.ts +0 -30
- package/src/entities/document/get-document-by-id.ts +0 -45
- package/src/entities/document/get-document-correlations.ts +0 -34
- package/src/entities/document/helpers.ts +0 -115
- package/src/entities/document/index.ts +0 -9
- package/src/entities/document/remove-document.ts +0 -34
- package/src/entities/document/update-document.ts +0 -25
- package/src/entities/document-type.entity.ts +0 -11
- package/src/entities/log.entity.ts +0 -46
- package/src/entities/network.entity.ts +0 -14
- package/src/entities/transaction.entity.ts +0 -67
- package/src/entities/wallet.entity.ts +0 -37
- package/src/migration/bootstrap-tables.ts +0 -5
- package/src/migration/index.ts +0 -53
- package/src/migration/migration1/index.ts +0 -64
- package/src/migration/migration1/migrate-v1-data.ts +0 -57
- package/src/migration/migration1/v1-data-store.ts +0 -39
- package/src/migrations/1691498362273-bootstrap.ts +0 -130
- package/src/migrations/index.ts +0 -3
- package/src/migrations-data-source.ts +0 -6
- package/src/typeorm.ts +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"network.entity.d.ts","sourceRoot":"","sources":["../../src/entities/network.entity.ts"],"names":[],"mappings":"AAGA,qBACa,aAAa;IAExB,EAAE,EAAE,MAAM,CAAC;IAGX,IAAI,EAAE,MAAM,CAAC;IAGb,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.NetworkEntity = void 0;
|
|
13
|
-
var typeorm_1 = require("../typeorm");
|
|
14
|
-
var NetworkEntity = /** @class */ (function () {
|
|
15
|
-
function NetworkEntity() {
|
|
16
|
-
}
|
|
17
|
-
__decorate([
|
|
18
|
-
(0, typeorm_1.PrimaryColumn)(),
|
|
19
|
-
__metadata("design:type", String)
|
|
20
|
-
], NetworkEntity.prototype, "id", void 0);
|
|
21
|
-
__decorate([
|
|
22
|
-
(0, typeorm_1.Column)(),
|
|
23
|
-
__metadata("design:type", String)
|
|
24
|
-
], NetworkEntity.prototype, "name", void 0);
|
|
25
|
-
__decorate([
|
|
26
|
-
(0, typeorm_1.Column)(),
|
|
27
|
-
__metadata("design:type", String)
|
|
28
|
-
], NetworkEntity.prototype, "configs", void 0);
|
|
29
|
-
NetworkEntity = __decorate([
|
|
30
|
-
(0, typeorm_1.Entity)()
|
|
31
|
-
], NetworkEntity);
|
|
32
|
-
return NetworkEntity;
|
|
33
|
-
}());
|
|
34
|
-
exports.NetworkEntity = NetworkEntity;
|
|
35
|
-
//# sourceMappingURL=network.entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"network.entity.js","sourceRoot":"","sources":["../../src/entities/network.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sCAAyD;AAIzD;IAAA;IASA,CAAC;IAPC;QADC,IAAA,uBAAa,GAAE;;6CACL;IAGX;QADC,IAAA,gBAAM,GAAE;;+CACI;IAGb;QADC,IAAA,gBAAM,GAAE;;kDACO;IARL,aAAa;QADzB,IAAA,gBAAM,GAAE;OACI,aAAa,CASzB;IAAD,oBAAC;CAAA,AATD,IASC;AATY,sCAAa"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { DataStore } from '../types';
|
|
2
|
-
export declare class TransactionEntity {
|
|
3
|
-
id: string;
|
|
4
|
-
hash: string;
|
|
5
|
-
type: string;
|
|
6
|
-
error: string;
|
|
7
|
-
metadata: string;
|
|
8
|
-
date: Date;
|
|
9
|
-
fromAddress: string;
|
|
10
|
-
recipientAddress: string;
|
|
11
|
-
amount: string;
|
|
12
|
-
feeAmount: string;
|
|
13
|
-
network: string;
|
|
14
|
-
status: string;
|
|
15
|
-
retrySucceeded: boolean;
|
|
16
|
-
}
|
|
17
|
-
export declare function getLogs({ dataStore, }: {
|
|
18
|
-
dataStore: DataStore;
|
|
19
|
-
}): Promise<TransactionEntity[]>;
|
|
20
|
-
export declare function createTransaction({ dataStore, transaction, }: {
|
|
21
|
-
dataStore: DataStore;
|
|
22
|
-
transaction: TransactionEntity;
|
|
23
|
-
}): Promise<TransactionEntity>;
|
|
24
|
-
//# sourceMappingURL=transaction.entity.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.entity.d.ts","sourceRoot":"","sources":["../../src/entities/transaction.entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,qBACa,iBAAiB;IAE5B,EAAE,EAAE,MAAM,CAAC;IAGX,IAAI,EAAE,MAAM,CAAC;IAGb,IAAI,EAAE,MAAM,CAAC;IAGb,KAAK,EAAE,MAAM,CAAC;IAGd,QAAQ,EAAE,MAAM,CAAC;IAGjB,IAAI,EAAE,IAAI,CAAC;IAGX,WAAW,EAAE,MAAM,CAAC;IAGpB,gBAAgB,EAAE,MAAM,CAAC;IAGzB,MAAM,EAAE,MAAM,CAAC;IAGf,SAAS,EAAE,MAAM,CAAC;IAGlB,OAAO,EAAE,MAAM,CAAC;IAGhB,MAAM,EAAE,MAAM,CAAC;IAGf,cAAc,EAAE,OAAO,CAAC;CACzB;AAED,wBAAsB,OAAO,CAAC,EAC5B,SAAS,GACV,EAAE;IACD,SAAS,EAAE,SAAS,CAAC;CACtB,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAK/B;AAED,wBAAsB,iBAAiB,CAAC,EACtC,SAAS,EACT,WAAW,GACZ,EAAE;IACD,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,iBAAiB,CAAC;CAChC,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAI7B"}
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
13
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
14
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
15
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
16
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
17
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
21
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
22
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
23
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
24
|
-
function step(op) {
|
|
25
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
26
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
27
|
-
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;
|
|
28
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
29
|
-
switch (op[0]) {
|
|
30
|
-
case 0: case 1: t = op; break;
|
|
31
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
32
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
33
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
34
|
-
default:
|
|
35
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
36
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
37
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
38
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
39
|
-
if (t[2]) _.ops.pop();
|
|
40
|
-
_.trys.pop(); continue;
|
|
41
|
-
}
|
|
42
|
-
op = body.call(thisArg, _);
|
|
43
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
44
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
-
exports.createTransaction = exports.getLogs = exports.TransactionEntity = void 0;
|
|
49
|
-
var typeorm_1 = require("typeorm");
|
|
50
|
-
var TransactionEntity = /** @class */ (function () {
|
|
51
|
-
function TransactionEntity() {
|
|
52
|
-
}
|
|
53
|
-
__decorate([
|
|
54
|
-
(0, typeorm_1.PrimaryColumn)(),
|
|
55
|
-
__metadata("design:type", String)
|
|
56
|
-
], TransactionEntity.prototype, "id", void 0);
|
|
57
|
-
__decorate([
|
|
58
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
59
|
-
__metadata("design:type", String)
|
|
60
|
-
], TransactionEntity.prototype, "hash", void 0);
|
|
61
|
-
__decorate([
|
|
62
|
-
(0, typeorm_1.Column)({ default: 'transfer' }),
|
|
63
|
-
__metadata("design:type", String)
|
|
64
|
-
], TransactionEntity.prototype, "type", void 0);
|
|
65
|
-
__decorate([
|
|
66
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
67
|
-
__metadata("design:type", String)
|
|
68
|
-
], TransactionEntity.prototype, "error", void 0);
|
|
69
|
-
__decorate([
|
|
70
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
71
|
-
__metadata("design:type", String)
|
|
72
|
-
], TransactionEntity.prototype, "metadata", void 0);
|
|
73
|
-
__decorate([
|
|
74
|
-
(0, typeorm_1.Column)(),
|
|
75
|
-
__metadata("design:type", Date)
|
|
76
|
-
], TransactionEntity.prototype, "date", void 0);
|
|
77
|
-
__decorate([
|
|
78
|
-
(0, typeorm_1.Column)(),
|
|
79
|
-
__metadata("design:type", String)
|
|
80
|
-
], TransactionEntity.prototype, "fromAddress", void 0);
|
|
81
|
-
__decorate([
|
|
82
|
-
(0, typeorm_1.Column)(),
|
|
83
|
-
__metadata("design:type", String)
|
|
84
|
-
], TransactionEntity.prototype, "recipientAddress", void 0);
|
|
85
|
-
__decorate([
|
|
86
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
87
|
-
__metadata("design:type", String)
|
|
88
|
-
], TransactionEntity.prototype, "amount", void 0);
|
|
89
|
-
__decorate([
|
|
90
|
-
(0, typeorm_1.Column)(),
|
|
91
|
-
__metadata("design:type", String)
|
|
92
|
-
], TransactionEntity.prototype, "feeAmount", void 0);
|
|
93
|
-
__decorate([
|
|
94
|
-
(0, typeorm_1.Column)({ default: 'testnet' }),
|
|
95
|
-
__metadata("design:type", String)
|
|
96
|
-
], TransactionEntity.prototype, "network", void 0);
|
|
97
|
-
__decorate([
|
|
98
|
-
(0, typeorm_1.Column)(),
|
|
99
|
-
__metadata("design:type", String)
|
|
100
|
-
], TransactionEntity.prototype, "status", void 0);
|
|
101
|
-
__decorate([
|
|
102
|
-
(0, typeorm_1.Column)({ default: false }),
|
|
103
|
-
__metadata("design:type", Boolean)
|
|
104
|
-
], TransactionEntity.prototype, "retrySucceeded", void 0);
|
|
105
|
-
TransactionEntity = __decorate([
|
|
106
|
-
(0, typeorm_1.Entity)()
|
|
107
|
-
], TransactionEntity);
|
|
108
|
-
return TransactionEntity;
|
|
109
|
-
}());
|
|
110
|
-
exports.TransactionEntity = TransactionEntity;
|
|
111
|
-
function getLogs(_a) {
|
|
112
|
-
var dataStore = _a.dataStore;
|
|
113
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
114
|
-
var repository, entities;
|
|
115
|
-
return __generator(this, function (_b) {
|
|
116
|
-
switch (_b.label) {
|
|
117
|
-
case 0:
|
|
118
|
-
repository = dataStore.db.getRepository(TransactionEntity);
|
|
119
|
-
return [4 /*yield*/, repository.find({})];
|
|
120
|
-
case 1:
|
|
121
|
-
entities = _b.sent();
|
|
122
|
-
return [2 /*return*/, entities];
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
exports.getLogs = getLogs;
|
|
128
|
-
function createTransaction(_a) {
|
|
129
|
-
var dataStore = _a.dataStore, transaction = _a.transaction;
|
|
130
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
131
|
-
var repository;
|
|
132
|
-
return __generator(this, function (_b) {
|
|
133
|
-
repository = dataStore.db.getRepository(TransactionEntity);
|
|
134
|
-
return [2 /*return*/, repository.save(transaction)];
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
exports.createTransaction = createTransaction;
|
|
139
|
-
//# sourceMappingURL=transaction.entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.entity.js","sourceRoot":"","sources":["../../src/entities/transaction.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAwD;AAIxD;IAAA;IAuCA,CAAC;IArCC;QADC,IAAA,uBAAa,GAAE;;iDACL;IAGX;QADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACd;IAGb;QADC,IAAA,gBAAM,EAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;;mDACnB;IAGb;QADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oDACb;IAGd;QADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uDACV;IAGjB;QADC,IAAA,gBAAM,GAAE;kCACH,IAAI;mDAAC;IAGX;QADC,IAAA,gBAAM,GAAE;;0DACW;IAGpB;QADC,IAAA,gBAAM,GAAE;;+DACgB;IAGzB;QADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACZ;IAGf;QADC,IAAA,gBAAM,GAAE;;wDACS;IAGlB;QADC,IAAA,gBAAM,EAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;;sDACf;IAGhB;QADC,IAAA,gBAAM,GAAE;;qDACM;IAGf;QADC,IAAA,gBAAM,EAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;6DACH;IAtCb,iBAAiB;QAD7B,IAAA,gBAAM,GAAE;OACI,iBAAiB,CAuC7B;IAAD,wBAAC;CAAA,AAvCD,IAuCC;AAvCY,8CAAiB;AAyC9B,SAAsB,OAAO,CAAC,EAI7B;QAHC,SAAS,eAAA;;;;;;oBAIH,UAAU,GAAG,SAAS,CAAC,EAAE,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC;oBAChD,qBAAM,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,EAAA;;oBAApC,QAAQ,GAAG,SAAyB;oBAE1C,sBAAO,QAAQ,EAAC;;;;CACjB;AATD,0BASC;AAED,SAAsB,iBAAiB,CAAC,EAMvC;QALC,SAAS,eAAA,EACT,WAAW,iBAAA;;;;YAKL,UAAU,GAAG,SAAS,CAAC,EAAE,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC;YAEjE,sBAAO,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,EAAC;;;CACrC;AAVD,8CAUC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ContextProps } from '../types';
|
|
2
|
-
export declare class WalletEntity {
|
|
3
|
-
id: string;
|
|
4
|
-
version?: string;
|
|
5
|
-
networkId: string;
|
|
6
|
-
}
|
|
7
|
-
export declare function getWallet({ dataStore, }: ContextProps): Promise<WalletEntity>;
|
|
8
|
-
export declare function createWallet({ dataStore }: ContextProps): Promise<WalletEntity>;
|
|
9
|
-
export declare function updateWallet({ dataStore }: ContextProps): Promise<WalletEntity>;
|
|
10
|
-
//# sourceMappingURL=wallet.entity.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wallet.entity.d.ts","sourceRoot":"","sources":["../../src/entities/wallet.entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AAEtC,qBACa,YAAY;IAEvB,EAAE,EAAE,MAAM,CAAC;IAKX,OAAO,CAAC,EAAE,MAAM,CAAC;IAGjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAsB,SAAS,CAAC,EAC9B,SAAS,GACV,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAGtC;AAED,wBAAgB,YAAY,CAAC,EAAC,SAAS,EAAC,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAK7E;AAED,wBAAgB,YAAY,CAAC,EAAC,SAAS,EAAC,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAK7E"}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
14
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
16
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
17
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18
|
-
};
|
|
19
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
20
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
21
|
-
};
|
|
22
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
23
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
24
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
25
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
26
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
27
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
28
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
32
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
33
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
34
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
35
|
-
function step(op) {
|
|
36
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
37
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
38
|
-
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;
|
|
39
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
40
|
-
switch (op[0]) {
|
|
41
|
-
case 0: case 1: t = op; break;
|
|
42
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
43
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
44
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
45
|
-
default:
|
|
46
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
47
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
48
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
49
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
50
|
-
if (t[2]) _.ops.pop();
|
|
51
|
-
_.trys.pop(); continue;
|
|
52
|
-
}
|
|
53
|
-
op = body.call(thisArg, _);
|
|
54
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
55
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
|
-
exports.updateWallet = exports.createWallet = exports.getWallet = exports.WalletEntity = void 0;
|
|
60
|
-
var typeorm_1 = require("../typeorm");
|
|
61
|
-
var WalletEntity = /** @class */ (function () {
|
|
62
|
-
function WalletEntity() {
|
|
63
|
-
}
|
|
64
|
-
__decorate([
|
|
65
|
-
(0, typeorm_1.PrimaryColumn)(),
|
|
66
|
-
__metadata("design:type", String)
|
|
67
|
-
], WalletEntity.prototype, "id", void 0);
|
|
68
|
-
__decorate([
|
|
69
|
-
(0, typeorm_1.Column)({
|
|
70
|
-
nullable: true,
|
|
71
|
-
}),
|
|
72
|
-
__metadata("design:type", String)
|
|
73
|
-
], WalletEntity.prototype, "version", void 0);
|
|
74
|
-
__decorate([
|
|
75
|
-
(0, typeorm_1.Column)(),
|
|
76
|
-
__metadata("design:type", String)
|
|
77
|
-
], WalletEntity.prototype, "networkId", void 0);
|
|
78
|
-
WalletEntity = __decorate([
|
|
79
|
-
(0, typeorm_1.Entity)()
|
|
80
|
-
], WalletEntity);
|
|
81
|
-
return WalletEntity;
|
|
82
|
-
}());
|
|
83
|
-
exports.WalletEntity = WalletEntity;
|
|
84
|
-
function getWallet(_a) {
|
|
85
|
-
var dataStore = _a.dataStore;
|
|
86
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
87
|
-
var result;
|
|
88
|
-
return __generator(this, function (_b) {
|
|
89
|
-
switch (_b.label) {
|
|
90
|
-
case 0: return [4 /*yield*/, dataStore.db.getRepository(WalletEntity).find()];
|
|
91
|
-
case 1:
|
|
92
|
-
result = _b.sent();
|
|
93
|
-
return [2 /*return*/, result[0]];
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
exports.getWallet = getWallet;
|
|
99
|
-
function createWallet(_a) {
|
|
100
|
-
var dataStore = _a.dataStore;
|
|
101
|
-
return dataStore.db.getRepository(WalletEntity).save(__assign({ id: 'configs' }, dataStore));
|
|
102
|
-
}
|
|
103
|
-
exports.createWallet = createWallet;
|
|
104
|
-
function updateWallet(_a) {
|
|
105
|
-
var dataStore = _a.dataStore;
|
|
106
|
-
return dataStore.db.getRepository(WalletEntity).save(__assign({ id: 'configs' }, dataStore));
|
|
107
|
-
}
|
|
108
|
-
exports.updateWallet = updateWallet;
|
|
109
|
-
//# sourceMappingURL=wallet.entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wallet.entity.js","sourceRoot":"","sources":["../../src/entities/wallet.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAiF;AAIjF;IAAA;IAWA,CAAC;IATC;QADC,IAAA,uBAAa,GAAE;;4CACL;IAKX;QAHC,IAAA,gBAAM,EAAC;YACN,QAAQ,EAAE,IAAI;SACf,CAAC;;iDACe;IAGjB;QADC,IAAA,gBAAM,GAAE;;mDACS;IAVP,YAAY;QADxB,IAAA,gBAAM,GAAE;OACI,YAAY,CAWxB;IAAD,mBAAC;CAAA,AAXD,IAWC;AAXY,oCAAY;AAazB,SAAsB,SAAS,CAAC,EAEjB;QADb,SAAS,eAAA;;;;;wBAEM,qBAAM,SAAS,CAAC,EAAE,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,IAAI,EAAE,EAAA;;oBAA9D,MAAM,GAAG,SAAqD;oBACpE,sBAAO,MAAM,CAAC,CAAC,CAAC,EAAC;;;;CAClB;AALD,8BAKC;AAED,SAAgB,YAAY,CAAC,EAAyB;QAAxB,SAAS,eAAA;IACrC,OAAO,SAAS,CAAC,EAAE,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,IAAI,YAClD,EAAE,EAAE,SAAS,IACV,SAAS,EACZ,CAAC;AACL,CAAC;AALD,oCAKC;AAED,SAAgB,YAAY,CAAC,EAAyB;QAAxB,SAAS,eAAA;IACrC,OAAO,SAAS,CAAC,EAAE,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,IAAI,YAClD,EAAE,EAAE,SAAS,IACV,SAAS,EACZ,CAAC;AACL,CAAC;AALD,oCAKC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap-tables.d.ts","sourceRoot":"","sources":["../../src/migration/bootstrap-tables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AAEtC,wBAAgB,eAAe,CAAC,UAAU,EAAE,UAAU,QAErD"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.bootstrapTables = void 0;
|
|
4
|
-
function bootstrapTables(dataSource) {
|
|
5
|
-
// will be generated from typeorm once the schema is defined
|
|
6
|
-
}
|
|
7
|
-
exports.bootstrapTables = bootstrapTables;
|
|
8
|
-
//# sourceMappingURL=bootstrap-tables.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap-tables.js","sourceRoot":"","sources":["../../src/migration/bootstrap-tables.ts"],"names":[],"mappings":";;;AAEA,SAAgB,eAAe,CAAC,UAAsB;IACpD,4DAA4D;AAC9D,CAAC;AAFD,0CAEC"}
|
package/lib/migration/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ContextProps } from '../types';
|
|
2
|
-
export declare const CURRENT_DATA_STORE_VERSION = "v2";
|
|
3
|
-
export type MigrationResult = {
|
|
4
|
-
migrated: boolean;
|
|
5
|
-
version: string;
|
|
6
|
-
};
|
|
7
|
-
export declare function migrate({ dataStore }: ContextProps): Promise<void>;
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migration/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AAKtC,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAOF,wBAAsB,OAAO,CAAC,EAAC,SAAS,EAAC,EAAE,YAAY,iBAkCtD"}
|
package/lib/migration/index.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
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 (g && (g = 0, op[0] && (_ = 0)), _) 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
|
-
var __values = (this && this.__values) || function(o) {
|
|
39
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
40
|
-
if (m) return m.call(o);
|
|
41
|
-
if (o && typeof o.length === "number") return {
|
|
42
|
-
next: function () {
|
|
43
|
-
if (o && i >= o.length) o = void 0;
|
|
44
|
-
return { value: o && o[i++], done: !o };
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
48
|
-
};
|
|
49
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports.migrate = exports.CURRENT_DATA_STORE_VERSION = void 0;
|
|
51
|
-
var migration1_1 = require("./migration1");
|
|
52
|
-
var logger_1 = require("../logger");
|
|
53
|
-
var wallet_entity_1 = require("../entities/wallet.entity");
|
|
54
|
-
var bootstrap_tables_1 = require("./bootstrap-tables");
|
|
55
|
-
exports.CURRENT_DATA_STORE_VERSION = 'v2';
|
|
56
|
-
var migrations = [
|
|
57
|
-
migration1_1.migration1,
|
|
58
|
-
// add new migrations here
|
|
59
|
-
];
|
|
60
|
-
function migrate(_a) {
|
|
61
|
-
var dataStore = _a.dataStore;
|
|
62
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
63
|
-
var existingConfigs, isV1DataStore, migrations_1, migrations_1_1, migrate_1, results, e_1_1;
|
|
64
|
-
var e_1, _b;
|
|
65
|
-
return __generator(this, function (_c) {
|
|
66
|
-
switch (_c.label) {
|
|
67
|
-
case 0:
|
|
68
|
-
// bootstrap v2 data
|
|
69
|
-
return [4 /*yield*/, (0, bootstrap_tables_1.bootstrapTables)(dataStore.db)];
|
|
70
|
-
case 1:
|
|
71
|
-
// bootstrap v2 data
|
|
72
|
-
_c.sent();
|
|
73
|
-
return [4 /*yield*/, (0, wallet_entity_1.getWallet)({ dataStore: dataStore })];
|
|
74
|
-
case 2:
|
|
75
|
-
existingConfigs = _c.sent();
|
|
76
|
-
if (!!existingConfigs) return [3 /*break*/, 5];
|
|
77
|
-
logger_1.logger.debug('Wallet not found in the database, creating a new wallet...');
|
|
78
|
-
return [4 /*yield*/, (0, migration1_1.isRunningOnV1DataStore)({ dataStore: dataStore })];
|
|
79
|
-
case 3:
|
|
80
|
-
isV1DataStore = _c.sent();
|
|
81
|
-
logger_1.logger.debug("Is v1 data store: ".concat(isV1DataStore));
|
|
82
|
-
dataStore.version = isV1DataStore ? 'v1' : exports.CURRENT_DATA_STORE_VERSION;
|
|
83
|
-
return [4 /*yield*/, (0, wallet_entity_1.createWallet)({
|
|
84
|
-
dataStore: dataStore,
|
|
85
|
-
})];
|
|
86
|
-
case 4:
|
|
87
|
-
_c.sent();
|
|
88
|
-
logger_1.logger.debug('universal wallet created');
|
|
89
|
-
_c.label = 5;
|
|
90
|
-
case 5:
|
|
91
|
-
_c.trys.push([5, 12, 13, 14]);
|
|
92
|
-
migrations_1 = __values(migrations), migrations_1_1 = migrations_1.next();
|
|
93
|
-
_c.label = 6;
|
|
94
|
-
case 6:
|
|
95
|
-
if (!!migrations_1_1.done) return [3 /*break*/, 11];
|
|
96
|
-
migrate_1 = migrations_1_1.value;
|
|
97
|
-
return [4 /*yield*/, migrate_1({ dataStore: dataStore })];
|
|
98
|
-
case 7:
|
|
99
|
-
results = _c.sent();
|
|
100
|
-
if (!results.migrated) return [3 /*break*/, 9];
|
|
101
|
-
logger_1.logger.debug('Migration completed');
|
|
102
|
-
dataStore.version = results.version;
|
|
103
|
-
return [4 /*yield*/, (0, wallet_entity_1.updateWallet)({ dataStore: dataStore })];
|
|
104
|
-
case 8:
|
|
105
|
-
_c.sent();
|
|
106
|
-
return [3 /*break*/, 10];
|
|
107
|
-
case 9:
|
|
108
|
-
logger_1.logger.debug('Migration not required');
|
|
109
|
-
_c.label = 10;
|
|
110
|
-
case 10:
|
|
111
|
-
migrations_1_1 = migrations_1.next();
|
|
112
|
-
return [3 /*break*/, 6];
|
|
113
|
-
case 11: return [3 /*break*/, 14];
|
|
114
|
-
case 12:
|
|
115
|
-
e_1_1 = _c.sent();
|
|
116
|
-
e_1 = { error: e_1_1 };
|
|
117
|
-
return [3 /*break*/, 14];
|
|
118
|
-
case 13:
|
|
119
|
-
try {
|
|
120
|
-
if (migrations_1_1 && !migrations_1_1.done && (_b = migrations_1.return)) _b.call(migrations_1);
|
|
121
|
-
}
|
|
122
|
-
finally { if (e_1) throw e_1.error; }
|
|
123
|
-
return [7 /*endfinally*/];
|
|
124
|
-
case 14:
|
|
125
|
-
logger_1.logger.debug("DataStore version: ".concat(dataStore.version));
|
|
126
|
-
return [2 /*return*/];
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
exports.migrate = migrate;
|
|
132
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/migration/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAgE;AAEhE,oCAAiC;AACjC,2DAAgF;AAChF,uDAAmD;AAEtC,QAAA,0BAA0B,GAAG,IAAI,CAAC;AAO/C,IAAM,UAAU,GAAG;IACjB,uBAAU;IACV,0BAA0B;CAC3B,CAAC;AAEF,SAAsB,OAAO,CAAC,EAAyB;QAAxB,SAAS,eAAA;;;;;;;gBACtC,oBAAoB;gBACpB,qBAAM,IAAA,kCAAe,EAAC,SAAS,CAAC,EAAE,CAAC,EAAA;;oBADnC,oBAAoB;oBACpB,SAAmC,CAAC;oBAGd,qBAAM,IAAA,yBAAS,EAAC,EAAC,SAAS,WAAA,EAAC,CAAC,EAAA;;oBAA9C,eAAe,GAAG,SAA4B;yBAK9C,CAAC,eAAe,EAAhB,wBAAgB;oBAClB,eAAM,CAAC,KAAK,CAAC,4DAA4D,CAAC,CAAC;oBACrD,qBAAM,IAAA,mCAAsB,EAAC,EAAC,SAAS,WAAA,EAAC,CAAC,EAAA;;oBAAzD,aAAa,GAAG,SAAyC;oBAC/D,eAAM,CAAC,KAAK,CAAC,4BAAqB,aAAa,CAAE,CAAC,CAAC;oBACnD,SAAS,CAAC,OAAO,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,kCAA0B,CAAC;oBACtE,qBAAM,IAAA,4BAAY,EAAC;4BACjB,SAAS,WAAA;yBACV,CAAC,EAAA;;oBAFF,SAEE,CAAC;oBACH,eAAM,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;;;;oBAGrB,eAAA,SAAA,UAAU,CAAA;;;;oBAA3B;oBACa,qBAAM,SAAO,CAAC,EAAC,SAAS,WAAA,EAAC,CAAC,EAAA;;oBAApC,OAAO,GAAG,SAA0B;yBAEtC,OAAO,CAAC,QAAQ,EAAhB,wBAAgB;oBAClB,eAAM,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;oBACpC,SAAS,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;oBACpC,qBAAM,IAAA,4BAAY,EAAC,EAAC,SAAS,WAAA,EAAC,CAAC,EAAA;;oBAA/B,SAA+B,CAAC;;;oBAEhC,eAAM,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;;;;;;;;;;;;;;;;;oBAI3C,eAAM,CAAC,KAAK,CAAC,6BAAsB,SAAS,CAAC,OAAO,CAAE,CAAC,CAAC;;;;;CACzD;AAlCD,0BAkCC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { MigrationResult } from '../index';
|
|
2
|
-
import { ContextProps } from '../../types';
|
|
3
|
-
/**
|
|
4
|
-
* Migrate from v1 to v2
|
|
5
|
-
*
|
|
6
|
-
* v1 data store is stored in local storage
|
|
7
|
-
* v2 will store on typeorm
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
export declare function migration1({ dataStore, }: ContextProps): Promise<MigrationResult>;
|
|
11
|
-
/**
|
|
12
|
-
* Check if a migration from v2 is required
|
|
13
|
-
* Once v2 is migrated, the local storage entry will be removed
|
|
14
|
-
*/
|
|
15
|
-
export declare function isRunningOnV1DataStore({ dataStore, }: ContextProps): Promise<boolean>;
|
|
16
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/migration/migration1/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,eAAe,EAAC,MAAM,UAAU,CAAC;AACzC,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAEzC;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,EAC/B,SAAS,GACV,EAAE,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,CAmBzC;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,CAAC,EAC3C,SAAS,GACV,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAqBjC"}
|