@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":"create-document.js","sourceRoot":"","sources":["../../../src/entities/document/create-document.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,6BAAgC;AAChC,qDAAiD;AACjD,qCAAgE;AAChE,2DAAqD;AACrD,uCAAoC;AAEpC;;;;GAIG;AACH,SAAsB,cAAc,CAAC,EAKpC;QAJC,SAAS,eAAA,EACT,IAAI,UAAA;;;;;;oBAIJ,eAAM,CAAC,KAAK,CAAC,oCAA6B,IAAI,CAAC,EAAE,QAAK,CAAC,CAAC;yBAEpD,IAAI,CAAC,EAAE,EAAP,wBAAO;oBACgB,qBAAM,IAAA,oCAAe,EAAC;4BAC7C,SAAS,WAAA;4BACT,EAAE,EAAE,IAAI,CAAC,EAAE;yBACZ,CAAC,EAAA;;oBAHI,gBAAgB,GAAG,SAGvB;oBAEF,IAAI,gBAAgB,EAAE;wBACpB,eAAM,CAAC,KAAK,CAAC,2BAAoB,IAAI,CAAC,EAAE,oBAAiB,CAAC,CAAC;wBAC3D,MAAM,IAAI,KAAK,CAAC,2BAAoB,IAAI,CAAC,EAAE,oBAAiB,CAAC,CAAC;qBAC/D;;wBAGc,qBAAM,IAAA,kCAAwB,EAAC;wBAC9C,SAAS,WAAA;wBACT,KAAK,EAAE,IAAI,CAAC,IAAI;qBACjB,CAAC,EAAA;;oBAHI,QAAQ,GAAG,SAGf;oBAEF,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE;wBACZ,IAAI,CAAC,EAAE,GAAG,IAAA,SAAI,GAAE,CAAC;qBAClB;yBAIG,IAAI,CAAC,UAAU,EAAf,wBAAe;oBACjB,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC;oBAC5B,OAAO,IAAI,CAAC,UAAU,CAAC;;wBAEJ,qBAAM,SAAS,CAAC,sBAAsB,CAAC;wBACxD,QAAQ,EAAE,IAAI;wBACd,SAAS,WAAA;qBACV,CAAC,EAAA;;oBAHI,UAAU,GAAG,SAGjB;oBAEF,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;;;oBAG7B,MAAM,GAAmB;wBAC7B,SAAS,WAAA;wBACT,EAAE,EAAE,IAAI,CAAC,EAAE;wBACX,IAAI,EAAE,IAAI,CAAC,IAAI;wBACf,QAAQ,UAAA;wBACR,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,EAAE;wBACnC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;qBAC3B,CAAC;oBAEI,UAAU,GAAG,SAAS,CAAC,EAAE,CAAC,aAAa,CAAC,gCAAc,CAAC,CAAC;oBAE/C,qBAAM,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,qBAAW,CAAC,EAAA;;oBAAnD,MAAM,GAAG,SAA0C;oBAEzD,eAAM,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;oBAE7C,sBAAO,MAAM,EAAC;;;;CACf;AA3DD,wCA2DC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Relation } from '../../typeorm';
|
|
2
|
-
import { DocumentTypeEntity } from '../document-type.entity';
|
|
3
|
-
export declare class DocumentEntity {
|
|
4
|
-
id: string;
|
|
5
|
-
networkId: string;
|
|
6
|
-
type: string[];
|
|
7
|
-
_typeRel: Relation<DocumentTypeEntity[]>;
|
|
8
|
-
correlation: string[];
|
|
9
|
-
data: string;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=document.entity.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"document.entity.d.ts","sourceRoot":"","sources":["../../../src/entities/document/document.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,QAAQ,EACT,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,kBAAkB,EAAC,MAAM,yBAAyB,CAAC;AAE3D,qBACa,cAAc;IAEzB,EAAE,EAAE,MAAM,CAAC;IAKX,SAAS,EAAE,MAAM,CAAC;IAGlB,IAAI,EAAE,MAAM,EAAE,CAAC;IAQf,QAAQ,EAAE,QAAQ,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAMzC,WAAW,EAAE,MAAM,EAAE,CAAC;IAGtB,IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -1,55 +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.DocumentEntity = void 0;
|
|
13
|
-
var typeorm_1 = require("../../typeorm");
|
|
14
|
-
var document_type_entity_1 = require("../document-type.entity");
|
|
15
|
-
var DocumentEntity = /** @class */ (function () {
|
|
16
|
-
function DocumentEntity() {
|
|
17
|
-
}
|
|
18
|
-
__decorate([
|
|
19
|
-
(0, typeorm_1.PrimaryColumn)('text'),
|
|
20
|
-
__metadata("design:type", String)
|
|
21
|
-
], DocumentEntity.prototype, "id", void 0);
|
|
22
|
-
__decorate([
|
|
23
|
-
(0, typeorm_1.Column)('text', {
|
|
24
|
-
nullable: true,
|
|
25
|
-
}),
|
|
26
|
-
__metadata("design:type", String)
|
|
27
|
-
], DocumentEntity.prototype, "networkId", void 0);
|
|
28
|
-
__decorate([
|
|
29
|
-
(0, typeorm_1.Column)('simple-array'),
|
|
30
|
-
__metadata("design:type", Array)
|
|
31
|
-
], DocumentEntity.prototype, "type", void 0);
|
|
32
|
-
__decorate([
|
|
33
|
-
(0, typeorm_1.ManyToMany)(function () { return document_type_entity_1.DocumentTypeEntity; }, function (type) { return type === null || type === void 0 ? void 0 : type.documents; }, {
|
|
34
|
-
cascade: ['insert'],
|
|
35
|
-
eager: true,
|
|
36
|
-
nullable: true,
|
|
37
|
-
}),
|
|
38
|
-
(0, typeorm_1.JoinTable)(),
|
|
39
|
-
__metadata("design:type", Object)
|
|
40
|
-
], DocumentEntity.prototype, "_typeRel", void 0);
|
|
41
|
-
__decorate([
|
|
42
|
-
(0, typeorm_1.Column)('simple-array'),
|
|
43
|
-
__metadata("design:type", Array)
|
|
44
|
-
], DocumentEntity.prototype, "correlation", void 0);
|
|
45
|
-
__decorate([
|
|
46
|
-
(0, typeorm_1.Column)('blob'),
|
|
47
|
-
__metadata("design:type", String)
|
|
48
|
-
], DocumentEntity.prototype, "data", void 0);
|
|
49
|
-
DocumentEntity = __decorate([
|
|
50
|
-
(0, typeorm_1.Entity)()
|
|
51
|
-
], DocumentEntity);
|
|
52
|
-
return DocumentEntity;
|
|
53
|
-
}());
|
|
54
|
-
exports.DocumentEntity = DocumentEntity;
|
|
55
|
-
//# sourceMappingURL=document.entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"document.entity.js","sourceRoot":"","sources":["../../../src/entities/document/document.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAOuB;AACvB,gEAA2D;AAG3D;IAAA;IA4BA,CAAC;IA1BC;QADC,IAAA,uBAAa,EAAC,MAAM,CAAC;;8CACX;IAKX;QAHC,IAAA,gBAAM,EAAC,MAAM,EAAE;YACd,QAAQ,EAAE,IAAI;SACf,CAAC;;qDACgB;IAGlB;QADC,IAAA,gBAAM,EAAC,cAAc,CAAC;;gDACR;IAQf;QANC,IAAA,oBAAU,EAAC,cAAM,OAAA,yCAAkB,EAAlB,CAAkB,EAAE,UAAA,IAAI,IAAI,OAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,SAAS,EAAf,CAAe,EAAE;YAC7D,OAAO,EAAE,CAAC,QAAQ,CAAC;YACnB,KAAK,EAAE,IAAI;YACX,QAAQ,EAAE,IAAI;SACf,CAAC;QACD,IAAA,mBAAS,GAAE;;oDAC6B;IAMzC;QADC,IAAA,gBAAM,EAAC,cAAc,CAAC;;uDACD;IAGtB;QADC,IAAA,gBAAM,EAAC,MAAM,CAAC;;gDACF;IA3BF,cAAc;QAD1B,IAAA,gBAAM,GAAE;OACI,cAAc,CA4B1B;IAAD,qBAAC;CAAA,AA5BD,IA4BC;AA5BY,wCAAc"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { WalletDocument, DataStore } from '../../types';
|
|
2
|
-
/**
|
|
3
|
-
* Get all documents
|
|
4
|
-
*
|
|
5
|
-
* @param dataStore
|
|
6
|
-
*/
|
|
7
|
-
export declare function getAllDocuments({ dataStore, allNetworks, }: {
|
|
8
|
-
dataStore: DataStore;
|
|
9
|
-
allNetworks?: boolean;
|
|
10
|
-
}): Promise<WalletDocument[]>;
|
|
11
|
-
//# sourceMappingURL=get-all-documents.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-all-documents.d.ts","sourceRoot":"","sources":["../../../src/entities/document/get-all-documents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,SAAS,EAAC,MAAM,aAAa,CAAC;AActD;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,EACpC,SAAS,EACT,WAAW,GACZ,EAAE;IACD,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAa5B"}
|
|
@@ -1,78 +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.getAllDocuments = void 0;
|
|
40
|
-
var helpers_1 = require("./helpers");
|
|
41
|
-
var document_entity_1 = require("./document.entity");
|
|
42
|
-
function toWalletDocumentExpanded(entity) {
|
|
43
|
-
var result = (0, helpers_1.toWalletDocument)(entity);
|
|
44
|
-
if (result) {
|
|
45
|
-
result['_networkId'] = entity.networkId;
|
|
46
|
-
}
|
|
47
|
-
return result;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Get all documents
|
|
51
|
-
*
|
|
52
|
-
* @param dataStore
|
|
53
|
-
*/
|
|
54
|
-
function getAllDocuments(_a) {
|
|
55
|
-
var dataStore = _a.dataStore, allNetworks = _a.allNetworks;
|
|
56
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
57
|
-
var repository, entities, mapDocument;
|
|
58
|
-
return __generator(this, function (_b) {
|
|
59
|
-
switch (_b.label) {
|
|
60
|
-
case 0:
|
|
61
|
-
repository = dataStore.db.getRepository(document_entity_1.DocumentEntity);
|
|
62
|
-
return [4 /*yield*/, repository.find({
|
|
63
|
-
where: allNetworks
|
|
64
|
-
? {}
|
|
65
|
-
: {
|
|
66
|
-
networkId: dataStore.networkId,
|
|
67
|
-
},
|
|
68
|
-
})];
|
|
69
|
-
case 1:
|
|
70
|
-
entities = _b.sent();
|
|
71
|
-
mapDocument = allNetworks ? toWalletDocumentExpanded : helpers_1.toWalletDocument;
|
|
72
|
-
return [2 /*return*/, Promise.all(entities.map(mapDocument))];
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
exports.getAllDocuments = getAllDocuments;
|
|
78
|
-
//# sourceMappingURL=get-all-documents.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-all-documents.js","sourceRoot":"","sources":["../../../src/entities/document/get-all-documents.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qCAA2C;AAC3C,qDAAiD;AAEjD,SAAS,wBAAwB,CAAC,MAAsB;IACtD,IAAM,MAAM,GAAG,IAAA,0BAAgB,EAAC,MAAM,CAAC,CAAC;IAExC,IAAI,MAAM,EAAE;QACV,MAAM,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC;KACzC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,SAAsB,eAAe,CAAC,EAMrC;QALC,SAAS,eAAA,EACT,WAAW,iBAAA;;;;;;oBAKL,UAAU,GAAG,SAAS,CAAC,EAAE,CAAC,aAAa,CAAC,gCAAc,CAAC,CAAC;oBAC7C,qBAAM,UAAU,CAAC,IAAI,CAAC;4BACrC,KAAK,EAAE,WAAW;gCAChB,CAAC,CAAC,EAAE;gCACJ,CAAC,CAAC;oCACE,SAAS,EAAE,SAAS,CAAC,SAAS;iCAC/B;yBACN,CAAC,EAAA;;oBANI,QAAQ,GAAG,SAMf;oBAEI,WAAW,GAAG,WAAW,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,0BAAgB,CAAC;oBAE9E,sBAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,EAAC;;;;CAC/C;AAnBD,0CAmBC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ContextProps, WalletDocument } from '../../types';
|
|
2
|
-
/**
|
|
3
|
-
* Get documents by type
|
|
4
|
-
* @param dataStore
|
|
5
|
-
* @param type
|
|
6
|
-
*/
|
|
7
|
-
export declare function getDocumentsByType({ dataStore, type, }: ContextProps & {
|
|
8
|
-
type: string;
|
|
9
|
-
}): Promise<WalletDocument[]>;
|
|
10
|
-
//# sourceMappingURL=get-documens-by-type.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-documens-by-type.d.ts","sourceRoot":"","sources":["../../../src/entities/document/get-documens-by-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,cAAc,EAAC,MAAM,aAAa,CAAC;AAKzD;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,SAAS,EACT,IAAI,GACL,EAAE,YAAY,GAAG;IAChB,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAc5B"}
|
|
@@ -1,71 +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.getDocumentsByType = void 0;
|
|
40
|
-
var document_entity_1 = require("./document.entity");
|
|
41
|
-
var helpers_1 = require("./helpers");
|
|
42
|
-
/**
|
|
43
|
-
* Get documents by type
|
|
44
|
-
* @param dataStore
|
|
45
|
-
* @param type
|
|
46
|
-
*/
|
|
47
|
-
function getDocumentsByType(_a) {
|
|
48
|
-
var dataStore = _a.dataStore, type = _a.type;
|
|
49
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
50
|
-
var repository, documents, result;
|
|
51
|
-
return __generator(this, function (_b) {
|
|
52
|
-
switch (_b.label) {
|
|
53
|
-
case 0:
|
|
54
|
-
repository = dataStore.db.getRepository(document_entity_1.DocumentEntity);
|
|
55
|
-
documents = repository
|
|
56
|
-
.createQueryBuilder('document')
|
|
57
|
-
.leftJoinAndSelect('document._typeRel', 'documentType')
|
|
58
|
-
.where('documentType.id = :type', { type: type })
|
|
59
|
-
.andWhere('document.networkId = :networkId', {
|
|
60
|
-
networkId: dataStore.networkId,
|
|
61
|
-
});
|
|
62
|
-
return [4 /*yield*/, documents.getMany()];
|
|
63
|
-
case 1:
|
|
64
|
-
result = _b.sent();
|
|
65
|
-
return [2 /*return*/, result.map(helpers_1.toWalletDocument)];
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
exports.getDocumentsByType = getDocumentsByType;
|
|
71
|
-
//# sourceMappingURL=get-documens-by-type.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-documens-by-type.js","sourceRoot":"","sources":["../../../src/entities/document/get-documens-by-type.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qDAAiD;AAEjD,qCAA2C;AAE3C;;;;GAIG;AACH,SAAsB,kBAAkB,CAAC,EAKxC;QAJC,SAAS,eAAA,EACT,IAAI,UAAA;;;;;;oBAIE,UAAU,GAAG,SAAS,CAAC,EAAE,CAAC,aAAa,CAAC,gCAAc,CAAC,CAAC;oBAExD,SAAS,GAAG,UAAU;yBACzB,kBAAkB,CAAC,UAAU,CAAC;yBAC9B,iBAAiB,CAAC,mBAAmB,EAAE,cAAc,CAAC;yBACtD,KAAK,CAAC,yBAAyB,EAAE,EAAC,IAAI,MAAA,EAAC,CAAC;yBACxC,QAAQ,CAAC,iCAAiC,EAAE;wBAC3C,SAAS,EAAE,SAAS,CAAC,SAAS;qBAC/B,CAAC,CAAC;oBAEU,qBAAM,SAAS,CAAC,OAAO,EAAE,EAAA;;oBAAlC,MAAM,GAAG,SAAyB;oBAExC,sBAAO,MAAM,CAAC,GAAG,CAAC,0BAAgB,CAAC,EAAC;;;;CACrC;AAnBD,gDAmBC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ContextProps, WalletDocument } from '../../types';
|
|
2
|
-
/**
|
|
3
|
-
* Get document by id
|
|
4
|
-
* @param dataStore
|
|
5
|
-
* @param id
|
|
6
|
-
*/
|
|
7
|
-
export declare function getDocumentById({ dataStore, id, }: ContextProps & {
|
|
8
|
-
id: string;
|
|
9
|
-
}): Promise<WalletDocument>;
|
|
10
|
-
export declare function getDocumentsById({ dataStore, idList, }: ContextProps & {
|
|
11
|
-
idList: string[];
|
|
12
|
-
}): Promise<WalletDocument>;
|
|
13
|
-
//# sourceMappingURL=get-document-by-id.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-document-by-id.d.ts","sourceRoot":"","sources":["../../../src/entities/document/get-document-by-id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,cAAc,EAAC,MAAM,aAAa,CAAC;AAKzD;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,EACpC,SAAS,EACT,EAAE,GACH,EAAE,YAAY,GAAG;IAChB,EAAE,EAAE,MAAM,CAAC;CACZ,GAAG,OAAO,CAAC,cAAc,CAAC,CAW1B;AAED,wBAAsB,gBAAgB,CAAC,EACrC,SAAS,EACT,MAAM,GACP,EAAE,YAAY,GAAG;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,GAAG,OAAO,CAAC,cAAc,CAAC,CAW1B"}
|
|
@@ -1,92 +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.getDocumentsById = exports.getDocumentById = void 0;
|
|
40
|
-
var helpers_1 = require("./helpers");
|
|
41
|
-
var document_entity_1 = require("./document.entity");
|
|
42
|
-
var typeorm_1 = require("typeorm");
|
|
43
|
-
/**
|
|
44
|
-
* Get document by id
|
|
45
|
-
* @param dataStore
|
|
46
|
-
* @param id
|
|
47
|
-
*/
|
|
48
|
-
function getDocumentById(_a) {
|
|
49
|
-
var dataStore = _a.dataStore, id = _a.id;
|
|
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
|
-
repository = dataStore.db.getRepository(document_entity_1.DocumentEntity);
|
|
56
|
-
return [4 /*yield*/, repository.findOne({
|
|
57
|
-
where: {
|
|
58
|
-
id: id,
|
|
59
|
-
networkId: dataStore.networkId,
|
|
60
|
-
},
|
|
61
|
-
})];
|
|
62
|
-
case 1:
|
|
63
|
-
entity = _b.sent();
|
|
64
|
-
return [2 /*return*/, (0, helpers_1.toWalletDocument)(entity)];
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
exports.getDocumentById = getDocumentById;
|
|
70
|
-
function getDocumentsById(_a) {
|
|
71
|
-
var dataStore = _a.dataStore, idList = _a.idList;
|
|
72
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
73
|
-
var repository, entities;
|
|
74
|
-
return __generator(this, function (_b) {
|
|
75
|
-
switch (_b.label) {
|
|
76
|
-
case 0:
|
|
77
|
-
repository = dataStore.db.getRepository(document_entity_1.DocumentEntity);
|
|
78
|
-
return [4 /*yield*/, repository.find({
|
|
79
|
-
where: {
|
|
80
|
-
id: (0, typeorm_1.In)(idList),
|
|
81
|
-
networkId: dataStore.networkId,
|
|
82
|
-
},
|
|
83
|
-
})];
|
|
84
|
-
case 1:
|
|
85
|
-
entities = _b.sent();
|
|
86
|
-
return [2 /*return*/, entities.map(helpers_1.toWalletDocument)];
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
exports.getDocumentsById = getDocumentsById;
|
|
92
|
-
//# sourceMappingURL=get-document-by-id.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-document-by-id.js","sourceRoot":"","sources":["../../../src/entities/document/get-document-by-id.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qCAA2C;AAC3C,qDAAiD;AACjD,mCAA2B;AAE3B;;;;GAIG;AACH,SAAsB,eAAe,CAAC,EAKrC;QAJC,SAAS,eAAA,EACT,EAAE,QAAA;;;;;;oBAII,UAAU,GAAG,SAAS,CAAC,EAAE,CAAC,aAAa,CAAC,gCAAc,CAAC,CAAC;oBAE/C,qBAAM,UAAU,CAAC,OAAO,CAAC;4BACtC,KAAK,EAAE;gCACL,EAAE,EAAE,EAAE;gCACN,SAAS,EAAE,SAAS,CAAC,SAAS;6BAC/B;yBACF,CAAC,EAAA;;oBALI,MAAM,GAAG,SAKb;oBAEF,sBAAO,IAAA,0BAAgB,EAAC,MAAM,CAAC,EAAC;;;;CACjC;AAhBD,0CAgBC;AAED,SAAsB,gBAAgB,CAAC,EAKtC;QAJC,SAAS,eAAA,EACT,MAAM,YAAA;;;;;;oBAIA,UAAU,GAAG,SAAS,CAAC,EAAE,CAAC,aAAa,CAAC,gCAAc,CAAC,CAAC;oBAE7C,qBAAM,UAAU,CAAC,IAAI,CAAC;4BACrC,KAAK,EAAE;gCACL,EAAE,EAAE,IAAA,YAAE,EAAC,MAAM,CAAC;gCACd,SAAS,EAAE,SAAS,CAAC,SAAS;6BAC/B;yBACF,CAAC,EAAA;;oBALI,QAAQ,GAAG,SAKf;oBAEF,sBAAO,QAAQ,CAAC,GAAG,CAAC,0BAAgB,CAAC,EAAC;;;;CACvC;AAhBD,4CAgBC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ContextProps, WalletDocument } from '../../types';
|
|
2
|
-
/**
|
|
3
|
-
* Get related documents
|
|
4
|
-
* @param dataStore
|
|
5
|
-
* @param type
|
|
6
|
-
*/
|
|
7
|
-
export declare function getDocumentCorrelations({ dataStore, documentId, }: ContextProps & {
|
|
8
|
-
documentId: string;
|
|
9
|
-
}): Promise<WalletDocument[]>;
|
|
10
|
-
//# sourceMappingURL=get-document-correlations.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-document-correlations.d.ts","sourceRoot":"","sources":["../../../src/entities/document/get-document-correlations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,cAAc,EAAC,MAAM,aAAa,CAAC;AAKzD;;;;GAIG;AACH,wBAAsB,uBAAuB,CAAC,EAC5C,SAAS,EACT,UAAU,GACX,EAAE,YAAY,GAAG;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAkB5B"}
|
|
@@ -1,78 +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.getDocumentCorrelations = void 0;
|
|
40
|
-
var document_entity_1 = require("./document.entity");
|
|
41
|
-
var typeorm_1 = require("../../typeorm");
|
|
42
|
-
var helpers_1 = require("./helpers");
|
|
43
|
-
/**
|
|
44
|
-
* Get related documents
|
|
45
|
-
* @param dataStore
|
|
46
|
-
* @param type
|
|
47
|
-
*/
|
|
48
|
-
function getDocumentCorrelations(_a) {
|
|
49
|
-
var dataStore = _a.dataStore, documentId = _a.documentId;
|
|
50
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
51
|
-
var repository, entity, data;
|
|
52
|
-
return __generator(this, function (_b) {
|
|
53
|
-
switch (_b.label) {
|
|
54
|
-
case 0:
|
|
55
|
-
repository = dataStore.db.getRepository(document_entity_1.DocumentEntity);
|
|
56
|
-
return [4 /*yield*/, repository.findOne({
|
|
57
|
-
where: {
|
|
58
|
-
id: documentId,
|
|
59
|
-
networkId: dataStore.networkId,
|
|
60
|
-
},
|
|
61
|
-
})];
|
|
62
|
-
case 1:
|
|
63
|
-
entity = _b.sent();
|
|
64
|
-
return [4 /*yield*/, repository.find({
|
|
65
|
-
where: {
|
|
66
|
-
id: (0, typeorm_1.In)(entity.correlation),
|
|
67
|
-
networkId: dataStore.networkId,
|
|
68
|
-
},
|
|
69
|
-
})];
|
|
70
|
-
case 2:
|
|
71
|
-
data = _b.sent();
|
|
72
|
-
return [2 /*return*/, data.map(helpers_1.toWalletDocument)];
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
exports.getDocumentCorrelations = getDocumentCorrelations;
|
|
78
|
-
//# sourceMappingURL=get-document-correlations.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-document-correlations.js","sourceRoot":"","sources":["../../../src/entities/document/get-document-correlations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qDAAiD;AACjD,yCAAiC;AACjC,qCAA2C;AAE3C;;;;GAIG;AACH,SAAsB,uBAAuB,CAAC,EAK7C;QAJC,SAAS,eAAA,EACT,UAAU,gBAAA;;;;;;oBAIJ,UAAU,GAAG,SAAS,CAAC,EAAE,CAAC,aAAa,CAAC,gCAAc,CAAC,CAAC;oBAE/C,qBAAM,UAAU,CAAC,OAAO,CAAC;4BACtC,KAAK,EAAE;gCACL,EAAE,EAAE,UAAU;gCACd,SAAS,EAAE,SAAS,CAAC,SAAS;6BAC/B;yBACF,CAAC,EAAA;;oBALI,MAAM,GAAG,SAKb;oBAEW,qBAAM,UAAU,CAAC,IAAI,CAAC;4BACjC,KAAK,EAAE;gCACL,EAAE,EAAE,IAAA,YAAE,EAAC,MAAM,CAAC,WAAW,CAAC;gCAC1B,SAAS,EAAE,SAAS,CAAC,SAAS;6BAC/B;yBACF,CAAC,EAAA;;oBALI,IAAI,GAAG,SAKX;oBAEF,sBAAO,IAAI,CAAC,GAAG,CAAC,0BAAgB,CAAC,EAAC;;;;CACnC;AAvBD,0DAuBC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { ContextProps, WalletDocument } from '../../types';
|
|
2
|
-
import { DocumentTypeEntity } from '../document-type.entity';
|
|
3
|
-
import { DocumentEntity } from './document.entity';
|
|
4
|
-
/**
|
|
5
|
-
* Get document by id
|
|
6
|
-
* @param dataStore
|
|
7
|
-
* @param types
|
|
8
|
-
*/
|
|
9
|
-
export declare function getOrCreateDocumentTypes({ dataStore, types, }: ContextProps & {
|
|
10
|
-
types: string | string[];
|
|
11
|
-
}): Promise<DocumentTypeEntity[]>;
|
|
12
|
-
export declare function findDocumentEntitiesById({ dataStore, entityIds, }: ContextProps & {
|
|
13
|
-
entityIds: string[];
|
|
14
|
-
}): Promise<DocumentEntity[]>;
|
|
15
|
-
/**
|
|
16
|
-
* Convert document entity to wallet document
|
|
17
|
-
* @param entity
|
|
18
|
-
*/
|
|
19
|
-
export declare function toWalletDocument(entity: DocumentEntity): WalletDocument;
|
|
20
|
-
/**
|
|
21
|
-
* Convert wallet document to document entity
|
|
22
|
-
* @param walletDocument
|
|
23
|
-
*/
|
|
24
|
-
export declare function toDocumentEntity({ dataStore, document, }: ContextProps & {
|
|
25
|
-
document: any;
|
|
26
|
-
}): Promise<DocumentEntity>;
|
|
27
|
-
export declare const saveOptions: {
|
|
28
|
-
transaction: boolean;
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/entities/document/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,cAAc,EAAC,MAAM,aAAa,CAAC;AACzD,OAAO,EAAC,kBAAkB,EAAC,MAAM,yBAAyB,CAAC;AAG3D,OAAO,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAC;AAGjD;;;;GAIG;AACH,wBAAsB,wBAAwB,CAAC,EAC7C,SAAS,EACT,KAAK,GACN,EAAE,YAAY,GAAG;IAChB,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC1B,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CA+BhC;AAED,wBAAsB,wBAAwB,CAAC,EAC7C,SAAS,EACT,SAAS,GACV,EAAE,YAAY,GAAG;IAChB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAS5B;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CAYvE;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,SAAS,EACT,QAAQ,GACT,EAAE,YAAY,GAAG;IAChB,QAAQ,EAAE,GAAG,CAAC;CACf,GAAG,OAAO,CAAC,cAAc,CAAC,CAe1B;AAED,eAAO,MAAM,WAAW;;CAIvB,CAAC"}
|