@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.
- package/jest.config.ts +20 -0
- package/lib/entities/document/create-document.d.ts +12 -0
- package/lib/entities/document/create-document.d.ts.map +1 -0
- package/lib/entities/document/create-document.js +150 -0
- package/lib/entities/document/create-document.js.map +1 -0
- package/lib/entities/document/document.entity.d.ts +8 -0
- package/lib/entities/document/document.entity.d.ts.map +1 -0
- package/lib/entities/document/document.entity.js +3 -0
- package/lib/entities/document/document.entity.js.map +1 -0
- package/lib/entities/document/get-all-documents.d.ts +11 -0
- package/lib/entities/document/get-all-documents.d.ts.map +1 -0
- package/lib/entities/document/get-all-documents.js +73 -0
- package/lib/entities/document/get-all-documents.js.map +1 -0
- package/lib/entities/document/get-document-by-id.d.ts +13 -0
- package/lib/entities/document/get-document-by-id.d.ts.map +1 -0
- package/lib/entities/document/get-document-by-id.js +76 -0
- package/lib/entities/document/get-document-by-id.js.map +1 -0
- package/lib/entities/document/get-document-correlations.d.ts +10 -0
- package/lib/entities/document/get-document-correlations.d.ts.map +1 -0
- package/lib/entities/document/get-document-correlations.js +62 -0
- package/lib/entities/document/get-document-correlations.js.map +1 -0
- package/lib/entities/document/get-documents-by-type.d.ts +10 -0
- package/lib/entities/document/get-documents-by-type.d.ts.map +1 -0
- package/lib/entities/document/get-documents-by-type.js +61 -0
- package/lib/entities/document/get-documents-by-type.js.map +1 -0
- package/lib/entities/document/helpers.d.ts +18 -0
- package/lib/entities/document/helpers.d.ts.map +1 -0
- package/lib/entities/document/helpers.js +81 -0
- package/lib/entities/document/helpers.js.map +1 -0
- package/lib/entities/document/index.d.ts +10 -0
- package/lib/entities/document/index.d.ts.map +1 -0
- package/lib/entities/document/index.js +26 -0
- package/lib/entities/document/index.js.map +1 -0
- package/lib/entities/document/remove-document.d.ts +16 -0
- package/lib/entities/document/remove-document.d.ts.map +1 -0
- package/lib/entities/document/remove-document.js +89 -0
- package/lib/entities/document/remove-document.js.map +1 -0
- package/lib/entities/document/update-document.d.ts +11 -0
- package/lib/entities/document/update-document.d.ts.map +1 -0
- package/lib/entities/document/update-document.js +78 -0
- package/lib/entities/document/update-document.js.map +1 -0
- package/lib/entities/log.entity.d.ts +13 -0
- package/lib/entities/log.entity.d.ts.map +1 -0
- package/lib/entities/log.entity.js +91 -0
- package/lib/entities/log.entity.js.map +1 -0
- package/lib/entities/network.entity.d.ts +6 -0
- package/lib/entities/network.entity.d.ts.map +1 -0
- package/lib/entities/network.entity.js +3 -0
- package/lib/entities/network.entity.js.map +1 -0
- package/lib/entities/wallet.entity.d.ts +10 -0
- package/lib/entities/wallet.entity.d.ts.map +1 -0
- package/lib/entities/wallet.entity.js +77 -0
- package/lib/entities/wallet.entity.js.map +1 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +185 -0
- package/lib/index.js.map +1 -0
- package/lib/localStorageJSON.d.ts +7 -0
- package/lib/localStorageJSON.d.ts.map +1 -0
- package/lib/localStorageJSON.js +80 -0
- package/lib/localStorageJSON.js.map +1 -0
- package/package.json +32 -0
- package/scripts/publish.sh +3 -0
- package/src/__tests__/index.test.ts +56 -0
- package/src/__tests__/v1-data-store.test.ts +24 -0
- package/src/entities/document/create-document.ts +82 -0
- package/src/entities/document/decument.entity.test.ts +135 -0
- package/src/entities/document/document.entity.ts +7 -0
- package/src/entities/document/get-all-documents.ts +42 -0
- package/src/entities/document/get-document-by-id.ts +31 -0
- package/src/entities/document/get-document-correlations.ts +22 -0
- package/src/entities/document/get-documents-by-type.ts +21 -0
- package/src/entities/document/helpers.ts +50 -0
- package/src/entities/document/index.ts +9 -0
- package/src/entities/document/remove-document.ts +43 -0
- package/src/entities/document/update-document.ts +36 -0
- package/src/entities/log.entity.ts +26 -0
- package/src/entities/network.entity.ts +5 -0
- package/src/entities/wallet.entity.ts +29 -0
- package/src/index.ts +134 -0
- package/src/localStorageJSON.ts +24 -0
- package/test/mock-local-storage.ts +17 -0
- package/test/test-utils.ts +23 -0
- package/test/wallet.json +209 -0
- package/tsconfig.build.json +25 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +32 -0
|
@@ -0,0 +1,81 @@
|
|
|
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.saveOptions = exports.toDocumentEntity = exports.toWalletDocument = void 0;
|
|
40
|
+
/**
|
|
41
|
+
* Convert document entity to wallet document
|
|
42
|
+
* @param entity
|
|
43
|
+
*/
|
|
44
|
+
function toWalletDocument(entity) {
|
|
45
|
+
if (!(entity === null || entity === void 0 ? void 0 : entity.data)) {
|
|
46
|
+
return entity;
|
|
47
|
+
}
|
|
48
|
+
var result = entity.data;
|
|
49
|
+
if (!result.id) {
|
|
50
|
+
result.id = entity.id;
|
|
51
|
+
}
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
exports.toWalletDocument = toWalletDocument;
|
|
55
|
+
/**
|
|
56
|
+
* Convert wallet document to document entity
|
|
57
|
+
* @param walletDocument
|
|
58
|
+
*/
|
|
59
|
+
function toDocumentEntity(_a) {
|
|
60
|
+
var dataStore = _a.dataStore, document = _a.document;
|
|
61
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
62
|
+
var type;
|
|
63
|
+
return __generator(this, function (_b) {
|
|
64
|
+
type = document.type || [];
|
|
65
|
+
return [2 /*return*/, {
|
|
66
|
+
id: document.id,
|
|
67
|
+
type: type,
|
|
68
|
+
data: document,
|
|
69
|
+
correlation: document.correlation || [],
|
|
70
|
+
networkId: dataStore.networkId,
|
|
71
|
+
}];
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
exports.toDocumentEntity = toDocumentEntity;
|
|
76
|
+
exports.saveOptions = {
|
|
77
|
+
// Android is having issues when running multiple document saves in a short period of time
|
|
78
|
+
// We will disable transactions for now until we find a better solution
|
|
79
|
+
transaction: false,
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/entities/document/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,MAAsB;IACrD,IAAI,CAAC,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,CAAA,EAAE;QACjB,OAAO,MAAM,CAAC;KACf;IAED,IAAM,MAAM,GAAQ,MAAM,CAAC,IAAI,CAAC;IAEhC,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE;QACd,MAAM,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;KACvB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAZD,4CAYC;AAED;;;GAGG;AACH,SAAsB,gBAAgB,CAAC,EAKtC;QAJC,SAAS,eAAA,EACT,QAAQ,cAAA;;;;YAIF,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC;YAEjC,sBAAO;oBACL,EAAE,EAAE,QAAQ,CAAC,EAAE;oBACf,IAAI,EAAE,IAAI;oBACV,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,QAAQ,CAAC,WAAW,IAAI,EAAE;oBACvC,SAAS,EAAE,SAAS,CAAC,SAAS;iBACb,EAAC;;;CACrB;AAfD,4CAeC;AAEY,QAAA,WAAW,GAAG;IACzB,0FAA0F;IAC1F,uEAAuE;IACvE,WAAW,EAAE,KAAK;CACnB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './document.entity';
|
|
2
|
+
export * from './create-document';
|
|
3
|
+
export * from './helpers';
|
|
4
|
+
export * from './get-documents-by-type';
|
|
5
|
+
export * from './get-document-by-id';
|
|
6
|
+
export * from './get-all-documents';
|
|
7
|
+
export * from './update-document';
|
|
8
|
+
export * from './remove-document';
|
|
9
|
+
export * from './get-document-correlations';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/entities/document/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./document.entity"), exports);
|
|
18
|
+
__exportStar(require("./create-document"), exports);
|
|
19
|
+
__exportStar(require("./helpers"), exports);
|
|
20
|
+
__exportStar(require("./get-documents-by-type"), exports);
|
|
21
|
+
__exportStar(require("./get-document-by-id"), exports);
|
|
22
|
+
__exportStar(require("./get-all-documents"), exports);
|
|
23
|
+
__exportStar(require("./update-document"), exports);
|
|
24
|
+
__exportStar(require("./remove-document"), exports);
|
|
25
|
+
__exportStar(require("./get-document-correlations"), exports);
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/entities/document/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,oDAAkC;AAClC,4CAA0B;AAC1B,0DAAwC;AACxC,uDAAqC;AACrC,sDAAoC;AACpC,oDAAkC;AAClC,oDAAkC;AAClC,8DAA4C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ContextProps } from '@docknetwork/wallet-sdk-data-store/lib/types';
|
|
2
|
+
/**
|
|
3
|
+
* Remove document
|
|
4
|
+
* @param dataStore
|
|
5
|
+
* @param id
|
|
6
|
+
*/
|
|
7
|
+
export declare function removeDocument({ dataStore, id, options, }: ContextProps & {
|
|
8
|
+
id: string;
|
|
9
|
+
options?: any;
|
|
10
|
+
}): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Remove all documents
|
|
13
|
+
* @param dataStore
|
|
14
|
+
*/
|
|
15
|
+
export declare function removeAllDocuments({ dataStore, }: ContextProps): Promise<void>;
|
|
16
|
+
//# sourceMappingURL=remove-document.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-document.d.ts","sourceRoot":"","sources":["../../../src/entities/document/remove-document.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EAEb,MAAM,8CAA8C,CAAC;AAKtD;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,EACnC,SAAS,EACT,EAAE,EACF,OAAO,GACR,EAAE,YAAY,GAAG;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,GAAG,CAAA;CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAY5D;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,SAAS,GACV,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAI9B"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.removeAllDocuments = exports.removeDocument = void 0;
|
|
43
|
+
var assert_1 = __importDefault(require("assert"));
|
|
44
|
+
var types_1 = require("@docknetwork/wallet-sdk-data-store/lib/types");
|
|
45
|
+
var logger_1 = require("@docknetwork/wallet-sdk-data-store/lib/logger");
|
|
46
|
+
var get_all_documents_1 = require("./get-all-documents");
|
|
47
|
+
var localStorageJSON_1 = require("../../localStorageJSON");
|
|
48
|
+
/**
|
|
49
|
+
* Remove document
|
|
50
|
+
* @param dataStore
|
|
51
|
+
* @param id
|
|
52
|
+
*/
|
|
53
|
+
function removeDocument(_a) {
|
|
54
|
+
var dataStore = _a.dataStore, id = _a.id, options = _a.options;
|
|
55
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
56
|
+
var allDocs, filteredDocs;
|
|
57
|
+
return __generator(this, function (_b) {
|
|
58
|
+
switch (_b.label) {
|
|
59
|
+
case 0:
|
|
60
|
+
(0, assert_1.default)(!!id, 'Document id is required');
|
|
61
|
+
logger_1.logger.debug("Removing document with id ".concat(id));
|
|
62
|
+
return [4 /*yield*/, (0, get_all_documents_1.getAllDocuments)({ dataStore: dataStore, allNetworks: true })];
|
|
63
|
+
case 1:
|
|
64
|
+
allDocs = _b.sent();
|
|
65
|
+
filteredDocs = allDocs.filter(function (doc) { return doc.id !== id && doc.networkId !== dataStore.networkId; });
|
|
66
|
+
localStorageJSON_1.localStorageJSON.setItem('documents', filteredDocs);
|
|
67
|
+
dataStore.events.emit(types_1.DataStoreEvents.DocumentDeleted, id);
|
|
68
|
+
return [2 /*return*/];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
exports.removeDocument = removeDocument;
|
|
74
|
+
/**
|
|
75
|
+
* Remove all documents
|
|
76
|
+
* @param dataStore
|
|
77
|
+
*/
|
|
78
|
+
function removeAllDocuments(_a) {
|
|
79
|
+
var dataStore = _a.dataStore;
|
|
80
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
81
|
+
return __generator(this, function (_b) {
|
|
82
|
+
localStorageJSON_1.localStorageJSON.setItem('documents', []);
|
|
83
|
+
dataStore.events.emit(types_1.DataStoreEvents.AllDocumentsDeleted);
|
|
84
|
+
return [2 /*return*/];
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
exports.removeAllDocuments = removeAllDocuments;
|
|
89
|
+
//# sourceMappingURL=remove-document.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-document.js","sourceRoot":"","sources":["../../../src/entities/document/remove-document.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA4B;AAC5B,sEAGsD;AACtD,wEAAqE;AACrE,yDAAoD;AACpD,2DAAwD;AAExD;;;;GAIG;AACH,SAAsB,cAAc,CAAC,EAIQ;QAH3C,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;oBAChC,qBAAM,IAAA,mCAAe,EAAC,EAAC,SAAS,WAAA,EAAE,WAAW,EAAE,IAAI,EAAC,CAAC,EAAA;;oBAA/D,OAAO,GAAG,SAAqD;oBAC/D,YAAY,GAAG,OAAO,CAAC,MAAM,CACjC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,GAAG,CAAC,SAAS,KAAK,SAAS,CAAC,SAAS,EAAtD,CAAsD,CAC9D,CAAC;oBAEF,mCAAgB,CAAC,OAAO,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;oBAEpD,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,uBAAe,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;;;;;CAC5D;AAhBD,wCAgBC;AAED;;;GAGG;AACH,SAAsB,kBAAkB,CAAC,EAE1B;QADb,SAAS,eAAA;;;YAET,mCAAgB,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;YAE1C,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,uBAAe,CAAC,mBAAmB,CAAC,CAAC;;;;CAC5D;AAND,gDAMC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ContextProps, WalletDocument } from '@docknetwork/wallet-sdk-data-store/lib/types';
|
|
2
|
+
/**
|
|
3
|
+
* Update document
|
|
4
|
+
* @param dataStore
|
|
5
|
+
* @param document
|
|
6
|
+
*/
|
|
7
|
+
export declare function updateDocument({ dataStore, document, }: ContextProps & {
|
|
8
|
+
document: WalletDocument;
|
|
9
|
+
options?: any;
|
|
10
|
+
}): Promise<WalletDocument>;
|
|
11
|
+
//# sourceMappingURL=update-document.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-document.d.ts","sourceRoot":"","sources":["../../../src/entities/document/update-document.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,cAAc,EACf,MAAM,8CAA8C,CAAC;AAKtD;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,EACnC,SAAS,EACT,QAAQ,GACT,EAAE,YAAY,GAAG;IAChB,QAAQ,EAAE,cAAc,CAAC;IACzB,OAAO,CAAC,EAAE,GAAG,CAAC;CACf,GAAG,OAAO,CAAC,cAAc,CAAC,CAgB1B"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.updateDocument = void 0;
|
|
40
|
+
var helpers_1 = require("./helpers");
|
|
41
|
+
var logger_1 = require("@docknetwork/wallet-sdk-data-store/lib/logger");
|
|
42
|
+
var localStorageJSON_1 = require("../../localStorageJSON");
|
|
43
|
+
/**
|
|
44
|
+
* Update document
|
|
45
|
+
* @param dataStore
|
|
46
|
+
* @param document
|
|
47
|
+
*/
|
|
48
|
+
function updateDocument(_a) {
|
|
49
|
+
var dataStore = _a.dataStore, document = _a.document;
|
|
50
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
51
|
+
var allDocs, index, _b, _c;
|
|
52
|
+
return __generator(this, function (_d) {
|
|
53
|
+
switch (_d.label) {
|
|
54
|
+
case 0:
|
|
55
|
+
logger_1.logger.debug("Updating document with id ".concat(document.id));
|
|
56
|
+
return [4 /*yield*/, localStorageJSON_1.localStorageJSON.getItem('documents')];
|
|
57
|
+
case 1:
|
|
58
|
+
allDocs = (_d.sent()) || [];
|
|
59
|
+
index = allDocs.findIndex(function (doc) { return doc.id === document.id; });
|
|
60
|
+
_b = allDocs;
|
|
61
|
+
_c = index;
|
|
62
|
+
return [4 /*yield*/, (0, helpers_1.toDocumentEntity)({
|
|
63
|
+
dataStore: dataStore,
|
|
64
|
+
document: document,
|
|
65
|
+
})];
|
|
66
|
+
case 2:
|
|
67
|
+
_b[_c] = _d.sent();
|
|
68
|
+
return [4 /*yield*/, localStorageJSON_1.localStorageJSON.setItem('documents', allDocs)];
|
|
69
|
+
case 3:
|
|
70
|
+
_d.sent();
|
|
71
|
+
dataStore.events.emit('DocumentUpdated', document);
|
|
72
|
+
return [2 /*return*/, document];
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
exports.updateDocument = updateDocument;
|
|
78
|
+
//# sourceMappingURL=update-document.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-document.js","sourceRoot":"","sources":["../../../src/entities/document/update-document.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,qCAA2C;AAC3C,wEAAqE;AACrE,2DAAwD;AAExD;;;;GAIG;AACH,SAAsB,cAAc,CAAC,EAMpC;QALC,SAAS,eAAA,EACT,QAAQ,cAAA;;;;;;oBAKR,eAAM,CAAC,KAAK,CAAC,oCAA6B,QAAQ,CAAC,EAAE,CAAE,CAAC,CAAC;oBAExC,qBAAM,mCAAgB,CAAC,OAAO,CAAC,WAAW,CAAC,EAAA;;oBAAtD,OAAO,GAAG,CAAC,SAA2C,CAAC,IAAI,EAAE;oBAC7D,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,EAAE,KAAK,QAAQ,CAAC,EAAE,EAAtB,CAAsB,CAAC,CAAC;oBAE/D,KAAA,OAAO,CAAA;oBAAC,KAAA,KAAK,CAAA;oBAAI,qBAAM,IAAA,0BAAgB,EAAC;4BACtC,SAAS,WAAA;4BACT,QAAQ,UAAA;yBACT,CAAC,EAAA;;oBAHF,MAAc,GAAG,SAGf,CAAC;oBAEH,qBAAM,mCAAgB,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,EAAA;;oBAApD,SAAoD,CAAC;oBAErD,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC;oBAEnD,sBAAO,QAAQ,EAAC;;;;CACjB;AAtBD,wCAsBC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DataStore } from '@docknetwork/wallet-sdk-data-store/lib/types';
|
|
2
|
+
export interface LogEntity {
|
|
3
|
+
id: string;
|
|
4
|
+
level: string;
|
|
5
|
+
value: string;
|
|
6
|
+
createdAt: Date;
|
|
7
|
+
}
|
|
8
|
+
export declare function getLogs(): Promise<LogEntity[]>;
|
|
9
|
+
export declare function createLog({ log, }: {
|
|
10
|
+
dataStore: DataStore;
|
|
11
|
+
log: LogEntity;
|
|
12
|
+
}): Promise<LogEntity>;
|
|
13
|
+
//# sourceMappingURL=log.entity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.entity.d.ts","sourceRoot":"","sources":["../../src/entities/log.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,8CAA8C,CAAC;AAGvE,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,wBAAsB,OAAO,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,CAEpD;AAED,wBAAsB,SAAS,CAAC,EAC9B,GAAG,GACJ,EAAE;IACD,SAAS,EAAE,SAAS,CAAC;IACrB,GAAG,EAAE,SAAS,CAAC;CAChB,GAAG,OAAO,CAAC,SAAS,CAAC,CAMrB"}
|
|
@@ -0,0 +1,91 @@
|
|
|
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.createLog = exports.getLogs = void 0;
|
|
65
|
+
var localStorageJSON_1 = require("../localStorageJSON");
|
|
66
|
+
function getLogs() {
|
|
67
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
68
|
+
return __generator(this, function (_a) {
|
|
69
|
+
return [2 /*return*/, localStorageJSON_1.localStorageJSON.getItem('logs') || []];
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
exports.getLogs = getLogs;
|
|
74
|
+
function createLog(_a) {
|
|
75
|
+
var log = _a.log;
|
|
76
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
77
|
+
var logs;
|
|
78
|
+
return __generator(this, function (_b) {
|
|
79
|
+
switch (_b.label) {
|
|
80
|
+
case 0:
|
|
81
|
+
log.createdAt = new Date();
|
|
82
|
+
return [4 /*yield*/, getLogs()];
|
|
83
|
+
case 1:
|
|
84
|
+
logs = _b.sent();
|
|
85
|
+
return [2 /*return*/, localStorageJSON_1.localStorageJSON.setItem('logs', __spreadArray(__spreadArray([], __read(logs), false), [log], false))];
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
exports.createLog = createLog;
|
|
91
|
+
//# sourceMappingURL=log.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.entity.js","sourceRoot":"","sources":["../../src/entities/log.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,wDAAqD;AASrD,SAAsB,OAAO;;;YAC3B,sBAAO,mCAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,EAAC;;;CAC/C;AAFD,0BAEC;AAED,SAAsB,SAAS,CAAC,EAK/B;QAJC,GAAG,SAAA;;;;;;oBAKH,GAAG,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;oBAEd,qBAAM,OAAO,EAAE,EAAA;;oBAAtB,IAAI,GAAG,SAAe;oBAE5B,sBAAO,mCAAgB,CAAC,OAAO,CAAC,MAAM,yCAAM,IAAI,YAAE,GAAG,UAAE,EAAC;;;;CACzD;AAXD,8BAWC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network.entity.d.ts","sourceRoot":"","sources":["../../src/entities/network.entity.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network.entity.js","sourceRoot":"","sources":["../../src/entities/network.entity.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ContextProps } from '@docknetwork/wallet-sdk-data-store/lib/types';
|
|
2
|
+
export interface WalletEntity {
|
|
3
|
+
id: string;
|
|
4
|
+
version?: string;
|
|
5
|
+
networkId: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function getWallet({ dataStore, }: ContextProps): Promise<WalletEntity>;
|
|
8
|
+
export declare function createWallet({ dataStore }: ContextProps): Promise<WalletEntity>;
|
|
9
|
+
export declare function updateWallet({ dataStore }: ContextProps): Promise<WalletEntity>;
|
|
10
|
+
//# sourceMappingURL=wallet.entity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet.entity.d.ts","sourceRoot":"","sources":["../../src/entities/wallet.entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,8CAA8C,CAAC;AAE1E,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAsB,SAAS,CAAC,EAC9B,SAAS,GACV,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAGtC;AAED,wBAAgB,YAAY,CAAC,EAAC,SAAS,EAAC,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAK7E;AAED,wBAAgB,YAAY,CAAC,EAAC,SAAS,EAAC,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAK7E"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
+
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;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.updateWallet = exports.createWallet = exports.getWallet = void 0;
|
|
51
|
+
var localStorageJSON_1 = require("../localStorageJSON");
|
|
52
|
+
function getWallet(_a) {
|
|
53
|
+
var dataStore = _a.dataStore;
|
|
54
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
55
|
+
var result;
|
|
56
|
+
return __generator(this, function (_b) {
|
|
57
|
+
switch (_b.label) {
|
|
58
|
+
case 0: return [4 /*yield*/, localStorageJSON_1.localStorageJSON.getItem('wallet')];
|
|
59
|
+
case 1:
|
|
60
|
+
result = _b.sent();
|
|
61
|
+
return [2 /*return*/, result];
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
exports.getWallet = getWallet;
|
|
67
|
+
function createWallet(_a) {
|
|
68
|
+
var dataStore = _a.dataStore;
|
|
69
|
+
return localStorageJSON_1.localStorageJSON.setItem('wallet', __assign({ id: 'configs' }, dataStore));
|
|
70
|
+
}
|
|
71
|
+
exports.createWallet = createWallet;
|
|
72
|
+
function updateWallet(_a) {
|
|
73
|
+
var dataStore = _a.dataStore;
|
|
74
|
+
return localStorageJSON_1.localStorageJSON.setItem('wallet', __assign({ id: 'configs' }, dataStore));
|
|
75
|
+
}
|
|
76
|
+
exports.updateWallet = updateWallet;
|
|
77
|
+
//# sourceMappingURL=wallet.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet.entity.js","sourceRoot":"","sources":["../../src/entities/wallet.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAAqD;AASrD,SAAsB,SAAS,CAAC,EAEjB;QADb,SAAS,eAAA;;;;;wBAEM,qBAAM,mCAAgB,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAA;;oBAAjD,MAAM,GAAG,SAAwC;oBACvD,sBAAO,MAAM,EAAC;;;;CACf;AALD,8BAKC;AAED,SAAgB,YAAY,CAAC,EAAyB;QAAxB,SAAS,eAAA;IACrC,OAAO,mCAAgB,CAAC,OAAO,CAAC,QAAQ,aACtC,EAAE,EAAE,SAAS,IACV,SAAS,EACZ,CAAC;AACL,CAAC;AALD,oCAKC;AAED,SAAgB,YAAY,CAAC,EAAyB;QAAxB,SAAS,eAAA;IACrC,OAAO,mCAAgB,CAAC,OAAO,CAAC,QAAQ,aACtC,EAAE,EAAE,SAAS,IACV,SAAS,EACZ,CAAC;AACL,CAAC;AALD,oCAKC"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAmBA,OAAO,EAEL,SAAS,EACT,gBAAgB,EACjB,MAAM,8CAA8C,CAAC;AAKtD,wBAAsB,eAAe,CACnC,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,SAAS,CAAC,CAuGpB"}
|