@docknetwork/wallet-sdk-data-store-web 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 (87) hide show
  1. package/jest.config.ts +20 -0
  2. package/lib/entities/document/create-document.d.ts +12 -0
  3. package/lib/entities/document/create-document.d.ts.map +1 -0
  4. package/lib/entities/document/create-document.js +150 -0
  5. package/lib/entities/document/create-document.js.map +1 -0
  6. package/lib/entities/document/document.entity.d.ts +8 -0
  7. package/lib/entities/document/document.entity.d.ts.map +1 -0
  8. package/lib/entities/document/document.entity.js +3 -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 +73 -0
  13. package/lib/entities/document/get-all-documents.js.map +1 -0
  14. package/lib/entities/document/get-document-by-id.d.ts +13 -0
  15. package/lib/entities/document/get-document-by-id.d.ts.map +1 -0
  16. package/lib/entities/document/get-document-by-id.js +76 -0
  17. package/lib/entities/document/get-document-by-id.js.map +1 -0
  18. package/lib/entities/document/get-document-correlations.d.ts +10 -0
  19. package/lib/entities/document/get-document-correlations.d.ts.map +1 -0
  20. package/lib/entities/document/get-document-correlations.js +62 -0
  21. package/lib/entities/document/get-document-correlations.js.map +1 -0
  22. package/lib/entities/document/get-documents-by-type.d.ts +10 -0
  23. package/lib/entities/document/get-documents-by-type.d.ts.map +1 -0
  24. package/lib/entities/document/get-documents-by-type.js +61 -0
  25. package/lib/entities/document/get-documents-by-type.js.map +1 -0
  26. package/lib/entities/document/helpers.d.ts +18 -0
  27. package/lib/entities/document/helpers.d.ts.map +1 -0
  28. package/lib/entities/document/helpers.js +81 -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 +89 -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 +78 -0
  41. package/lib/entities/document/update-document.js.map +1 -0
  42. package/lib/entities/log.entity.d.ts +13 -0
  43. package/lib/entities/log.entity.d.ts.map +1 -0
  44. package/lib/entities/log.entity.js +91 -0
  45. package/lib/entities/log.entity.js.map +1 -0
  46. package/lib/entities/network.entity.d.ts +6 -0
  47. package/lib/entities/network.entity.d.ts.map +1 -0
  48. package/lib/entities/network.entity.js +3 -0
  49. package/lib/entities/network.entity.js.map +1 -0
  50. package/lib/entities/wallet.entity.d.ts +10 -0
  51. package/lib/entities/wallet.entity.d.ts.map +1 -0
  52. package/lib/entities/wallet.entity.js +77 -0
  53. package/lib/entities/wallet.entity.js.map +1 -0
  54. package/lib/index.d.ts +3 -0
  55. package/lib/index.d.ts.map +1 -0
  56. package/lib/index.js +185 -0
  57. package/lib/index.js.map +1 -0
  58. package/lib/localStorageJSON.d.ts +7 -0
  59. package/lib/localStorageJSON.d.ts.map +1 -0
  60. package/lib/localStorageJSON.js +80 -0
  61. package/lib/localStorageJSON.js.map +1 -0
  62. package/package.json +32 -0
  63. package/scripts/publish.sh +3 -0
  64. package/src/__tests__/index.test.ts +56 -0
  65. package/src/__tests__/v1-data-store.test.ts +24 -0
  66. package/src/entities/document/create-document.ts +82 -0
  67. package/src/entities/document/decument.entity.test.ts +135 -0
  68. package/src/entities/document/document.entity.ts +7 -0
  69. package/src/entities/document/get-all-documents.ts +42 -0
  70. package/src/entities/document/get-document-by-id.ts +31 -0
  71. package/src/entities/document/get-document-correlations.ts +22 -0
  72. package/src/entities/document/get-documents-by-type.ts +21 -0
  73. package/src/entities/document/helpers.ts +50 -0
  74. package/src/entities/document/index.ts +9 -0
  75. package/src/entities/document/remove-document.ts +43 -0
  76. package/src/entities/document/update-document.ts +36 -0
  77. package/src/entities/log.entity.ts +26 -0
  78. package/src/entities/network.entity.ts +5 -0
  79. package/src/entities/wallet.entity.ts +29 -0
  80. package/src/index.ts +134 -0
  81. package/src/localStorageJSON.ts +24 -0
  82. package/test/mock-local-storage.ts +17 -0
  83. package/test/test-utils.ts +23 -0
  84. package/test/wallet.json +209 -0
  85. package/tsconfig.build.json +25 -0
  86. package/tsconfig.build.tsbuildinfo +1 -0
  87. package/tsconfig.json +32 -0
