@docknetwork/wallet-sdk-data-store-typeorm 0.4.19

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.
Files changed (148) hide show
  1. package/jest.config.ts +21 -0
  2. package/lib/entities/document/create-document.d.ts +11 -0
  3. package/lib/entities/document/create-document.d.ts.map +1 -0
  4. package/lib/entities/document/create-document.js +120 -0
  5. package/lib/entities/document/create-document.js.map +1 -0
  6. package/lib/entities/document/document.entity.d.ts +11 -0
  7. package/lib/entities/document/document.entity.d.ts.map +1 -0
  8. package/lib/entities/document/document.entity.js +55 -0
  9. package/lib/entities/document/document.entity.js.map +1 -0
  10. package/lib/entities/document/get-all-documents.d.ts +11 -0
  11. package/lib/entities/document/get-all-documents.d.ts.map +1 -0
  12. package/lib/entities/document/get-all-documents.js +80 -0
  13. package/lib/entities/document/get-all-documents.js.map +1 -0
  14. package/lib/entities/document/get-documens-by-type.d.ts +10 -0
  15. package/lib/entities/document/get-documens-by-type.d.ts.map +1 -0
  16. package/lib/entities/document/get-documens-by-type.js +73 -0
  17. package/lib/entities/document/get-documens-by-type.js.map +1 -0
  18. package/lib/entities/document/get-document-by-id.d.ts +13 -0
  19. package/lib/entities/document/get-document-by-id.d.ts.map +1 -0
  20. package/lib/entities/document/get-document-by-id.js +95 -0
  21. package/lib/entities/document/get-document-by-id.js.map +1 -0
  22. package/lib/entities/document/get-document-correlations.d.ts +10 -0
  23. package/lib/entities/document/get-document-correlations.d.ts.map +1 -0
  24. package/lib/entities/document/get-document-correlations.js +80 -0
  25. package/lib/entities/document/get-document-correlations.js.map +1 -0
  26. package/lib/entities/document/helpers.d.ts +30 -0
  27. package/lib/entities/document/helpers.d.ts.map +1 -0
  28. package/lib/entities/document/helpers.js +199 -0
  29. package/lib/entities/document/helpers.js.map +1 -0
  30. package/lib/entities/document/index.d.ts +10 -0
  31. package/lib/entities/document/index.d.ts.map +1 -0
  32. package/lib/entities/document/index.js +26 -0
  33. package/lib/entities/document/index.js.map +1 -0
  34. package/lib/entities/document/remove-document.d.ts +16 -0
  35. package/lib/entities/document/remove-document.d.ts.map +1 -0
  36. package/lib/entities/document/remove-document.js +100 -0
  37. package/lib/entities/document/remove-document.js.map +1 -0
  38. package/lib/entities/document/update-document.d.ts +11 -0
  39. package/lib/entities/document/update-document.d.ts.map +1 -0
  40. package/lib/entities/document/update-document.js +75 -0
  41. package/lib/entities/document/update-document.js.map +1 -0
  42. package/lib/entities/document-type.entity.d.ts +6 -0
  43. package/lib/entities/document-type.entity.d.ts.map +1 -0
  44. package/lib/entities/document-type.entity.js +32 -0
  45. package/lib/entities/document-type.entity.js.map +1 -0
  46. package/lib/entities/log.entity.d.ts +15 -0
  47. package/lib/entities/log.entity.d.ts.map +1 -0
  48. package/lib/entities/log.entity.js +111 -0
  49. package/lib/entities/log.entity.js.map +1 -0
  50. package/lib/entities/network.entity.d.ts +6 -0
  51. package/lib/entities/network.entity.d.ts.map +1 -0
  52. package/lib/entities/network.entity.js +35 -0
  53. package/lib/entities/network.entity.js.map +1 -0
  54. package/lib/entities/transaction.entity.d.ts +24 -0
  55. package/lib/entities/transaction.entity.d.ts.map +1 -0
  56. package/lib/entities/transaction.entity.js +147 -0
  57. package/lib/entities/transaction.entity.js.map +1 -0
  58. package/lib/entities/wallet.entity.d.ts +10 -0
  59. package/lib/entities/wallet.entity.d.ts.map +1 -0
  60. package/lib/entities/wallet.entity.js +114 -0
  61. package/lib/entities/wallet.entity.js.map +1 -0
  62. package/lib/helpers.d.ts +6 -0
  63. package/lib/helpers.d.ts.map +1 -0
  64. package/lib/helpers.js +94 -0
  65. package/lib/helpers.js.map +1 -0
  66. package/lib/index.d.ts +3 -0
  67. package/lib/index.d.ts.map +1 -0
  68. package/lib/index.js +171 -0
  69. package/lib/index.js.map +1 -0
  70. package/lib/logger.d.ts +16 -0
  71. package/lib/logger.d.ts.map +1 -0
  72. package/lib/logger.js +46 -0
  73. package/lib/logger.js.map +1 -0
  74. package/lib/migration/bootstrap-tables.d.ts +3 -0
  75. package/lib/migration/bootstrap-tables.d.ts.map +1 -0
  76. package/lib/migration/bootstrap-tables.js +8 -0
  77. package/lib/migration/bootstrap-tables.js.map +1 -0
  78. package/lib/migration/index.d.ts +8 -0
  79. package/lib/migration/index.d.ts.map +1 -0
  80. package/lib/migration/index.js +133 -0
  81. package/lib/migration/index.js.map +1 -0
  82. package/lib/migration/migration1/index.d.ts +16 -0
  83. package/lib/migration/migration1/index.d.ts.map +1 -0
  84. package/lib/migration/migration1/index.js +110 -0
  85. package/lib/migration/migration1/index.js.map +1 -0
  86. package/lib/migration/migration1/migrate-v1-data.d.ts +4 -0
  87. package/lib/migration/migration1/migrate-v1-data.d.ts.map +1 -0
  88. package/lib/migration/migration1/migrate-v1-data.js +107 -0
  89. package/lib/migration/migration1/migrate-v1-data.js.map +1 -0
  90. package/lib/migration/migration1/v1-data-store.d.ts +11 -0
  91. package/lib/migration/migration1/v1-data-store.d.ts.map +1 -0
  92. package/lib/migration/migration1/v1-data-store.js +80 -0
  93. package/lib/migration/migration1/v1-data-store.js.map +1 -0
  94. package/lib/migrations/1691498362273-bootstrap.d.ts +7 -0
  95. package/lib/migrations/1691498362273-bootstrap.d.ts.map +1 -0
  96. package/lib/migrations/1691498362273-bootstrap.js +178 -0
  97. package/lib/migrations/1691498362273-bootstrap.js.map +1 -0
  98. package/lib/migrations/index.d.ts +4 -0
  99. package/lib/migrations/index.d.ts.map +1 -0
  100. package/lib/migrations/index.js +5 -0
  101. package/lib/migrations/index.js.map +1 -0
  102. package/lib/migrations-data-source.d.ts +3 -0
  103. package/lib/migrations-data-source.d.ts.map +1 -0
  104. package/lib/migrations-data-source.js +8 -0
  105. package/lib/migrations-data-source.js.map +1 -0
  106. package/lib/typeorm.d.ts +2 -0
  107. package/lib/typeorm.d.ts.map +1 -0
  108. package/lib/typeorm.js +18 -0
  109. package/lib/typeorm.js.map +1 -0
  110. package/package.json +32 -0
  111. package/scripts/publish.sh +3 -0
  112. package/setup-tests.ts +0 -0
  113. package/src/__tests__/index.test.ts +56 -0
  114. package/src/__tests__/v1-data-store.test.ts +24 -0
  115. package/src/entities/document/create-document.ts +82 -0
  116. package/src/entities/document/decument.entity.test.ts +135 -0
  117. package/src/entities/document/document.entity.ts +40 -0
  118. package/src/entities/document/get-all-documents.ts +41 -0
  119. package/src/entities/document/get-documens-by-type.ts +32 -0
  120. package/src/entities/document/get-document-by-id.ts +48 -0
  121. package/src/entities/document/get-document-correlations.ts +36 -0
  122. package/src/entities/document/helpers.ts +118 -0
  123. package/src/entities/document/index.ts +9 -0
  124. package/src/entities/document/remove-document.ts +45 -0
  125. package/src/entities/document/update-document.ts +29 -0
  126. package/src/entities/document-type.entity.ts +11 -0
  127. package/src/entities/log.entity.ts +49 -0
  128. package/src/entities/network.entity.ts +13 -0
  129. package/src/entities/transaction.entity.ts +70 -0
  130. package/src/entities/wallet.entity.ts +41 -0
  131. package/src/helpers.ts +46 -0
  132. package/src/index.ts +124 -0
  133. package/src/logger.ts +43 -0
  134. package/src/migration/bootstrap-tables.ts +5 -0
  135. package/src/migration/index.ts +54 -0
  136. package/src/migration/migration1/index.ts +64 -0
  137. package/src/migration/migration1/migrate-v1-data.ts +39 -0
  138. package/src/migration/migration1/v1-data-store.ts +34 -0
  139. package/src/migrations/1691498362273-bootstrap.ts +130 -0
  140. package/src/migrations/index.ts +3 -0
  141. package/src/migrations-data-source.ts +6 -0
  142. package/src/typeorm.ts +1 -0
  143. package/test/mock-local-storage.ts +17 -0
  144. package/test/test-utils.ts +23 -0
  145. package/test/wallet.json +209 -0
  146. package/tsconfig.build.json +25 -0
  147. package/tsconfig.build.tsbuildinfo +1 -0
  148. package/tsconfig.json +32 -0
