@docknetwork/wallet-sdk-data-store-typeorm 1.7.0 → 1.7.7-alpha.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/lib/entities/document/create-document.js +7 -7
- package/lib/entities/document/create-document.js.map +1 -1
- package/lib/entities/document/get-all-documents.js +8 -9
- package/lib/entities/document/get-all-documents.js.map +1 -1
- package/lib/entities/document/get-documens-by-type.js +8 -9
- package/lib/entities/document/get-documens-by-type.js.map +1 -1
- package/lib/entities/document/get-document-by-id.js +14 -15
- package/lib/entities/document/get-document-by-id.js.map +1 -1
- package/lib/entities/document/get-document-correlations.js +9 -10
- package/lib/entities/document/get-document-correlations.js.map +1 -1
- package/lib/entities/document/helpers.js +31 -31
- package/lib/entities/document/helpers.js.map +1 -1
- package/lib/entities/document/remove-document.js +14 -15
- package/lib/entities/document/remove-document.js.map +1 -1
- package/lib/entities/document/update-document.js +6 -7
- package/lib/entities/document/update-document.js.map +1 -1
- package/lib/entities/log.entity.js +13 -13
- package/lib/entities/log.entity.js.map +1 -1
- package/lib/entities/wallet.entity.js +11 -11
- package/lib/entities/wallet.entity.js.map +1 -1
- package/lib/helpers.js +5 -6
- package/lib/helpers.js.map +1 -1
- package/lib/index.js +3 -4
- package/lib/index.js.map +1 -1
- package/lib/logger.d.ts.map +1 -1
- package/lib/logger.js +2 -2
- package/lib/logger.js.map +1 -1
- package/lib/migration/bootstrap-tables.js +1 -2
- package/lib/migration/bootstrap-tables.js.map +1 -1
- package/lib/migration/index.js +21 -21
- package/lib/migration/index.js.map +1 -1
- package/lib/migration/migration1/index.js +14 -15
- package/lib/migration/migration1/index.js.map +1 -1
- package/lib/migration/migration1/migrate-v1-data.js +19 -20
- package/lib/migration/migration1/migrate-v1-data.js.map +1 -1
- package/lib/migration/migration1/v1-data-store.js +5 -6
- package/lib/migration/migration1/v1-data-store.js.map +1 -1
- package/lib/migrations/1691498362273-bootstrap.js +2 -2
- package/lib/migrations/1691498362273-bootstrap.js.map +1 -1
- package/package.json +5 -5
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
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 =
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -36,7 +36,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.writeMutex = void 0;
|
|
40
|
+
exports.createDocument = createDocument;
|
|
40
41
|
var types_1 = require("@docknetwork/wallet-sdk-data-store/lib/types");
|
|
41
42
|
var uuid_1 = require("uuid");
|
|
42
43
|
var document_entity_1 = require("./document.entity");
|
|
@@ -52,10 +53,10 @@ exports.writeMutex = new async_mutex_1.Mutex();
|
|
|
52
53
|
* @param json
|
|
53
54
|
*/
|
|
54
55
|
function createDocument(_a) {
|
|
55
|
-
|
|
56
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
56
|
+
return __awaiter(this, arguments, void 0, function (_b) {
|
|
57
57
|
var _this = this;
|
|
58
|
-
|
|
58
|
+
var dataStore = _b.dataStore, json = _b.json, options = _b.options;
|
|
59
|
+
return __generator(this, function (_c) {
|
|
59
60
|
return [2 /*return*/, exports.writeMutex.runExclusive(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
60
61
|
var existingDocument, _typeRel, networkId, resolution, entity, db, repository, result;
|
|
61
62
|
return __generator(this, function (_a) {
|
|
@@ -123,5 +124,4 @@ function createDocument(_a) {
|
|
|
123
124
|
});
|
|
124
125
|
});
|
|
125
126
|
}
|
|
126
|
-
exports.createDocument = createDocument;
|
|
127
127
|
//# sourceMappingURL=create-document.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-document.js","sourceRoot":"","sources":["../../../src/entities/document/create-document.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"create-document.js","sourceRoot":"","sources":["../../../src/entities/document/create-document.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,wCAsEC;AA1FD,sEAIsD;AACtD,6BAAgC;AAChC,qDAAiD;AACjD,qCAAgE;AAChE,2DAAqD;AACrD,uCAAoC;AACpC,yCAA4C;AAC5C,2CAAkC;AAErB,QAAA,UAAU,GAAG,IAAI,mBAAK,EAAE,CAAC;AAEtC;;;;GAIG;AACH,SAAsB,cAAc;wDAAC,EAOpC;;YANC,SAAS,eAAA,EACT,IAAI,UAAA,EACJ,OAAO,aAAA;;YAKP,sBAAO,kBAAU,CAAC,YAAY,CAAC;;;;;gCAC7B,eAAM,CAAC,KAAK,CAAC,oCAA6B,IAAI,CAAC,EAAE,QAAK,CAAC,CAAC;qCACpD,IAAI,CAAC,EAAE,EAAP,wBAAO;gCACgB,qBAAM,IAAA,oCAAe,EAAC;wCAC7C,SAAS,WAAA;wCACT,EAAE,EAAE,IAAI,CAAC,EAAE;qCACZ,CAAC,EAAA;;gCAHI,gBAAgB,GAAG,SAGvB;gCAEF,IAAI,gBAAgB,EAAE,CAAC;oCACrB,eAA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BAAP,OAAO,CAAE,eAAe,CAAA,EAAE,CAAC;oCAC9B,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,uBAAe,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;gCAC/D,CAAC;qCAAM,CAAC;oCACN,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;gCACzC,CAAC;gCAED,eAAM,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;gCAE7C,sBAAO,MAAM,EAAC;;;qBACf,CAAC,EAAC;;;CACJ"}
|
|
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
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 =
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.getAllDocuments =
|
|
39
|
+
exports.getAllDocuments = getAllDocuments;
|
|
40
40
|
var helpers_1 = require("./helpers");
|
|
41
41
|
var document_entity_1 = require("./document.entity");
|
|
42
42
|
var helpers_2 = require("../../helpers");
|
|
@@ -53,11 +53,11 @@ function toWalletDocumentExpanded(entity) {
|
|
|
53
53
|
* @param dataStore
|
|
54
54
|
*/
|
|
55
55
|
function getAllDocuments(_a) {
|
|
56
|
-
|
|
57
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
56
|
+
return __awaiter(this, arguments, void 0, function (_b) {
|
|
58
57
|
var db, repository, entities, mapDocument;
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
var dataStore = _b.dataStore, allNetworks = _b.allNetworks;
|
|
59
|
+
return __generator(this, function (_c) {
|
|
60
|
+
switch (_c.label) {
|
|
61
61
|
case 0:
|
|
62
62
|
db = (0, helpers_2.getDataSource)(dataStore);
|
|
63
63
|
repository = db.getRepository(document_entity_1.DocumentEntity);
|
|
@@ -69,12 +69,11 @@ function getAllDocuments(_a) {
|
|
|
69
69
|
},
|
|
70
70
|
})];
|
|
71
71
|
case 1:
|
|
72
|
-
entities =
|
|
72
|
+
entities = _c.sent();
|
|
73
73
|
mapDocument = allNetworks ? toWalletDocumentExpanded : helpers_1.toWalletDocument;
|
|
74
74
|
return [2 /*return*/, Promise.all(entities.map(mapDocument))];
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
|
-
exports.getAllDocuments = getAllDocuments;
|
|
80
79
|
//# sourceMappingURL=get-all-documents.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-all-documents.js","sourceRoot":"","sources":["../../../src/entities/document/get-all-documents.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-all-documents.js","sourceRoot":"","sources":["../../../src/entities/document/get-all-documents.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,0CAoBC;AAvCD,qCAA2C;AAC3C,qDAAiD;AACjD,yCAA8C;AAE9C,SAAS,wBAAwB,CAAC,MAAsB;IACtD,IAAM,MAAM,GAAG,IAAA,0BAAgB,EAAC,MAAM,CAAC,CAAC;IAExC,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC;IAC1C,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,SAAsB,eAAe;wDAAC,EAMrC;;YALC,SAAS,eAAA,EACT,WAAW,iBAAA;;;;oBAKL,EAAE,GAAG,IAAA,uBAAa,EAAC,SAAS,CAAC,CAAC;oBAC9B,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,gCAAc,CAAC,CAAC;oBACnC,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"}
|
|
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
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 =
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.getDocumentsByType =
|
|
39
|
+
exports.getDocumentsByType = getDocumentsByType;
|
|
40
40
|
var document_entity_1 = require("./document.entity");
|
|
41
41
|
var helpers_1 = require("./helpers");
|
|
42
42
|
var helpers_2 = require("../../helpers");
|
|
@@ -46,11 +46,11 @@ var helpers_2 = require("../../helpers");
|
|
|
46
46
|
* @param type
|
|
47
47
|
*/
|
|
48
48
|
function getDocumentsByType(_a) {
|
|
49
|
-
|
|
50
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
49
|
+
return __awaiter(this, arguments, void 0, function (_b) {
|
|
51
50
|
var db, repository, documents, result;
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
var dataStore = _b.dataStore, type = _b.type;
|
|
52
|
+
return __generator(this, function (_c) {
|
|
53
|
+
switch (_c.label) {
|
|
54
54
|
case 0:
|
|
55
55
|
db = (0, helpers_2.getDataSource)(dataStore);
|
|
56
56
|
repository = db.getRepository(document_entity_1.DocumentEntity);
|
|
@@ -63,11 +63,10 @@ function getDocumentsByType(_a) {
|
|
|
63
63
|
});
|
|
64
64
|
return [4 /*yield*/, documents.getMany()];
|
|
65
65
|
case 1:
|
|
66
|
-
result =
|
|
66
|
+
result = _c.sent();
|
|
67
67
|
return [2 /*return*/, result.map(helpers_1.toWalletDocument)];
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
-
exports.getDocumentsByType = getDocumentsByType;
|
|
73
72
|
//# sourceMappingURL=get-documens-by-type.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-documens-by-type.js","sourceRoot":"","sources":["../../../src/entities/document/get-documens-by-type.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-documens-by-type.js","sourceRoot":"","sources":["../../../src/entities/document/get-documens-by-type.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,gDAoBC;AA9BD,qDAAiD;AAEjD,qCAA2C;AAC3C,yCAA8C;AAE9C;;;;GAIG;AACH,SAAsB,kBAAkB;wDAAC,EAKxC;;YAJC,SAAS,eAAA,EACT,IAAI,UAAA;;;;oBAIE,EAAE,GAAG,IAAA,uBAAa,EAAC,SAAS,CAAC,CAAC;oBAC9B,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,gCAAc,CAAC,CAAC;oBAE9C,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"}
|
|
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
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 =
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -36,7 +36,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.getDocumentById = getDocumentById;
|
|
40
|
+
exports.getDocumentsById = getDocumentsById;
|
|
40
41
|
var helpers_1 = require("./helpers");
|
|
41
42
|
var document_entity_1 = require("./document.entity");
|
|
42
43
|
var typeorm_1 = require("typeorm");
|
|
@@ -47,11 +48,11 @@ var helpers_2 = require("../../helpers");
|
|
|
47
48
|
* @param id
|
|
48
49
|
*/
|
|
49
50
|
function getDocumentById(_a) {
|
|
50
|
-
|
|
51
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
51
|
+
return __awaiter(this, arguments, void 0, function (_b) {
|
|
52
52
|
var db, repository, entity;
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
var dataStore = _b.dataStore, id = _b.id;
|
|
54
|
+
return __generator(this, function (_c) {
|
|
55
|
+
switch (_c.label) {
|
|
55
56
|
case 0:
|
|
56
57
|
db = (0, helpers_2.getDataSource)(dataStore);
|
|
57
58
|
repository = db.getRepository(document_entity_1.DocumentEntity);
|
|
@@ -62,19 +63,18 @@ function getDocumentById(_a) {
|
|
|
62
63
|
},
|
|
63
64
|
})];
|
|
64
65
|
case 1:
|
|
65
|
-
entity =
|
|
66
|
+
entity = _c.sent();
|
|
66
67
|
return [2 /*return*/, (0, helpers_1.toWalletDocument)(entity)];
|
|
67
68
|
}
|
|
68
69
|
});
|
|
69
70
|
});
|
|
70
71
|
}
|
|
71
|
-
exports.getDocumentById = getDocumentById;
|
|
72
72
|
function getDocumentsById(_a) {
|
|
73
|
-
|
|
74
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
73
|
+
return __awaiter(this, arguments, void 0, function (_b) {
|
|
75
74
|
var db, repository, entities;
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
var dataStore = _b.dataStore, idList = _b.idList;
|
|
76
|
+
return __generator(this, function (_c) {
|
|
77
|
+
switch (_c.label) {
|
|
78
78
|
case 0:
|
|
79
79
|
db = (0, helpers_2.getDataSource)(dataStore);
|
|
80
80
|
repository = db.getRepository(document_entity_1.DocumentEntity);
|
|
@@ -85,11 +85,10 @@ function getDocumentsById(_a) {
|
|
|
85
85
|
},
|
|
86
86
|
})];
|
|
87
87
|
case 1:
|
|
88
|
-
entities =
|
|
88
|
+
entities = _c.sent();
|
|
89
89
|
return [2 /*return*/, entities.map(helpers_1.toWalletDocument)];
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
|
-
exports.getDocumentsById = getDocumentsById;
|
|
95
94
|
//# sourceMappingURL=get-document-by-id.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-document-by-id.js","sourceRoot":"","sources":["../../../src/entities/document/get-document-by-id.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-document-by-id.js","sourceRoot":"","sources":["../../../src/entities/document/get-document-by-id.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,0CAiBC;AAED,4CAiBC;AA9CD,qCAA2C;AAC3C,qDAAiD;AACjD,mCAA2B;AAC3B,yCAA8C;AAE9C;;;;GAIG;AACH,SAAsB,eAAe;wDAAC,EAKrC;;YAJC,SAAS,eAAA,EACT,EAAE,QAAA;;;;oBAII,EAAE,GAAG,IAAA,uBAAa,EAAC,SAAS,CAAC,CAAC;oBAC9B,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,gCAAc,CAAC,CAAC;oBAErC,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;AAED,SAAsB,gBAAgB;wDAAC,EAKtC;;YAJC,SAAS,eAAA,EACT,MAAM,YAAA;;;;oBAIA,EAAE,GAAG,IAAA,uBAAa,EAAC,SAAS,CAAC,CAAC;oBAC9B,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,gCAAc,CAAC,CAAC;oBAEnC,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"}
|
|
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
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 =
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.getDocumentCorrelations =
|
|
39
|
+
exports.getDocumentCorrelations = getDocumentCorrelations;
|
|
40
40
|
var document_entity_1 = require("./document.entity");
|
|
41
41
|
var typeorm_1 = require("../../typeorm");
|
|
42
42
|
var helpers_1 = require("./helpers");
|
|
@@ -47,11 +47,11 @@ var helpers_2 = require("../../helpers");
|
|
|
47
47
|
* @param type
|
|
48
48
|
*/
|
|
49
49
|
function getDocumentCorrelations(_a) {
|
|
50
|
-
|
|
51
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
50
|
+
return __awaiter(this, arguments, void 0, function (_b) {
|
|
52
51
|
var db, repository, entity, data;
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
var dataStore = _b.dataStore, documentId = _b.documentId;
|
|
53
|
+
return __generator(this, function (_c) {
|
|
54
|
+
switch (_c.label) {
|
|
55
55
|
case 0:
|
|
56
56
|
db = (0, helpers_2.getDataSource)(dataStore);
|
|
57
57
|
repository = db.getRepository(document_entity_1.DocumentEntity);
|
|
@@ -62,7 +62,7 @@ function getDocumentCorrelations(_a) {
|
|
|
62
62
|
},
|
|
63
63
|
})];
|
|
64
64
|
case 1:
|
|
65
|
-
entity =
|
|
65
|
+
entity = _c.sent();
|
|
66
66
|
return [4 /*yield*/, repository.find({
|
|
67
67
|
where: {
|
|
68
68
|
id: (0, typeorm_1.In)(entity.correlation),
|
|
@@ -70,11 +70,10 @@ function getDocumentCorrelations(_a) {
|
|
|
70
70
|
},
|
|
71
71
|
})];
|
|
72
72
|
case 2:
|
|
73
|
-
data =
|
|
73
|
+
data = _c.sent();
|
|
74
74
|
return [2 /*return*/, data.map(helpers_1.toWalletDocument)];
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
|
-
exports.getDocumentCorrelations = getDocumentCorrelations;
|
|
80
79
|
//# sourceMappingURL=get-document-correlations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-document-correlations.js","sourceRoot":"","sources":["../../../src/entities/document/get-document-correlations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-document-correlations.js","sourceRoot":"","sources":["../../../src/entities/document/get-document-correlations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,0DAwBC;AAlCD,qDAAiD;AACjD,yCAAiC;AACjC,qCAA2C;AAC3C,yCAA8C;AAE9C;;;;GAIG;AACH,SAAsB,uBAAuB;wDAAC,EAK7C;;YAJC,SAAS,eAAA,EACT,UAAU,gBAAA;;;;oBAIJ,EAAE,GAAG,IAAA,uBAAa,EAAC,SAAS,CAAC,CAAC;oBAC9B,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,gCAAc,CAAC,CAAC;oBAErC,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"}
|
|
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
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 =
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -50,7 +50,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
50
50
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
51
|
};
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.saveOptions =
|
|
53
|
+
exports.saveOptions = void 0;
|
|
54
|
+
exports.getOrCreateDocumentTypes = getOrCreateDocumentTypes;
|
|
55
|
+
exports.findDocumentEntitiesById = findDocumentEntitiesById;
|
|
56
|
+
exports.toWalletDocument = toWalletDocument;
|
|
57
|
+
exports.toDocumentEntity = toDocumentEntity;
|
|
54
58
|
var document_type_entity_1 = require("../document-type.entity");
|
|
55
59
|
var assert_1 = __importDefault(require("assert"));
|
|
56
60
|
var logger_1 = require("../../logger");
|
|
@@ -63,12 +67,12 @@ var helpers_1 = require("../../helpers");
|
|
|
63
67
|
* @param types
|
|
64
68
|
*/
|
|
65
69
|
function getOrCreateDocumentTypes(_a) {
|
|
66
|
-
|
|
67
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
70
|
+
return __awaiter(this, arguments, void 0, function (_b) {
|
|
68
71
|
var db, typeRepository, typeEntityList, types_1, types_1_1, type, typeEntity, e_1_1;
|
|
69
|
-
var e_1,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
var e_1, _c;
|
|
73
|
+
var dataStore = _b.dataStore, types = _b.types;
|
|
74
|
+
return __generator(this, function (_d) {
|
|
75
|
+
switch (_d.label) {
|
|
72
76
|
case 0:
|
|
73
77
|
(0, assert_1.default)(!!types, 'Document type must be provided');
|
|
74
78
|
logger_1.logger.debug("getOrCreateDocumentTypes: ".concat(JSON.stringify(types)));
|
|
@@ -78,11 +82,11 @@ function getOrCreateDocumentTypes(_a) {
|
|
|
78
82
|
db = (0, helpers_1.getDataSource)(dataStore);
|
|
79
83
|
typeRepository = db.getRepository(document_type_entity_1.DocumentTypeEntity);
|
|
80
84
|
typeEntityList = [];
|
|
81
|
-
|
|
85
|
+
_d.label = 1;
|
|
82
86
|
case 1:
|
|
83
|
-
|
|
87
|
+
_d.trys.push([1, 8, 9, 10]);
|
|
84
88
|
types_1 = __values(types), types_1_1 = types_1.next();
|
|
85
|
-
|
|
89
|
+
_d.label = 2;
|
|
86
90
|
case 2:
|
|
87
91
|
if (!!types_1_1.done) return [3 /*break*/, 7];
|
|
88
92
|
type = types_1_1.value;
|
|
@@ -92,29 +96,29 @@ function getOrCreateDocumentTypes(_a) {
|
|
|
92
96
|
},
|
|
93
97
|
})];
|
|
94
98
|
case 3:
|
|
95
|
-
typeEntity =
|
|
99
|
+
typeEntity = _d.sent();
|
|
96
100
|
if (!!typeEntity) return [3 /*break*/, 5];
|
|
97
101
|
typeEntity = typeRepository.create({
|
|
98
102
|
id: type,
|
|
99
103
|
});
|
|
100
104
|
return [4 /*yield*/, typeRepository.save(typeEntity)];
|
|
101
105
|
case 4:
|
|
102
|
-
|
|
103
|
-
|
|
106
|
+
_d.sent();
|
|
107
|
+
_d.label = 5;
|
|
104
108
|
case 5:
|
|
105
109
|
typeEntityList.push(typeEntity);
|
|
106
|
-
|
|
110
|
+
_d.label = 6;
|
|
107
111
|
case 6:
|
|
108
112
|
types_1_1 = types_1.next();
|
|
109
113
|
return [3 /*break*/, 2];
|
|
110
114
|
case 7: return [3 /*break*/, 10];
|
|
111
115
|
case 8:
|
|
112
|
-
e_1_1 =
|
|
116
|
+
e_1_1 = _d.sent();
|
|
113
117
|
e_1 = { error: e_1_1 };
|
|
114
118
|
return [3 /*break*/, 10];
|
|
115
119
|
case 9:
|
|
116
120
|
try {
|
|
117
|
-
if (types_1_1 && !types_1_1.done && (
|
|
121
|
+
if (types_1_1 && !types_1_1.done && (_c = types_1.return)) _c.call(types_1);
|
|
118
122
|
}
|
|
119
123
|
finally { if (e_1) throw e_1.error; }
|
|
120
124
|
return [7 /*endfinally*/];
|
|
@@ -123,13 +127,12 @@ function getOrCreateDocumentTypes(_a) {
|
|
|
123
127
|
});
|
|
124
128
|
});
|
|
125
129
|
}
|
|
126
|
-
exports.getOrCreateDocumentTypes = getOrCreateDocumentTypes;
|
|
127
130
|
function findDocumentEntitiesById(_a) {
|
|
128
|
-
|
|
129
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
131
|
+
return __awaiter(this, arguments, void 0, function (_b) {
|
|
130
132
|
var db, repository, entities;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
+
var dataStore = _b.dataStore, entityIds = _b.entityIds;
|
|
134
|
+
return __generator(this, function (_c) {
|
|
135
|
+
switch (_c.label) {
|
|
133
136
|
case 0:
|
|
134
137
|
(0, assert_1.default)(!!entityIds, 'Document ids must be provided');
|
|
135
138
|
db = (0, helpers_1.getDataSource)(dataStore);
|
|
@@ -138,13 +141,12 @@ function findDocumentEntitiesById(_a) {
|
|
|
138
141
|
id: (0, typeorm_1.In)(entityIds),
|
|
139
142
|
})];
|
|
140
143
|
case 1:
|
|
141
|
-
entities =
|
|
144
|
+
entities = _c.sent();
|
|
142
145
|
return [2 /*return*/, entities];
|
|
143
146
|
}
|
|
144
147
|
});
|
|
145
148
|
});
|
|
146
149
|
}
|
|
147
|
-
exports.findDocumentEntitiesById = findDocumentEntitiesById;
|
|
148
150
|
/**
|
|
149
151
|
* Convert document entity to wallet document
|
|
150
152
|
* @param entity
|
|
@@ -159,17 +161,16 @@ function toWalletDocument(entity) {
|
|
|
159
161
|
}
|
|
160
162
|
return result;
|
|
161
163
|
}
|
|
162
|
-
exports.toWalletDocument = toWalletDocument;
|
|
163
164
|
/**
|
|
164
165
|
* Convert wallet document to document entity
|
|
165
166
|
* @param walletDocument
|
|
166
167
|
*/
|
|
167
168
|
function toDocumentEntity(_a) {
|
|
168
|
-
|
|
169
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
169
|
+
return __awaiter(this, arguments, void 0, function (_b) {
|
|
170
170
|
var type, _typeRel;
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
var dataStore = _b.dataStore, document = _b.document;
|
|
172
|
+
return __generator(this, function (_c) {
|
|
173
|
+
switch (_c.label) {
|
|
173
174
|
case 0:
|
|
174
175
|
type = document.type || [];
|
|
175
176
|
return [4 /*yield*/, getOrCreateDocumentTypes({
|
|
@@ -177,7 +178,7 @@ function toDocumentEntity(_a) {
|
|
|
177
178
|
types: document.type,
|
|
178
179
|
})];
|
|
179
180
|
case 1:
|
|
180
|
-
_typeRel =
|
|
181
|
+
_typeRel = _c.sent();
|
|
181
182
|
return [2 /*return*/, {
|
|
182
183
|
id: document.id,
|
|
183
184
|
type: type,
|
|
@@ -190,7 +191,6 @@ function toDocumentEntity(_a) {
|
|
|
190
191
|
});
|
|
191
192
|
});
|
|
192
193
|
}
|
|
193
|
-
exports.toDocumentEntity = toDocumentEntity;
|
|
194
194
|
exports.saveOptions = {
|
|
195
195
|
// Android is having issues when running multiple document saves in a short period of time
|
|
196
196
|
// We will disable transactions for now until we find a better solution
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/entities/document/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/entities/document/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,4DAqCC;AAED,4DAeC;AAMD,4CAY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QAAA,WAAW,GAAG;IACzB,0FAA0F;IAC1F,uEAAuE;IACvE,WAAW,EAAE,KAAK;CACnB,CAAC"}
|
|
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
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 =
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -39,7 +39,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.
|
|
42
|
+
exports.removeDocument = removeDocument;
|
|
43
|
+
exports.removeAllDocuments = removeAllDocuments;
|
|
43
44
|
var assert_1 = __importDefault(require("assert"));
|
|
44
45
|
var types_1 = require("@docknetwork/wallet-sdk-data-store/lib/types");
|
|
45
46
|
var document_entity_1 = require("./document.entity");
|
|
@@ -51,11 +52,11 @@ var helpers_1 = require("../../helpers");
|
|
|
51
52
|
* @param id
|
|
52
53
|
*/
|
|
53
54
|
function removeDocument(_a) {
|
|
54
|
-
|
|
55
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
55
|
+
return __awaiter(this, arguments, void 0, function (_b) {
|
|
56
56
|
var db, repository;
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
var dataStore = _b.dataStore, id = _b.id, options = _b.options;
|
|
58
|
+
return __generator(this, function (_c) {
|
|
59
|
+
switch (_c.label) {
|
|
59
60
|
case 0:
|
|
60
61
|
(0, assert_1.default)(!!id, 'Document id is required');
|
|
61
62
|
logger_1.logger.debug("Removing document with id ".concat(id));
|
|
@@ -66,24 +67,23 @@ function removeDocument(_a) {
|
|
|
66
67
|
networkId: dataStore.networkId,
|
|
67
68
|
})];
|
|
68
69
|
case 1:
|
|
69
|
-
|
|
70
|
+
_c.sent();
|
|
70
71
|
dataStore.events.emit(types_1.DataStoreEvents.DocumentDeleted, id);
|
|
71
72
|
return [2 /*return*/];
|
|
72
73
|
}
|
|
73
74
|
});
|
|
74
75
|
});
|
|
75
76
|
}
|
|
76
|
-
exports.removeDocument = removeDocument;
|
|
77
77
|
/**
|
|
78
78
|
* Remove all documents
|
|
79
79
|
* @param dataStore
|
|
80
80
|
*/
|
|
81
81
|
function removeAllDocuments(_a) {
|
|
82
|
-
|
|
83
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
82
|
+
return __awaiter(this, arguments, void 0, function (_b) {
|
|
84
83
|
var db, repository;
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
var dataStore = _b.dataStore;
|
|
85
|
+
return __generator(this, function (_c) {
|
|
86
|
+
switch (_c.label) {
|
|
87
87
|
case 0:
|
|
88
88
|
db = (0, helpers_1.getDataSource)(dataStore);
|
|
89
89
|
repository = db.getRepository(document_entity_1.DocumentEntity);
|
|
@@ -92,12 +92,11 @@ function removeAllDocuments(_a) {
|
|
|
92
92
|
.delete()
|
|
93
93
|
.execute()];
|
|
94
94
|
case 1:
|
|
95
|
-
|
|
95
|
+
_c.sent();
|
|
96
96
|
dataStore.events.emit(types_1.DataStoreEvents.AllDocumentsDeleted);
|
|
97
97
|
return [2 /*return*/];
|
|
98
98
|
}
|
|
99
99
|
});
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
|
-
exports.removeAllDocuments = removeAllDocuments;
|
|
103
102
|
//# sourceMappingURL=remove-document.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove-document.js","sourceRoot":"","sources":["../../../src/entities/document/remove-document.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"remove-document.js","sourceRoot":"","sources":["../../../src/entities/document/remove-document.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,wCAgBC;AAMD,gDAYC;AAhDD,kDAA4B;AAC5B,sEAGsD;AACtD,qDAAiD;AACjD,uCAAoC;AACpC,yCAA4C;AAE5C;;;;GAIG;AACH,SAAsB,cAAc;wDAAC,EAIQ;;YAH3C,SAAS,eAAA,EACT,EAAE,QAAA,EACF,OAAO,aAAA;;;;oBAEP,IAAA,gBAAM,EAAC,CAAC,CAAC,EAAE,EAAE,yBAAyB,CAAC,CAAC;oBAExC,eAAM,CAAC,KAAK,CAAC,oCAA6B,EAAE,CAAE,CAAC,CAAC;oBAC1C,EAAE,GAAG,IAAA,uBAAa,EAAC,SAAS,CAAC,CAAC;oBAC9B,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,gCAAc,CAAC,CAAC;oBACpD,qBAAM,UAAU,CAAC,MAAM,CAAC;4BACtB,EAAE,IAAA;4BACF,SAAS,EAAE,SAAS,CAAC,SAAS;yBAC/B,CAAC,EAAA;;oBAHF,SAGE,CAAC;oBAEH,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,uBAAe,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;;;;;CAC5D;AAED;;;GAGG;AACH,SAAsB,kBAAkB;wDAAC,EAE1B;;YADb,SAAS,eAAA;;;;oBAEH,EAAE,GAAG,IAAA,uBAAa,EAAC,SAAS,CAAC,CAAC;oBAC9B,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,gCAAc,CAAC,CAAC;oBAEpD,qBAAM,UAAU;6BACb,kBAAkB,EAAE;6BACpB,MAAM,EAAE;6BACR,OAAO,EAAE,EAAA;;oBAHZ,SAGY,CAAC;oBAEb,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,uBAAe,CAAC,mBAAmB,CAAC,CAAC;;;;;CAC5D"}
|
|
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
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 =
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.updateDocument =
|
|
39
|
+
exports.updateDocument = updateDocument;
|
|
40
40
|
var helpers_1 = require("./helpers");
|
|
41
41
|
var document_entity_1 = require("./document.entity");
|
|
42
42
|
var logger_1 = require("../../logger");
|
|
@@ -48,10 +48,10 @@ var create_document_1 = require("./create-document");
|
|
|
48
48
|
* @param document
|
|
49
49
|
*/
|
|
50
50
|
function updateDocument(_a) {
|
|
51
|
-
|
|
52
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
51
|
+
return __awaiter(this, arguments, void 0, function (_b) {
|
|
53
52
|
var _this = this;
|
|
54
|
-
|
|
53
|
+
var dataStore = _b.dataStore, document = _b.document;
|
|
54
|
+
return __generator(this, function (_c) {
|
|
55
55
|
return [2 /*return*/, create_document_1.writeMutex.runExclusive(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
56
56
|
var db, repository, entity;
|
|
57
57
|
return __generator(this, function (_a) {
|
|
@@ -77,5 +77,4 @@ function updateDocument(_a) {
|
|
|
77
77
|
});
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
|
-
exports.updateDocument = updateDocument;
|
|
81
80
|
//# sourceMappingURL=update-document.js.map
|