@docknetwork/wallet-sdk-data-store 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +39 -0
- package/jest.config.ts +21 -0
- package/lib/configs.d.ts +3 -0
- package/lib/configs.d.ts.map +1 -0
- package/lib/configs.js +30 -0
- package/lib/configs.js.map +1 -0
- package/lib/document-network-resolver.d.ts +3 -0
- package/lib/document-network-resolver.d.ts.map +1 -0
- package/lib/document-network-resolver.js +52 -0
- package/lib/document-network-resolver.js.map +1 -0
- package/lib/entities/document/create-document.d.ts +10 -0
- package/lib/entities/document/create-document.d.ts.map +1 -0
- package/lib/entities/document/create-document.js +111 -0
- package/lib/entities/document/create-document.js.map +1 -0
- package/lib/entities/document/document.entity.d.ts +11 -0
- package/lib/entities/document/document.entity.d.ts.map +1 -0
- package/lib/entities/document/document.entity.js +55 -0
- package/lib/entities/document/document.entity.js.map +1 -0
- package/lib/entities/document/get-all-documents.d.ts +11 -0
- package/lib/entities/document/get-all-documents.d.ts.map +1 -0
- package/lib/entities/document/get-all-documents.js +78 -0
- package/lib/entities/document/get-all-documents.js.map +1 -0
- package/lib/entities/document/get-documens-by-type.d.ts +10 -0
- package/lib/entities/document/get-documens-by-type.d.ts.map +1 -0
- package/lib/entities/document/get-documens-by-type.js +71 -0
- package/lib/entities/document/get-documens-by-type.js.map +1 -0
- package/lib/entities/document/get-document-by-id.d.ts +13 -0
- package/lib/entities/document/get-document-by-id.d.ts.map +1 -0
- package/lib/entities/document/get-document-by-id.js +92 -0
- package/lib/entities/document/get-document-by-id.js.map +1 -0
- package/lib/entities/document/get-document-correlations.d.ts +10 -0
- package/lib/entities/document/get-document-correlations.d.ts.map +1 -0
- package/lib/entities/document/get-document-correlations.js +78 -0
- package/lib/entities/document/get-document-correlations.js.map +1 -0
- package/lib/entities/document/helpers.d.ts +30 -0
- package/lib/entities/document/helpers.d.ts.map +1 -0
- package/lib/entities/document/helpers.js +196 -0
- package/lib/entities/document/helpers.js.map +1 -0
- package/lib/entities/document/index.d.ts +10 -0
- package/lib/entities/document/index.d.ts.map +1 -0
- package/lib/entities/document/index.js +26 -0
- package/lib/entities/document/index.js.map +1 -0
- package/lib/entities/document/remove-document.d.ts +15 -0
- package/lib/entities/document/remove-document.d.ts.map +1 -0
- package/lib/entities/document/remove-document.js +94 -0
- package/lib/entities/document/remove-document.js.map +1 -0
- package/lib/entities/document/update-document.d.ts +10 -0
- package/lib/entities/document/update-document.d.ts.map +1 -0
- package/lib/entities/document/update-document.js +72 -0
- package/lib/entities/document/update-document.js.map +1 -0
- package/lib/entities/document-type.entity.d.ts +6 -0
- package/lib/entities/document-type.entity.d.ts.map +1 -0
- package/lib/entities/document-type.entity.js +32 -0
- package/lib/entities/document-type.entity.js.map +1 -0
- package/lib/entities/log.entity.d.ts +15 -0
- package/lib/entities/log.entity.d.ts.map +1 -0
- package/lib/entities/log.entity.js +108 -0
- package/lib/entities/log.entity.js.map +1 -0
- package/lib/entities/network.entity.d.ts +6 -0
- package/lib/entities/network.entity.d.ts.map +1 -0
- package/lib/entities/network.entity.js +35 -0
- package/lib/entities/network.entity.js.map +1 -0
- package/lib/entities/transaction.entity.d.ts +24 -0
- package/lib/entities/transaction.entity.d.ts.map +1 -0
- package/lib/entities/transaction.entity.js +139 -0
- package/lib/entities/transaction.entity.js.map +1 -0
- package/lib/entities/wallet.entity.d.ts +10 -0
- package/lib/entities/wallet.entity.d.ts.map +1 -0
- package/lib/entities/wallet.entity.js +109 -0
- package/lib/entities/wallet.entity.js.map +1 -0
- package/lib/helpers.d.ts +6 -0
- package/lib/helpers.d.ts.map +1 -0
- package/lib/helpers.js +98 -0
- package/lib/helpers.js.map +1 -0
- package/lib/index.d.ts +14 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +145 -0
- package/lib/index.js.map +1 -0
- package/lib/logger.d.ts +14 -0
- package/lib/logger.d.ts.map +1 -0
- package/lib/logger.js +40 -0
- package/lib/logger.js.map +1 -0
- package/lib/migration/bootstrap-tables.d.ts +3 -0
- package/lib/migration/bootstrap-tables.d.ts.map +1 -0
- package/lib/migration/bootstrap-tables.js +8 -0
- package/lib/migration/bootstrap-tables.js.map +1 -0
- package/lib/migration/index.d.ts +8 -0
- package/lib/migration/index.d.ts.map +1 -0
- package/lib/migration/index.js +132 -0
- package/lib/migration/index.js.map +1 -0
- package/lib/migration/migration1/index.d.ts +16 -0
- package/lib/migration/migration1/index.d.ts.map +1 -0
- package/lib/migration/migration1/index.js +110 -0
- package/lib/migration/migration1/index.js.map +1 -0
- package/lib/migration/migration1/migrate-v1-data.d.ts +8 -0
- package/lib/migration/migration1/migrate-v1-data.d.ts.map +1 -0
- package/lib/migration/migration1/migrate-v1-data.js +171 -0
- package/lib/migration/migration1/migrate-v1-data.js.map +1 -0
- package/lib/migration/migration1/v1-data-store.d.ts +15 -0
- package/lib/migration/migration1/v1-data-store.d.ts.map +1 -0
- package/lib/migration/migration1/v1-data-store.js +80 -0
- package/lib/migration/migration1/v1-data-store.js.map +1 -0
- package/lib/migrations/1691498362273-bootstrap.d.ts +7 -0
- package/lib/migrations/1691498362273-bootstrap.d.ts.map +1 -0
- package/lib/migrations/1691498362273-bootstrap.js +178 -0
- package/lib/migrations/1691498362273-bootstrap.js.map +1 -0
- package/lib/migrations/index.d.ts +4 -0
- package/lib/migrations/index.d.ts.map +1 -0
- package/lib/migrations/index.js +5 -0
- package/lib/migrations/index.js.map +1 -0
- package/lib/migrations-data-source.d.ts +3 -0
- package/lib/migrations-data-source.d.ts.map +1 -0
- package/lib/migrations-data-source.js +8 -0
- package/lib/migrations-data-source.js.map +1 -0
- package/lib/typeorm.d.ts +2 -0
- package/lib/typeorm.d.ts.map +1 -0
- package/lib/typeorm.js +18 -0
- package/lib/typeorm.js.map +1 -0
- package/lib/types.d.ts +49 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +3 -0
- package/lib/types.js.map +1 -0
- package/package.json +31 -0
- package/scripts/publish.sh +3 -0
- package/setup-tests.ts +0 -0
- package/src/__tests__/index.test.ts +56 -0
- package/src/__tests__/v1-data-store.test.ts +24 -0
- package/src/configs.ts +28 -0
- package/src/document-network-resolver.ts +19 -0
- package/src/entities/document/create-document.ts +72 -0
- package/src/entities/document/decument.entity.test.ts +135 -0
- package/src/entities/document/document.entity.ts +40 -0
- package/src/entities/document/get-all-documents.ts +39 -0
- package/src/entities/document/get-documens-by-type.ts +30 -0
- package/src/entities/document/get-document-by-id.ts +45 -0
- package/src/entities/document/get-document-correlations.ts +34 -0
- package/src/entities/document/helpers.ts +115 -0
- package/src/entities/document/index.ts +9 -0
- package/src/entities/document/remove-document.ts +34 -0
- package/src/entities/document/update-document.ts +25 -0
- package/src/entities/document-type.entity.ts +11 -0
- package/src/entities/log.entity.ts +46 -0
- package/src/entities/network.entity.ts +14 -0
- package/src/entities/transaction.entity.ts +67 -0
- package/src/entities/wallet.entity.ts +37 -0
- package/src/helpers.ts +52 -0
- package/src/index.ts +83 -0
- package/src/logger.ts +37 -0
- package/src/migration/bootstrap-tables.ts +5 -0
- package/src/migration/index.ts +53 -0
- package/src/migration/migration1/index.ts +64 -0
- package/src/migration/migration1/migrate-v1-data.ts +57 -0
- package/src/migration/migration1/v1-data-store.ts +39 -0
- package/src/migrations/1691498362273-bootstrap.ts +130 -0
- package/src/migrations/index.ts +3 -0
- package/src/migrations-data-source.ts +6 -0
- package/src/typeorm.ts +1 -0
- package/src/types.ts +67 -0
- package/test/mock-local-storage.ts +17 -0
- package/test/test-utils.ts +23 -0
- package/test/wallet.json +209 -0
- package/tsconfig.build.json +25 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +32 -0
|
@@ -0,0 +1,72 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.updateDocument = void 0;
|
|
40
|
+
var helpers_1 = require("./helpers");
|
|
41
|
+
var document_entity_1 = require("./document.entity");
|
|
42
|
+
var logger_1 = require("../../logger");
|
|
43
|
+
/**
|
|
44
|
+
* Update document
|
|
45
|
+
* @param dataStore
|
|
46
|
+
* @param document
|
|
47
|
+
*/
|
|
48
|
+
function updateDocument(_a) {
|
|
49
|
+
var dataStore = _a.dataStore, document = _a.document;
|
|
50
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
51
|
+
var repository, entity;
|
|
52
|
+
return __generator(this, function (_b) {
|
|
53
|
+
switch (_b.label) {
|
|
54
|
+
case 0:
|
|
55
|
+
logger_1.logger.debug("Updating document with id ".concat(document.id));
|
|
56
|
+
repository = dataStore.db.getRepository(document_entity_1.DocumentEntity);
|
|
57
|
+
return [4 /*yield*/, (0, helpers_1.toDocumentEntity)({
|
|
58
|
+
dataStore: dataStore,
|
|
59
|
+
document: document,
|
|
60
|
+
})];
|
|
61
|
+
case 1:
|
|
62
|
+
entity = _b.sent();
|
|
63
|
+
return [4 /*yield*/, repository.save(entity, helpers_1.saveOptions)];
|
|
64
|
+
case 2:
|
|
65
|
+
_b.sent();
|
|
66
|
+
return [2 /*return*/, document];
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
exports.updateDocument = updateDocument;
|
|
72
|
+
//# sourceMappingURL=update-document.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-document.js","sourceRoot":"","sources":["../../../src/entities/document/update-document.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qCAA0D;AAC1D,qDAAmD;AACnD,uCAAsC;AAEtC;;;;GAIG;AACH,SAAsB,cAAc,CAAC,EAGO;QAF1C,SAAS,eAAA,EACT,QAAQ,cAAA;;;;;;oBAER,eAAM,CAAC,KAAK,CAAC,oCAA6B,QAAQ,CAAC,EAAE,CAAE,CAAC,CAAC;oBAEnD,UAAU,GAAG,SAAS,CAAC,EAAE,CAAC,aAAa,CAAC,gCAAc,CAAC,CAAC;oBAC/C,qBAAM,IAAA,0BAAgB,EAAC;4BACpC,SAAS,WAAA;4BACT,QAAQ,UAAA;yBACT,CAAC,EAAA;;oBAHI,MAAM,GAAG,SAGb;oBACF,qBAAM,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,qBAAW,CAAC,EAAA;;oBAA1C,SAA0C,CAAC;oBAE3C,sBAAO,QAAQ,EAAC;;;;CACjB;AAdD,wCAcC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-type.entity.d.ts","sourceRoot":"","sources":["../../src/entities/document-type.entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,cAAc,EAAC,MAAM,4BAA4B,CAAC;AAE1D,qBACa,kBAAkB;IAE7B,EAAE,EAAE,MAAM,CAAC;IAGX,SAAS,EAAE,cAAc,EAAE,CAAC;CAC7B"}
|
|
@@ -0,0 +1,32 @@
|
|
|
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.DocumentTypeEntity = void 0;
|
|
13
|
+
var typeorm_1 = require("../typeorm");
|
|
14
|
+
var document_entity_1 = require("./document/document.entity");
|
|
15
|
+
var DocumentTypeEntity = /** @class */ (function () {
|
|
16
|
+
function DocumentTypeEntity() {
|
|
17
|
+
}
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, typeorm_1.PrimaryColumn)('text'),
|
|
20
|
+
__metadata("design:type", String)
|
|
21
|
+
], DocumentTypeEntity.prototype, "id", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, typeorm_1.ManyToMany)(function () { return document_entity_1.DocumentEntity; }, function (document) { return document._typeRel; }),
|
|
24
|
+
__metadata("design:type", Array)
|
|
25
|
+
], DocumentTypeEntity.prototype, "documents", void 0);
|
|
26
|
+
DocumentTypeEntity = __decorate([
|
|
27
|
+
(0, typeorm_1.Entity)()
|
|
28
|
+
], DocumentTypeEntity);
|
|
29
|
+
return DocumentTypeEntity;
|
|
30
|
+
}());
|
|
31
|
+
exports.DocumentTypeEntity = DocumentTypeEntity;
|
|
32
|
+
//# sourceMappingURL=document-type.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-type.entity.js","sourceRoot":"","sources":["../../src/entities/document-type.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sCAAqE;AACrE,8DAA0D;AAG1D;IAAA;IAMA,CAAC;IAJC;QADC,IAAA,uBAAa,EAAC,MAAM,CAAC;;kDACX;IAGX;QADC,IAAA,oBAAU,EAAC,cAAM,OAAA,gCAAc,EAAd,CAAc,EAAE,UAAA,QAAQ,IAAI,OAAA,QAAQ,CAAC,QAAQ,EAAjB,CAAiB,CAAC;;yDACpC;IALjB,kBAAkB;QAD9B,IAAA,gBAAM,GAAE;OACI,kBAAkB,CAM9B;IAAD,yBAAC;CAAA,AAND,IAMC;AANY,gDAAkB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DataStore } from '../types';
|
|
2
|
+
export declare class LogEntity {
|
|
3
|
+
id: string;
|
|
4
|
+
level: string;
|
|
5
|
+
value: string;
|
|
6
|
+
createdAt: Date;
|
|
7
|
+
}
|
|
8
|
+
export declare function getLogs({ dataStore, }: {
|
|
9
|
+
dataStore: DataStore;
|
|
10
|
+
}): Promise<LogEntity[]>;
|
|
11
|
+
export declare function createLog({ dataStore, log, }: {
|
|
12
|
+
dataStore: DataStore;
|
|
13
|
+
log: LogEntity;
|
|
14
|
+
}): Promise<LogEntity>;
|
|
15
|
+
//# sourceMappingURL=log.entity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.entity.d.ts","sourceRoot":"","sources":["../../src/entities/log.entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,SAAS,EAAC,MAAM,UAAU,CAAC;AAEjD,qBACa,SAAS;IAEpB,EAAE,EAAE,MAAM,CAAC;IAGX,KAAK,EAAE,MAAM,CAAC;IAGd,KAAK,EAAE,MAAM,CAAC;IAGd,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,wBAAsB,OAAO,CAAC,EAC5B,SAAS,GACV,EAAE;IACD,SAAS,EAAE,SAAS,CAAC;CACtB,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CASvB;AAED,wBAAsB,SAAS,CAAC,EAC9B,SAAS,EACT,GAAG,GACJ,EAAE;IACD,SAAS,EAAE,SAAS,CAAC;IACrB,GAAG,EAAE,SAAS,CAAC;CAChB,GAAG,OAAO,CAAC,SAAS,CAAC,CAMrB"}
|
|
@@ -0,0 +1,108 @@
|
|
|
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.createLog = exports.getLogs = exports.LogEntity = void 0;
|
|
49
|
+
var typeorm_1 = require("../typeorm");
|
|
50
|
+
var LogEntity = /** @class */ (function () {
|
|
51
|
+
function LogEntity() {
|
|
52
|
+
}
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, typeorm_1.PrimaryColumn)(),
|
|
55
|
+
__metadata("design:type", String)
|
|
56
|
+
], LogEntity.prototype, "id", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, typeorm_1.Column)(),
|
|
59
|
+
__metadata("design:type", String)
|
|
60
|
+
], LogEntity.prototype, "level", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
(0, typeorm_1.Column)(),
|
|
63
|
+
__metadata("design:type", String)
|
|
64
|
+
], LogEntity.prototype, "value", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, typeorm_1.Column)(),
|
|
67
|
+
__metadata("design:type", Date)
|
|
68
|
+
], LogEntity.prototype, "createdAt", void 0);
|
|
69
|
+
LogEntity = __decorate([
|
|
70
|
+
(0, typeorm_1.Entity)()
|
|
71
|
+
], LogEntity);
|
|
72
|
+
return LogEntity;
|
|
73
|
+
}());
|
|
74
|
+
exports.LogEntity = LogEntity;
|
|
75
|
+
function getLogs(_a) {
|
|
76
|
+
var dataStore = _a.dataStore;
|
|
77
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
78
|
+
var repository, entities;
|
|
79
|
+
return __generator(this, function (_b) {
|
|
80
|
+
switch (_b.label) {
|
|
81
|
+
case 0:
|
|
82
|
+
repository = dataStore.db.getRepository(LogEntity);
|
|
83
|
+
return [4 /*yield*/, repository.find({
|
|
84
|
+
order: {
|
|
85
|
+
createdAt: 'DESC',
|
|
86
|
+
},
|
|
87
|
+
})];
|
|
88
|
+
case 1:
|
|
89
|
+
entities = _b.sent();
|
|
90
|
+
return [2 /*return*/, entities];
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
exports.getLogs = getLogs;
|
|
96
|
+
function createLog(_a) {
|
|
97
|
+
var dataStore = _a.dataStore, log = _a.log;
|
|
98
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
99
|
+
var repository;
|
|
100
|
+
return __generator(this, function (_b) {
|
|
101
|
+
repository = dataStore.db.getRepository(LogEntity);
|
|
102
|
+
log.createdAt = new Date();
|
|
103
|
+
return [2 /*return*/, repository.save(log)];
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
exports.createLog = createLog;
|
|
108
|
+
//# sourceMappingURL=log.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.entity.js","sourceRoot":"","sources":["../../src/entities/log.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAyD;AAIzD;IAAA;IAYA,CAAC;IAVC;QADC,IAAA,uBAAa,GAAE;;yCACL;IAGX;QADC,IAAA,gBAAM,GAAE;;4CACK;IAGd;QADC,IAAA,gBAAM,GAAE;;4CACK;IAGd;QADC,IAAA,gBAAM,GAAE;kCACE,IAAI;gDAAC;IAXL,SAAS;QADrB,IAAA,gBAAM,GAAE;OACI,SAAS,CAYrB;IAAD,gBAAC;CAAA,AAZD,IAYC;AAZY,8BAAS;AActB,SAAsB,OAAO,CAAC,EAI7B;QAHC,SAAS,eAAA;;;;;;oBAIH,UAAU,GAAG,SAAS,CAAC,EAAE,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;oBACxC,qBAAM,UAAU,CAAC,IAAI,CAAC;4BACrC,KAAK,EAAE;gCACL,SAAS,EAAE,MAAM;6BAClB;yBACF,CAAC,EAAA;;oBAJI,QAAQ,GAAG,SAIf;oBAEF,sBAAO,QAAQ,EAAC;;;;CACjB;AAbD,0BAaC;AAED,SAAsB,SAAS,CAAC,EAM/B;QALC,SAAS,eAAA,EACT,GAAG,SAAA;;;;YAKG,UAAU,GAAG,SAAS,CAAC,EAAE,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;YAEzD,GAAG,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;YAE3B,sBAAO,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAC;;;CAC7B;AAZD,8BAYC"}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,139 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,109 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
package/lib/helpers.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DataSource } from './typeorm';
|
|
2
|
+
import { DataStoreConfigs } from './types';
|
|
3
|
+
export declare function documentHasType(document: any, type: string): any;
|
|
4
|
+
export declare function getDataSource(options: DataStoreConfigs): DataSource;
|
|
5
|
+
export declare function initializeTypeORM(options: DataStoreConfigs): Promise<DataSource>;
|
|
6
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,WAAW,CAAC;AAGrC,OAAO,EAAC,gBAAgB,EAAC,MAAM,SAAS,CAAC;AASzC,wBAAgB,eAAe,CAAC,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,OAM1D;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,gBAAgB,cAetD;AAED,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,uBAchE"}
|