package/jest.config.ts ADDED
@@ -0,0 +1,21 @@
1
+ module.exports = {
2
+ testEnvironment: 'node',
3
+ testTimeout: 30000,
4
+ testMatch: [
5
+ "<rootDir>/src/**/!(*.e2e).test.ts"
6
+ ],
7
+ coverageThreshold: {
8
+ global: {
9
+ branches: 10,
10
+ functions: 10,
11
+ lines: 10,
12
+ statements: 10,
13
+ },
14
+ },
15
+ transform: {
16
+ '^.+\\.ts$': 'ts-jest',
17
+ },
18
+ resetMocks: false,
19
+ setupFilesAfterEnv: ['<rootDir>/setup-tests.ts'],
20
+ setupFiles: ['jest-localstorage-mock'],
21
+ };
@@ -0,0 +1,11 @@
1
+ import { ContextProps, WalletDocument } from '@docknetwork/wallet-sdk-data-store/lib/types';
2
+ /**
3
+ * Create document
4
+ * @param dataStore
5
+ * @param json
6
+ */
7
+ export declare function createDocument({ dataStore, json, options, }: ContextProps & {
8
+ json: any;
9
+ options?: any;
10
+ }): Promise<WalletDocument>;
11
+ //# sourceMappingURL=create-document.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-document.d.ts","sourceRoot":"","sources":["../../../src/entities/document/create-document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAmB,cAAc,EAAC,MAAM,8CAA8C,CAAC;AAQ3G;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,EACnC,SAAS,EACT,IAAI,EACJ,OAAO,GACR,EAAE,YAAY,GAAG;IAChB,IAAI,EAAE,GAAG,CAAC;IACV,OAAO,CAAC,EAAE,GAAG,CAAC;CACf,GAAG,OAAO,CAAC,cAAc,CAAC,CA6D1B"}
@@ -0,0 +1,120 @@
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.createDocument = void 0;
40
+ var types_1 = require("@docknetwork/wallet-sdk-data-store/lib/types");
41
+ var uuid_1 = require("uuid");
42
+ var document_entity_1 = require("./document.entity");
43
+ var helpers_1 = require("./helpers");
44
+ var get_document_by_id_1 = require("./get-document-by-id");
45
+ var logger_1 = require("../../logger");
46
+ var helpers_2 = require("../../helpers");
47
+ /**
48
+ * Create document
49
+ * @param dataStore
50
+ * @param json
51
+ */
52
+ function createDocument(_a) {
53
+ var dataStore = _a.dataStore, json = _a.json, options = _a.options;
54
+ return __awaiter(this, void 0, void 0, function () {
55
+ var existingDocument, _typeRel, networkId, resolution, entity, db, repository, result;
56
+ return __generator(this, function (_b) {
57
+ switch (_b.label) {
58
+ case 0:
59
+ logger_1.logger.debug("Creating document with id ".concat(json.id, "..."));
60
+ if (!json.id) return [3 /*break*/, 2];
61
+ return [4 /*yield*/, (0, get_document_by_id_1.getDocumentById)({
62
+ dataStore: dataStore,
63
+ id: json.id,
64
+ })];
65
+ case 1:
66
+ existingDocument = _b.sent();
67
+ if (existingDocument) {
68
+ logger_1.logger.debug("Document with id ".concat(json.id, " already exists"));
69
+ throw new Error("Document with id ".concat(json.id, " already exists"));
70
+ }
71
+ _b.label = 2;
72
+ case 2: return [4 /*yield*/, (0, helpers_1.getOrCreateDocumentTypes)({
73
+ dataStore: dataStore,
74
+ types: json.type,
75
+ })];
76
+ case 3:
77
+ _typeRel = _b.sent();
78
+ if (!json.id) {
79
+ json.id = (0, uuid_1.v4)();
80
+ }
81
+ if (!json._networkId) return [3 /*break*/, 4];
82
+ networkId = json._networkId;
83
+ delete json._networkId;
84
+ return [3 /*break*/, 6];
85
+ case 4: return [4 /*yield*/, dataStore.resolveDocumentNetwork({
86
+ document: json,
87
+ dataStore: dataStore,
88
+ })];
89
+ case 5:
90
+ resolution = _b.sent();
91
+ networkId = resolution.networkId;
92
+ _b.label = 6;
93
+ case 6:
94
+ entity = {
95
+ networkId: networkId,
96
+ id: json.id,
97
+ type: json.type,
98
+ _typeRel: _typeRel,
99
+ correlation: json.correlation || [],
100
+ data: JSON.stringify(json),
101
+ };
102
+ db = (0, helpers_2.getDataSource)(dataStore);
103
+ repository = db.getRepository(document_entity_1.DocumentEntity);
104
+ return [4 /*yield*/, repository.save(entity, helpers_1.saveOptions)];
105
+ case 7:
106
+ result = _b.sent();
107
+ if (!(options === null || options === void 0 ? void 0 : options.stopPropagation)) {
108
+ dataStore.events.emit(types_1.DataStoreEvents.DocumentCreated, json);
109
+ }
110
+ else {
111
+ console.log('stopPropagation is true');
112
+ }
113
+ logger_1.logger.debug("Document added to the wallet");
114
+ return [2 /*return*/, result];
115
+ }
116
+ });
117
+ });
118
+ }
119
+ exports.createDocument = createDocument;
120
+ //# sourceMappingURL=create-document.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-document.js","sourceRoot":"","sources":["../../../src/entities/document/create-document.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sEAA2G;AAC3G,6BAAgC;AAChC,qDAAiD;AACjD,qCAAgE;AAChE,2DAAqD;AACrD,uCAAoC;AACpC,yCAA8C;AAE9C;;;;GAIG;AACH,SAAsB,cAAc,CAAC,EAOpC;QANC,SAAS,eAAA,EACT,IAAI,UAAA,EACJ,OAAO,aAAA;;;;;;oBAKP,eAAM,CAAC,KAAK,CAAC,oCAA6B,IAAI,CAAC,EAAE,QAAK,CAAC,CAAC;yBACpD,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,EAAE,GAAG,IAAA,uBAAa,EAAC,SAAS,CAAC,CAAC;oBAE9B,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,gCAAc,CAAC,CAAC;oBAErC,qBAAM,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,qBAAW,CAAC,EAAA;;oBAAnD,MAAM,GAAG,SAA0C;oBAEzD,IAAI,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe,CAAA,EAAE;wBAC7B,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,uBAAe,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;qBAC9D;yBAAM;wBACL,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAA;qBACvC;oBAED,eAAM,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;oBAE7C,sBAAO,MAAM,EAAC;;;;CACf;AApED,wCAoEC"}
@@ -0,0 +1,11 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,55 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,11 @@
1
+ import { WalletDocument, DataStore } from '@docknetwork/wallet-sdk-data-store/lib/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
@@ -0,0 +1 @@
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,8CAA8C,CAAC;AAevF;;;;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,CAc5B"}
@@ -0,0 +1,80 @@
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
+ var helpers_2 = require("../../helpers");
43
+ function toWalletDocumentExpanded(entity) {
44
+ var result = (0, helpers_1.toWalletDocument)(entity);
45
+ if (result) {
46
+ result['_networkId'] = entity.networkId;
47
+ }
48
+ return result;
49
+ }
50
+ /**
51
+ * Get all documents
52
+ *
53
+ * @param dataStore
54
+ */
55
+ function getAllDocuments(_a) {
56
+ var dataStore = _a.dataStore, allNetworks = _a.allNetworks;
57
+ return __awaiter(this, void 0, void 0, function () {
58
+ var db, repository, entities, mapDocument;
59
+ return __generator(this, function (_b) {
60
+ switch (_b.label) {
61
+ case 0:
62
+ db = (0, helpers_2.getDataSource)(dataStore);
63
+ repository = db.getRepository(document_entity_1.DocumentEntity);
64
+ return [4 /*yield*/, repository.find({
65
+ where: allNetworks
66
+ ? {}
67
+ : {
68
+ networkId: dataStore.networkId,
69
+ },
70
+ })];
71
+ case 1:
72
+ entities = _b.sent();
73
+ mapDocument = allNetworks ? toWalletDocumentExpanded : helpers_1.toWalletDocument;
74
+ return [2 /*return*/, Promise.all(entities.map(mapDocument))];
75
+ }
76
+ });
77
+ });
78
+ }
79
+ exports.getAllDocuments = getAllDocuments;
80
+ //# sourceMappingURL=get-all-documents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-all-documents.js","sourceRoot":"","sources":["../../../src/entities/document/get-all-documents.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qCAA2C;AAC3C,qDAAiD;AACjD,yCAA8C;AAE9C,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,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;AApBD,0CAoBC"}
@@ -0,0 +1,10 @@
1
+ import { ContextProps, WalletDocument } from '@docknetwork/wallet-sdk-data-store/lib/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
@@ -0,0 +1 @@
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,8CAA8C,CAAC;AAM1F;;;;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,CAe5B"}
@@ -0,0 +1,73 @@
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
+ var helpers_2 = require("../../helpers");
43
+ /**
44
+ * Get documents by type
45
+ * @param dataStore
46
+ * @param type
47
+ */
48
+ function getDocumentsByType(_a) {
49
+ var dataStore = _a.dataStore, type = _a.type;
50
+ return __awaiter(this, void 0, void 0, function () {
51
+ var db, repository, documents, result;
52
+ return __generator(this, function (_b) {
53
+ switch (_b.label) {
54
+ case 0:
55
+ db = (0, helpers_2.getDataSource)(dataStore);
56
+ repository = db.getRepository(document_entity_1.DocumentEntity);
57
+ documents = repository
58
+ .createQueryBuilder('document')
59
+ .leftJoinAndSelect('document._typeRel', 'documentType')
60
+ .where('documentType.id = :type', { type: type })
61
+ .andWhere('document.networkId = :networkId', {
62
+ networkId: dataStore.networkId,
63
+ });
64
+ return [4 /*yield*/, documents.getMany()];
65
+ case 1:
66
+ result = _b.sent();
67
+ return [2 /*return*/, result.map(helpers_1.toWalletDocument)];
68
+ }
69
+ });
70
+ });
71
+ }
72
+ exports.getDocumentsByType = getDocumentsByType;
73
+ //# sourceMappingURL=get-documens-by-type.js.map
@@ -0,0 +1 @@
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;AAC3C,yCAA8C;AAE9C;;;;GAIG;AACH,SAAsB,kBAAkB,CAAC,EAKxC;QAJC,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;AApBD,gDAoBC"}
@@ -0,0 +1,13 @@
1
+ import { ContextProps, WalletDocument } from '@docknetwork/wallet-sdk-data-store/lib/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
@@ -0,0 +1 @@
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,8CAA8C,CAAC;AAM1F;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,EACpC,SAAS,EACT,EAAE,GACH,EAAE,YAAY,GAAG;IAChB,EAAE,EAAE,MAAM,CAAC;CACZ,GAAG,OAAO,CAAC,cAAc,CAAC,CAY1B;AAED,wBAAsB,gBAAgB,CAAC,EACrC,SAAS,EACT,MAAM,GACP,EAAE,YAAY,GAAG;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,GAAG,OAAO,CAAC,cAAc,CAAC,CAY1B"}
@@ -0,0 +1,95 @@
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
+ var helpers_2 = require("../../helpers");
44
+ /**
45
+ * Get document by id
46
+ * @param dataStore
47
+ * @param id
48
+ */
49
+ function getDocumentById(_a) {
50
+ var dataStore = _a.dataStore, id = _a.id;
51
+ return __awaiter(this, void 0, void 0, function () {
52
+ var db, repository, entity;
53
+ return __generator(this, function (_b) {
54
+ switch (_b.label) {
55
+ case 0:
56
+ db = (0, helpers_2.getDataSource)(dataStore);
57
+ repository = db.getRepository(document_entity_1.DocumentEntity);
58
+ return [4 /*yield*/, repository.findOne({
59
+ where: {
60
+ id: id,
61
+ networkId: dataStore.networkId,
62
+ },
63
+ })];
64
+ case 1:
65
+ entity = _b.sent();
66
+ return [2 /*return*/, (0, helpers_1.toWalletDocument)(entity)];
67
+ }
68
+ });
69
+ });
70
+ }
71
+ exports.getDocumentById = getDocumentById;
72
+ function getDocumentsById(_a) {
73
+ var dataStore = _a.dataStore, idList = _a.idList;
74
+ return __awaiter(this, void 0, void 0, function () {
75
+ var db, repository, entities;
76
+ return __generator(this, function (_b) {
77
+ switch (_b.label) {
78
+ case 0:
79
+ db = (0, helpers_2.getDataSource)(dataStore);
80
+ repository = db.getRepository(document_entity_1.DocumentEntity);
81
+ return [4 /*yield*/, repository.find({
82
+ where: {
83
+ id: (0, typeorm_1.In)(idList),
84
+ networkId: dataStore.networkId,
85
+ },
86
+ })];
87
+ case 1:
88
+ entities = _b.sent();
89
+ return [2 /*return*/, entities.map(helpers_1.toWalletDocument)];
90
+ }
91
+ });
92
+ });
93
+ }
94
+ exports.getDocumentsById = getDocumentsById;
95
+ //# sourceMappingURL=get-document-by-id.js.map
@@ -0,0 +1 @@
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;AAC3B,yCAA8C;AAE9C;;;;GAIG;AACH,SAAsB,eAAe,CAAC,EAKrC;QAJC,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;AAjBD,0CAiBC;AAED,SAAsB,gBAAgB,CAAC,EAKtC;QAJC,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;AAjBD,4CAiBC"}
@@ -0,0 +1,10 @@
1
+ import { ContextProps, WalletDocument } from '@docknetwork/wallet-sdk-data-store/lib/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
@@ -0,0 +1 @@
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,8CAA8C,CAAC;AAM1F;;;;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,CAmB5B"}