@docknetwork/wallet-sdk-data-store 0.4.19 → 0.4.22
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,196 +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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
-
};
|
|
52
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.saveOptions = exports.toDocumentEntity = exports.toWalletDocument = exports.findDocumentEntitiesById = exports.getOrCreateDocumentTypes = void 0;
|
|
54
|
-
var document_type_entity_1 = require("../document-type.entity");
|
|
55
|
-
var assert_1 = __importDefault(require("assert"));
|
|
56
|
-
var logger_1 = require("../../logger");
|
|
57
|
-
var document_entity_1 = require("./document.entity");
|
|
58
|
-
var typeorm_1 = require("../../typeorm");
|
|
59
|
-
/**
|
|
60
|
-
* Get document by id
|
|
61
|
-
* @param dataStore
|
|
62
|
-
* @param types
|
|
63
|
-
*/
|
|
64
|
-
function getOrCreateDocumentTypes(_a) {
|
|
65
|
-
var dataStore = _a.dataStore, types = _a.types;
|
|
66
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
67
|
-
var typeRepository, typeEntityList, types_1, types_1_1, type, typeEntity, e_1_1;
|
|
68
|
-
var e_1, _b;
|
|
69
|
-
return __generator(this, function (_c) {
|
|
70
|
-
switch (_c.label) {
|
|
71
|
-
case 0:
|
|
72
|
-
(0, assert_1.default)(!!types, 'Document type must be provided');
|
|
73
|
-
logger_1.logger.debug("getOrCreateDocumentTypes: ".concat(JSON.stringify(types)));
|
|
74
|
-
if (!Array.isArray(types)) {
|
|
75
|
-
types = [types];
|
|
76
|
-
}
|
|
77
|
-
typeRepository = dataStore.db.getRepository(document_type_entity_1.DocumentTypeEntity);
|
|
78
|
-
typeEntityList = [];
|
|
79
|
-
_c.label = 1;
|
|
80
|
-
case 1:
|
|
81
|
-
_c.trys.push([1, 8, 9, 10]);
|
|
82
|
-
types_1 = __values(types), types_1_1 = types_1.next();
|
|
83
|
-
_c.label = 2;
|
|
84
|
-
case 2:
|
|
85
|
-
if (!!types_1_1.done) return [3 /*break*/, 7];
|
|
86
|
-
type = types_1_1.value;
|
|
87
|
-
return [4 /*yield*/, typeRepository.findOne({
|
|
88
|
-
where: {
|
|
89
|
-
id: type,
|
|
90
|
-
},
|
|
91
|
-
})];
|
|
92
|
-
case 3:
|
|
93
|
-
typeEntity = _c.sent();
|
|
94
|
-
if (!!typeEntity) return [3 /*break*/, 5];
|
|
95
|
-
typeEntity = typeRepository.create({
|
|
96
|
-
id: type,
|
|
97
|
-
});
|
|
98
|
-
return [4 /*yield*/, typeRepository.save(typeEntity)];
|
|
99
|
-
case 4:
|
|
100
|
-
_c.sent();
|
|
101
|
-
_c.label = 5;
|
|
102
|
-
case 5:
|
|
103
|
-
typeEntityList.push(typeEntity);
|
|
104
|
-
_c.label = 6;
|
|
105
|
-
case 6:
|
|
106
|
-
types_1_1 = types_1.next();
|
|
107
|
-
return [3 /*break*/, 2];
|
|
108
|
-
case 7: return [3 /*break*/, 10];
|
|
109
|
-
case 8:
|
|
110
|
-
e_1_1 = _c.sent();
|
|
111
|
-
e_1 = { error: e_1_1 };
|
|
112
|
-
return [3 /*break*/, 10];
|
|
113
|
-
case 9:
|
|
114
|
-
try {
|
|
115
|
-
if (types_1_1 && !types_1_1.done && (_b = types_1.return)) _b.call(types_1);
|
|
116
|
-
}
|
|
117
|
-
finally { if (e_1) throw e_1.error; }
|
|
118
|
-
return [7 /*endfinally*/];
|
|
119
|
-
case 10: return [2 /*return*/, typeEntityList];
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
exports.getOrCreateDocumentTypes = getOrCreateDocumentTypes;
|
|
125
|
-
function findDocumentEntitiesById(_a) {
|
|
126
|
-
var dataStore = _a.dataStore, entityIds = _a.entityIds;
|
|
127
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
128
|
-
var repository, entities;
|
|
129
|
-
return __generator(this, function (_b) {
|
|
130
|
-
switch (_b.label) {
|
|
131
|
-
case 0:
|
|
132
|
-
(0, assert_1.default)(!!entityIds, 'Document ids must be provided');
|
|
133
|
-
repository = dataStore.db.getRepository(document_entity_1.DocumentEntity);
|
|
134
|
-
return [4 /*yield*/, repository.findBy({
|
|
135
|
-
id: (0, typeorm_1.In)(entityIds),
|
|
136
|
-
})];
|
|
137
|
-
case 1:
|
|
138
|
-
entities = _b.sent();
|
|
139
|
-
return [2 /*return*/, entities];
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
exports.findDocumentEntitiesById = findDocumentEntitiesById;
|
|
145
|
-
/**
|
|
146
|
-
* Convert document entity to wallet document
|
|
147
|
-
* @param entity
|
|
148
|
-
*/
|
|
149
|
-
function toWalletDocument(entity) {
|
|
150
|
-
if (!entity) {
|
|
151
|
-
return entity;
|
|
152
|
-
}
|
|
153
|
-
var result = JSON.parse(entity.data);
|
|
154
|
-
if (!result.id) {
|
|
155
|
-
result.id = entity.id;
|
|
156
|
-
}
|
|
157
|
-
return result;
|
|
158
|
-
}
|
|
159
|
-
exports.toWalletDocument = toWalletDocument;
|
|
160
|
-
/**
|
|
161
|
-
* Convert wallet document to document entity
|
|
162
|
-
* @param walletDocument
|
|
163
|
-
*/
|
|
164
|
-
function toDocumentEntity(_a) {
|
|
165
|
-
var dataStore = _a.dataStore, document = _a.document;
|
|
166
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
167
|
-
var type, _typeRel;
|
|
168
|
-
return __generator(this, function (_b) {
|
|
169
|
-
switch (_b.label) {
|
|
170
|
-
case 0:
|
|
171
|
-
type = document.type || [];
|
|
172
|
-
return [4 /*yield*/, getOrCreateDocumentTypes({
|
|
173
|
-
dataStore: dataStore,
|
|
174
|
-
types: document.type,
|
|
175
|
-
})];
|
|
176
|
-
case 1:
|
|
177
|
-
_typeRel = _b.sent();
|
|
178
|
-
return [2 /*return*/, {
|
|
179
|
-
id: document.id,
|
|
180
|
-
type: type,
|
|
181
|
-
data: JSON.stringify(document),
|
|
182
|
-
_typeRel: _typeRel,
|
|
183
|
-
correlation: document.correlation || [],
|
|
184
|
-
networkId: dataStore.networkId,
|
|
185
|
-
}];
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
exports.toDocumentEntity = toDocumentEntity;
|
|
191
|
-
exports.saveOptions = {
|
|
192
|
-
// Android is having issues when running multiple document saves in a short period of time
|
|
193
|
-
// We will disable transactions for now until we find a better solution
|
|
194
|
-
transaction: false,
|
|
195
|
-
};
|
|
196
|
-
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/entities/document/helpers.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from './document.entity';
|
|
2
|
-
export * from './create-document';
|
|
3
|
-
export * from './helpers';
|
|
4
|
-
export * from './get-documens-by-type';
|
|
5
|
-
export * from './get-document-by-id';
|
|
6
|
-
export * from './get-all-documents';
|
|
7
|
-
export * from './update-document';
|
|
8
|
-
export * from './remove-document';
|
|
9
|
-
export * from './get-document-correlations';
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/entities/document/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./document.entity"), exports);
|
|
18
|
-
__exportStar(require("./create-document"), exports);
|
|
19
|
-
__exportStar(require("./helpers"), exports);
|
|
20
|
-
__exportStar(require("./get-documens-by-type"), exports);
|
|
21
|
-
__exportStar(require("./get-document-by-id"), exports);
|
|
22
|
-
__exportStar(require("./get-all-documents"), exports);
|
|
23
|
-
__exportStar(require("./update-document"), exports);
|
|
24
|
-
__exportStar(require("./remove-document"), exports);
|
|
25
|
-
__exportStar(require("./get-document-correlations"), exports);
|
|
26
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/entities/document/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,oDAAkC;AAClC,4CAA0B;AAC1B,yDAAuC;AACvC,uDAAqC;AACrC,sDAAoC;AACpC,oDAAkC;AAClC,oDAAkC;AAClC,8DAA4C"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ContextProps } from '../../types';
|
|
2
|
-
/**
|
|
3
|
-
* Remove document
|
|
4
|
-
* @param dataStore
|
|
5
|
-
* @param id
|
|
6
|
-
*/
|
|
7
|
-
export declare function removeDocument({ dataStore, id, }: ContextProps & {
|
|
8
|
-
id: string;
|
|
9
|
-
}): Promise<void>;
|
|
10
|
-
/**
|
|
11
|
-
* Remove all documents
|
|
12
|
-
* @param dataStore
|
|
13
|
-
*/
|
|
14
|
-
export declare function removeAllDocuments({ dataStore, }: ContextProps): Promise<void>;
|
|
15
|
-
//# sourceMappingURL=remove-document.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remove-document.d.ts","sourceRoot":"","sources":["../../../src/entities/document/remove-document.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAIzC;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,EACnC,SAAS,EACT,EAAE,GACH,EAAE,YAAY,GAAG;IAAC,EAAE,EAAE,MAAM,CAAA;CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAS7C;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,SAAS,GACV,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAG9B"}
|
|
@@ -1,94 +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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.removeAllDocuments = exports.removeDocument = void 0;
|
|
43
|
-
var assert_1 = __importDefault(require("assert"));
|
|
44
|
-
var document_entity_1 = require("./document.entity");
|
|
45
|
-
var logger_1 = require("../../logger");
|
|
46
|
-
/**
|
|
47
|
-
* Remove document
|
|
48
|
-
* @param dataStore
|
|
49
|
-
* @param id
|
|
50
|
-
*/
|
|
51
|
-
function removeDocument(_a) {
|
|
52
|
-
var dataStore = _a.dataStore, id = _a.id;
|
|
53
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
54
|
-
var repository;
|
|
55
|
-
return __generator(this, function (_b) {
|
|
56
|
-
switch (_b.label) {
|
|
57
|
-
case 0:
|
|
58
|
-
(0, assert_1.default)(!!id, 'Document id is required');
|
|
59
|
-
logger_1.logger.debug("Removing document with id ".concat(id));
|
|
60
|
-
repository = dataStore.db.getRepository(document_entity_1.DocumentEntity);
|
|
61
|
-
return [4 /*yield*/, repository.delete({
|
|
62
|
-
id: id,
|
|
63
|
-
networkId: dataStore.networkId,
|
|
64
|
-
})];
|
|
65
|
-
case 1:
|
|
66
|
-
_b.sent();
|
|
67
|
-
return [2 /*return*/];
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
exports.removeDocument = removeDocument;
|
|
73
|
-
/**
|
|
74
|
-
* Remove all documents
|
|
75
|
-
* @param dataStore
|
|
76
|
-
*/
|
|
77
|
-
function removeAllDocuments(_a) {
|
|
78
|
-
var dataStore = _a.dataStore;
|
|
79
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
80
|
-
var repository;
|
|
81
|
-
return __generator(this, function (_b) {
|
|
82
|
-
switch (_b.label) {
|
|
83
|
-
case 0:
|
|
84
|
-
repository = dataStore.db.getRepository(document_entity_1.DocumentEntity);
|
|
85
|
-
return [4 /*yield*/, repository.delete({})];
|
|
86
|
-
case 1:
|
|
87
|
-
_b.sent();
|
|
88
|
-
return [2 /*return*/];
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
exports.removeAllDocuments = removeAllDocuments;
|
|
94
|
-
//# sourceMappingURL=remove-document.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remove-document.js","sourceRoot":"","sources":["../../../src/entities/document/remove-document.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA4B;AAE5B,qDAAiD;AACjD,uCAAsC;AAEtC;;;;GAIG;AACH,SAAsB,cAAc,CAAC,EAGP;QAF5B,SAAS,eAAA,EACT,EAAE,QAAA;;;;;;oBAEF,IAAA,gBAAM,EAAC,CAAC,CAAC,EAAE,EAAE,yBAAyB,CAAC,CAAC;oBAExC,eAAM,CAAC,KAAK,CAAC,oCAA6B,EAAE,CAAE,CAAC,CAAC;oBAC1C,UAAU,GAAG,SAAS,CAAC,EAAE,CAAC,aAAa,CAAC,gCAAc,CAAC,CAAC;oBAC9D,qBAAM,UAAU,CAAC,MAAM,CAAC;4BACtB,EAAE,IAAA;4BACF,SAAS,EAAE,SAAS,CAAC,SAAS;yBAC/B,CAAC,EAAA;;oBAHF,SAGE,CAAC;;;;;CACJ;AAZD,wCAYC;AAED;;;GAGG;AACH,SAAsB,kBAAkB,CAAC,EAE1B;QADb,SAAS,eAAA;;;;;;oBAEH,UAAU,GAAG,SAAS,CAAC,EAAE,CAAC,aAAa,CAAC,gCAAc,CAAC,CAAC;oBAC9D,qBAAM,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,EAAA;;oBAA3B,SAA2B,CAAC;;;;;CAC7B;AALD,gDAKC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ContextProps, WalletDocument } from '../../types';
|
|
2
|
-
/**
|
|
3
|
-
* Update document
|
|
4
|
-
* @param dataStore
|
|
5
|
-
* @param document
|
|
6
|
-
*/
|
|
7
|
-
export declare function updateDocument({ dataStore, document, }: ContextProps & {
|
|
8
|
-
document: WalletDocument;
|
|
9
|
-
}): Promise<WalletDocument>;
|
|
10
|
-
//# sourceMappingURL=update-document.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-document.d.ts","sourceRoot":"","sources":["../../../src/entities/document/update-document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAK3D;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,EACnC,SAAS,EACT,QAAQ,GACT,EAAE,YAAY,GAAG;IAAC,QAAQ,EAAE,cAAc,CAAA;CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAWrE"}
|
|
@@ -1,72 +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
|
-
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,32 +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.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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,15 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,108 +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.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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|