package/jest.config.ts ADDED
@@ -0,0 +1,20 @@
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
+ setupFiles: ['jest-localstorage-mock'],
20
+ };
@@ -0,0 +1,12 @@
1
+ import { ContextProps, WalletDocument } from '@docknetwork/wallet-sdk-data-store/lib/types';
2
+ export declare function appendDocument(document: WalletDocument): Promise<void>;
3
+ /**
4
+ * Create document
5
+ * @param dataStore
6
+ * @param json
7
+ */
8
+ export declare function createDocument({ dataStore, json, options, }: ContextProps & {
9
+ json: any;
10
+ options?: any;
11
+ }): Promise<WalletDocument>;
12
+ //# 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,EACL,YAAY,EAEZ,cAAc,EACf,MAAM,8CAA8C,CAAC;AAQtD,wBAAsB,cAAc,CAAC,QAAQ,EAAE,cAAc,iBAI5D;AAED;;;;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,CAmD1B"}
@@ -0,0 +1,150 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __read = (this && this.__read) || function (o, n) {
39
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
40
+ if (!m) return o;
41
+ var i = m.call(o), r, ar = [], e;
42
+ try {
43
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
44
+ }
45
+ catch (error) { e = { error: error }; }
46
+ finally {
47
+ try {
48
+ if (r && !r.done && (m = i["return"])) m.call(i);
49
+ }
50
+ finally { if (e) throw e.error; }
51
+ }
52
+ return ar;
53
+ };
54
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
55
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
56
+ if (ar || !(i in from)) {
57
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
58
+ ar[i] = from[i];
59
+ }
60
+ }
61
+ return to.concat(ar || Array.prototype.slice.call(from));
62
+ };
63
+ Object.defineProperty(exports, "__esModule", { value: true });
64
+ exports.createDocument = exports.appendDocument = void 0;
65
+ var types_1 = require("@docknetwork/wallet-sdk-data-store/lib/types");
66
+ var uuid_1 = require("uuid");
67
+ var get_document_by_id_1 = require("./get-document-by-id");
68
+ var logger_1 = require("@docknetwork/wallet-sdk-data-store/lib/logger");
69
+ var localStorageJSON_1 = require("../../localStorageJSON");
70
+ function appendDocument(document) {
71
+ return __awaiter(this, void 0, void 0, function () {
72
+ var entities;
73
+ return __generator(this, function (_a) {
74
+ switch (_a.label) {
75
+ case 0: return [4 /*yield*/, localStorageJSON_1.localStorageJSON.getItem('documents')];
76
+ case 1:
77
+ entities = (_a.sent()) || [];
78
+ return [4 /*yield*/, localStorageJSON_1.localStorageJSON.setItem('documents', __spreadArray(__spreadArray([], __read(entities), false), [document], false))];
79
+ case 2:
80
+ _a.sent();
81
+ return [2 /*return*/];
82
+ }
83
+ });
84
+ });
85
+ }
86
+ exports.appendDocument = appendDocument;
87
+ /**
88
+ * Create document
89
+ * @param dataStore
90
+ * @param json
91
+ */
92
+ function createDocument(_a) {
93
+ var dataStore = _a.dataStore, json = _a.json, options = _a.options;
94
+ return __awaiter(this, void 0, void 0, function () {
95
+ var existingDocument, networkId, resolution, entity;
96
+ return __generator(this, function (_b) {
97
+ switch (_b.label) {
98
+ case 0:
99
+ logger_1.logger.debug("Creating document with id ".concat(json.id, "..."));
100
+ if (!json.id) return [3 /*break*/, 2];
101
+ return [4 /*yield*/, (0, get_document_by_id_1.getDocumentById)({
102
+ dataStore: dataStore,
103
+ id: json.id,
104
+ })];
105
+ case 1:
106
+ existingDocument = _b.sent();
107
+ if (existingDocument) {
108
+ logger_1.logger.debug("Document with id ".concat(json.id, " already exists"));
109
+ throw new Error("Document with id ".concat(json.id, " already exists"));
110
+ }
111
+ _b.label = 2;
112
+ case 2:
113
+ if (!json.id) {
114
+ json.id = (0, uuid_1.v4)();
115
+ }
116
+ if (!json._networkId) return [3 /*break*/, 3];
117
+ networkId = json._networkId;
118
+ delete json._networkId;
119
+ return [3 /*break*/, 5];
120
+ case 3: return [4 /*yield*/, dataStore.resolveDocumentNetwork({
121
+ document: json,
122
+ dataStore: dataStore,
123
+ })];
124
+ case 4:
125
+ resolution = _b.sent();
126
+ networkId = resolution.networkId || dataStore.networkId;
127
+ _b.label = 5;
128
+ case 5:
129
+ entity = {
130
+ networkId: networkId,
131
+ id: json.id,
132
+ type: json.type,
133
+ correlation: json.correlation || [],
134
+ data: json,
135
+ };
136
+ appendDocument(entity);
137
+ if (!(options === null || options === void 0 ? void 0 : options.stopPropagation)) {
138
+ dataStore.events.emit(types_1.DataStoreEvents.DocumentCreated, json);
139
+ }
140
+ else {
141
+ console.log('stopPropagation is true');
142
+ }
143
+ logger_1.logger.debug("Document added to the wallet");
144
+ return [2 /*return*/, entity];
145
+ }
146
+ });
147
+ });
148
+ }
149
+ exports.createDocument = createDocument;
150
+ //# 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,sEAIsD;AACtD,6BAAgC;AAEhC,2DAAqD;AACrD,wEAAqE;AACrE,2DAAwD;AAGxD,SAAsB,cAAc,CAAC,QAAwB;;;;;wBACzC,qBAAM,mCAAgB,CAAC,OAAO,CAAC,WAAW,CAAC,EAAA;;oBAAvD,QAAQ,GAAG,CAAC,SAA2C,CAAC,IAAI,EAAE;oBAEpE,qBAAM,mCAAgB,CAAC,OAAO,CAAC,WAAW,yCAAM,QAAQ,YAAE,QAAQ,UAAE,EAAA;;oBAApE,SAAoE,CAAC;;;;;CACtE;AAJD,wCAIC;AAED;;;;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;;;oBAGH,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,IAAI,SAAS,CAAC,SAAS,CAAC;;;oBAGpD,MAAM,GAAmB;wBAC7B,SAAS,WAAA;wBACT,EAAE,EAAE,IAAI,CAAC,EAAE;wBACX,IAAI,EAAE,IAAI,CAAC,IAAI;wBACf,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,EAAE;wBACnC,IAAI,EAAE,IAAI;qBACX,CAAC;oBAEF,cAAc,CAAC,MAAM,CAAC,CAAC;oBAEvB,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,CAAC;qBACxC;oBAED,eAAM,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;oBAE7C,sBAAO,MAAM,EAAC;;;;CACf;AA1DD,wCA0DC"}
@@ -0,0 +1,8 @@
1
+ export interface DocumentEntity {
2
+ id: string;
3
+ networkId: string;
4
+ type: string[];
5
+ correlation: string[];
6
+ data: string;
7
+ }
8
+ //# 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,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;CACd"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# 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":""}
@@ -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,EACL,cAAc,EACd,SAAS,EACV,MAAM,8CAA8C,CAAC;AAetD;;;;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,CAY5B"}
@@ -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.getAllDocuments = void 0;
40
+ var helpers_1 = require("./helpers");
41
+ var localStorageJSON_1 = require("../../localStorageJSON");
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 entities, mapDocument;
58
+ return __generator(this, function (_b) {
59
+ switch (_b.label) {
60
+ case 0: return [4 /*yield*/, localStorageJSON_1.localStorageJSON.getItem('documents')];
61
+ case 1:
62
+ entities = (_b.sent()) || [];
63
+ if (!allNetworks) {
64
+ entities = entities.filter(function (entity) { return entity.networkId === dataStore.networkId; });
65
+ }
66
+ mapDocument = allNetworks ? toWalletDocumentExpanded : helpers_1.toWalletDocument;
67
+ return [2 /*return*/, Promise.all(entities.map(mapDocument))];
68
+ }
69
+ });
70
+ });
71
+ }
72
+ exports.getAllDocuments = getAllDocuments;
73
+ //# 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,qCAA2C;AAE3C,2DAAwD;AAExD,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;;;;;wBAKK,qBAAM,mCAAgB,CAAC,OAAO,CAAC,WAAW,CAAC,EAAA;;oBAAvD,QAAQ,GAAG,CAAC,SAA2C,CAAC,IAAI,EAAE;oBAElE,IAAI,CAAC,WAAW,EAAE;wBAChB,QAAQ,GAAG,QAAQ,CAAC,MAAM,CACxB,UAAC,MAAsB,IAAK,OAAA,MAAM,CAAC,SAAS,KAAK,SAAS,CAAC,SAAS,EAAxC,CAAwC,CACrE,CAAC;qBACH;oBAEK,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;AAlBD,0CAkBC"}
@@ -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,EACL,YAAY,EACZ,cAAc,EACf,MAAM,8CAA8C,CAAC;AAGtD;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,EACpC,SAAS,EACT,EAAE,GACH,EAAE,YAAY,GAAG;IAChB,EAAE,EAAE,MAAM,CAAC;CACZ,GAAG,OAAO,CAAC,cAAc,CAAC,CAG1B;AAED,wBAAsB,gBAAgB,CAAC,EACrC,SAAS,EACT,MAAM,GACP,EAAE,YAAY,GAAG;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,GAAG,OAAO,CAAC,cAAc,CAAC,CAI1B"}
@@ -0,0 +1,76 @@
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 get_all_documents_1 = require("./get-all-documents");
41
+ /**
42
+ * Get document by id
43
+ * @param dataStore
44
+ * @param id
45
+ */
46
+ function getDocumentById(_a) {
47
+ var dataStore = _a.dataStore, id = _a.id;
48
+ return __awaiter(this, void 0, void 0, function () {
49
+ var allDocs;
50
+ return __generator(this, function (_b) {
51
+ switch (_b.label) {
52
+ case 0: return [4 /*yield*/, (0, get_all_documents_1.getAllDocuments)({ dataStore: dataStore, allNetworks: false })];
53
+ case 1:
54
+ allDocs = _b.sent();
55
+ return [2 /*return*/, allDocs.find(function (doc) { return doc.id === id; })];
56
+ }
57
+ });
58
+ });
59
+ }
60
+ exports.getDocumentById = getDocumentById;
61
+ function getDocumentsById(_a) {
62
+ var dataStore = _a.dataStore, idList = _a.idList;
63
+ return __awaiter(this, void 0, void 0, function () {
64
+ var allDocs;
65
+ return __generator(this, function (_b) {
66
+ switch (_b.label) {
67
+ case 0: return [4 /*yield*/, (0, get_all_documents_1.getAllDocuments)({ dataStore: dataStore, allNetworks: false })];
68
+ case 1:
69
+ allDocs = _b.sent();
70
+ return [2 /*return*/, allDocs.filter(function (doc) { return idList.includes(doc.id); })];
71
+ }
72
+ });
73
+ });
74
+ }
75
+ exports.getDocumentsById = getDocumentsById;
76
+ //# 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,yDAAoD;AAEpD;;;;GAIG;AACH,SAAsB,eAAe,CAAC,EAKrC;QAJC,SAAS,eAAA,EACT,EAAE,QAAA;;;;;wBAIc,qBAAM,IAAA,mCAAe,EAAC,EAAC,SAAS,WAAA,EAAE,WAAW,EAAE,KAAK,EAAC,CAAC,EAAA;;oBAAhE,OAAO,GAAG,SAAsD;oBACtE,sBAAO,OAAO,CAAC,IAAI,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,EAAE,KAAK,EAAE,EAAb,CAAa,CAAC,EAAC;;;;CAC3C;AARD,0CAQC;AAED,SAAsB,gBAAgB,CAAC,EAKtC;QAJC,SAAS,eAAA,EACT,MAAM,YAAA;;;;;wBAIU,qBAAM,IAAA,mCAAe,EAAC,EAAC,SAAS,WAAA,EAAE,WAAW,EAAE,KAAK,EAAC,CAAC,EAAA;;oBAAhE,OAAO,GAAG,SAAsD;oBAEtE,sBAAO,OAAO,CAAC,MAAM,CAAC,UAAA,GAAG,IAAI,OAAA,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,EAAvB,CAAuB,CAAC,EAAC;;;;CACvD;AATD,4CASC"}
@@ -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,EACL,YAAY,EACZ,cAAc,EACf,MAAM,8CAA8C,CAAC;AAGtD;;;;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,CAK5B"}
@@ -0,0 +1,62 @@
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 get_all_documents_1 = require("./get-all-documents");
41
+ /**
42
+ * Get related documents
43
+ * @param dataStore
44
+ * @param type
45
+ */
46
+ function getDocumentCorrelations(_a) {
47
+ var dataStore = _a.dataStore, documentId = _a.documentId;
48
+ return __awaiter(this, void 0, void 0, function () {
49
+ var allDocs, entity;
50
+ return __generator(this, function (_b) {
51
+ switch (_b.label) {
52
+ case 0: return [4 /*yield*/, (0, get_all_documents_1.getAllDocuments)({ dataStore: dataStore, allNetworks: false })];
53
+ case 1:
54
+ allDocs = _b.sent();
55
+ entity = allDocs.find(function (doc) { return doc.id === documentId; });
56
+ return [2 /*return*/, allDocs.filter(function (doc) { return entity.correlation.includes(doc.id); })];
57
+ }
58
+ });
59
+ });
60
+ }
61
+ exports.getDocumentCorrelations = getDocumentCorrelations;
62
+ //# sourceMappingURL=get-document-correlations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-document-correlations.js","sourceRoot":"","sources":["../../../src/entities/document/get-document-correlations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,yDAAoD;AAEpD;;;;GAIG;AACH,SAAsB,uBAAuB,CAAC,EAK7C;QAJC,SAAS,eAAA,EACT,UAAU,gBAAA;;;;;wBAIM,qBAAM,IAAA,mCAAe,EAAC,EAAC,SAAS,WAAA,EAAE,WAAW,EAAE,KAAK,EAAC,CAAC,EAAA;;oBAAhE,OAAO,GAAG,SAAsD;oBAChE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,EAAE,KAAK,UAAU,EAArB,CAAqB,CAAC,CAAC;oBAE1D,sBAAO,OAAO,CAAC,MAAM,CAAC,UAAA,GAAG,IAAI,OAAA,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,EAAnC,CAAmC,CAAC,EAAC;;;;CACnE;AAVD,0DAUC"}
@@ -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-documents-by-type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-documents-by-type.d.ts","sourceRoot":"","sources":["../../../src/entities/document/get-documents-by-type.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,cAAc,EACf,MAAM,8CAA8C,CAAC;AAGtD;;;;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,CAI5B"}
@@ -0,0 +1,61 @@
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 get_all_documents_1 = require("./get-all-documents");
41
+ /**
42
+ * Get documents by type
43
+ * @param dataStore
44
+ * @param type
45
+ */
46
+ function getDocumentsByType(_a) {
47
+ var dataStore = _a.dataStore, type = _a.type;
48
+ return __awaiter(this, void 0, void 0, function () {
49
+ var allDocs;
50
+ return __generator(this, function (_b) {
51
+ switch (_b.label) {
52
+ case 0: return [4 /*yield*/, (0, get_all_documents_1.getAllDocuments)({ dataStore: dataStore, allNetworks: false })];
53
+ case 1:
54
+ allDocs = _b.sent();
55
+ return [2 /*return*/, allDocs.filter(function (doc) { return doc.type === type || doc.type.includes(type); })];
56
+ }
57
+ });
58
+ });
59
+ }
60
+ exports.getDocumentsByType = getDocumentsByType;
61
+ //# sourceMappingURL=get-documents-by-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-documents-by-type.js","sourceRoot":"","sources":["../../../src/entities/document/get-documents-by-type.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,yDAAoD;AAEpD;;;;GAIG;AACH,SAAsB,kBAAkB,CAAC,EAKxC;QAJC,SAAS,eAAA,EACT,IAAI,UAAA;;;;;wBAIY,qBAAM,IAAA,mCAAe,EAAC,EAAC,SAAS,WAAA,EAAE,WAAW,EAAE,KAAK,EAAC,CAAC,EAAA;;oBAAhE,OAAO,GAAG,SAAsD;oBAEtE,sBAAO,OAAO,CAAC,MAAM,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,IAAI,KAAK,IAAI,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAA5C,CAA4C,CAAC,EAAC;;;;CAC5E;AATD,gDASC"}
@@ -0,0 +1,18 @@
1
+ import { ContextProps, WalletDocument } from '@docknetwork/wallet-sdk-data-store/lib/types';
2
+ import { DocumentEntity } from './document.entity';
3
+ /**
4
+ * Convert document entity to wallet document
5
+ * @param entity
6
+ */
7
+ export declare function toWalletDocument(entity: DocumentEntity): WalletDocument;
8
+ /**
9
+ * Convert wallet document to document entity
10
+ * @param walletDocument
11
+ */
12
+ export declare function toDocumentEntity({ dataStore, document, }: ContextProps & {
13
+ document: any;
14
+ }): Promise<DocumentEntity>;
15
+ export declare const saveOptions: {
16
+ transaction: boolean;
17
+ };
18
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/entities/document/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,cAAc,EAAC,MAAM,8CAA8C,CAAC;AAE1F,OAAO,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAC;AAIjD;;;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,CAU1B;AAED,eAAO,MAAM,WAAW;;CAIvB,CAAC"}