@docknetwork/wallet-sdk-data-store 0.4.19 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/jest.config.ts +0 -1
- package/lib/configs.d.ts.map +1 -1
- package/lib/configs.js +4 -9
- package/lib/configs.js.map +1 -1
- package/lib/helpers.d.ts +5 -4
- package/lib/helpers.d.ts.map +1 -1
- package/lib/helpers.js +53 -44
- package/lib/helpers.js.map +1 -1
- package/lib/index.d.ts +12 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +44 -48
- package/lib/index.js.map +1 -1
- package/lib/logger.d.ts +2 -0
- package/lib/logger.d.ts.map +1 -1
- package/lib/logger.js +6 -0
- package/lib/logger.js.map +1 -1
- package/lib/types.d.ts +41 -2
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js +8 -0
- package/lib/types.js.map +1 -1
- package/package.json +3 -2
- package/src/configs.ts +4 -9
- package/src/helpers.ts +17 -42
- package/src/index.ts +40 -31
- package/src/logger.ts +6 -0
- package/src/types.ts +46 -3
- package/test/mock-local-storage.ts +1 -1
- package/test/wallet.json +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/LICENSE +0 -39
- package/lib/entities/document/create-document.d.ts +0 -10
- package/lib/entities/document/create-document.d.ts.map +0 -1
- package/lib/entities/document/create-document.js +0 -111
- package/lib/entities/document/create-document.js.map +0 -1
- package/lib/entities/document/document.entity.d.ts +0 -11
- package/lib/entities/document/document.entity.d.ts.map +0 -1
- package/lib/entities/document/document.entity.js +0 -55
- package/lib/entities/document/document.entity.js.map +0 -1
- package/lib/entities/document/get-all-documents.d.ts +0 -11
- package/lib/entities/document/get-all-documents.d.ts.map +0 -1
- package/lib/entities/document/get-all-documents.js +0 -78
- package/lib/entities/document/get-all-documents.js.map +0 -1
- package/lib/entities/document/get-documens-by-type.d.ts +0 -10
- package/lib/entities/document/get-documens-by-type.d.ts.map +0 -1
- package/lib/entities/document/get-documens-by-type.js +0 -71
- package/lib/entities/document/get-documens-by-type.js.map +0 -1
- package/lib/entities/document/get-document-by-id.d.ts +0 -13
- package/lib/entities/document/get-document-by-id.d.ts.map +0 -1
- package/lib/entities/document/get-document-by-id.js +0 -92
- package/lib/entities/document/get-document-by-id.js.map +0 -1
- package/lib/entities/document/get-document-correlations.d.ts +0 -10
- package/lib/entities/document/get-document-correlations.d.ts.map +0 -1
- package/lib/entities/document/get-document-correlations.js +0 -78
- package/lib/entities/document/get-document-correlations.js.map +0 -1
- package/lib/entities/document/helpers.d.ts +0 -30
- package/lib/entities/document/helpers.d.ts.map +0 -1
- package/lib/entities/document/helpers.js +0 -196
- package/lib/entities/document/helpers.js.map +0 -1
- package/lib/entities/document/index.d.ts +0 -10
- package/lib/entities/document/index.d.ts.map +0 -1
- package/lib/entities/document/index.js +0 -26
- package/lib/entities/document/index.js.map +0 -1
- package/lib/entities/document/remove-document.d.ts +0 -15
- package/lib/entities/document/remove-document.d.ts.map +0 -1
- package/lib/entities/document/remove-document.js +0 -94
- package/lib/entities/document/remove-document.js.map +0 -1
- package/lib/entities/document/update-document.d.ts +0 -10
- package/lib/entities/document/update-document.d.ts.map +0 -1
- package/lib/entities/document/update-document.js +0 -72
- package/lib/entities/document/update-document.js.map +0 -1
- package/lib/entities/document-type.entity.d.ts +0 -6
- package/lib/entities/document-type.entity.d.ts.map +0 -1
- package/lib/entities/document-type.entity.js +0 -32
- package/lib/entities/document-type.entity.js.map +0 -1
- package/lib/entities/log.entity.d.ts +0 -15
- package/lib/entities/log.entity.d.ts.map +0 -1
- package/lib/entities/log.entity.js +0 -108
- package/lib/entities/log.entity.js.map +0 -1
- package/lib/entities/network.entity.d.ts +0 -6
- package/lib/entities/network.entity.d.ts.map +0 -1
- package/lib/entities/network.entity.js +0 -35
- package/lib/entities/network.entity.js.map +0 -1
- package/lib/entities/transaction.entity.d.ts +0 -24
- package/lib/entities/transaction.entity.d.ts.map +0 -1
- package/lib/entities/transaction.entity.js +0 -139
- package/lib/entities/transaction.entity.js.map +0 -1
- package/lib/entities/wallet.entity.d.ts +0 -10
- package/lib/entities/wallet.entity.d.ts.map +0 -1
- package/lib/entities/wallet.entity.js +0 -109
- package/lib/entities/wallet.entity.js.map +0 -1
- package/lib/migration/bootstrap-tables.d.ts +0 -3
- package/lib/migration/bootstrap-tables.d.ts.map +0 -1
- package/lib/migration/bootstrap-tables.js +0 -8
- package/lib/migration/bootstrap-tables.js.map +0 -1
- package/lib/migration/index.d.ts +0 -8
- package/lib/migration/index.d.ts.map +0 -1
- package/lib/migration/index.js +0 -132
- package/lib/migration/index.js.map +0 -1
- package/lib/migration/migration1/index.d.ts +0 -16
- package/lib/migration/migration1/index.d.ts.map +0 -1
- package/lib/migration/migration1/index.js +0 -110
- package/lib/migration/migration1/index.js.map +0 -1
- package/lib/migration/migration1/migrate-v1-data.d.ts +0 -8
- package/lib/migration/migration1/migrate-v1-data.d.ts.map +0 -1
- package/lib/migration/migration1/migrate-v1-data.js +0 -171
- package/lib/migration/migration1/migrate-v1-data.js.map +0 -1
- package/lib/migration/migration1/v1-data-store.d.ts +0 -15
- package/lib/migration/migration1/v1-data-store.d.ts.map +0 -1
- package/lib/migration/migration1/v1-data-store.js +0 -80
- package/lib/migration/migration1/v1-data-store.js.map +0 -1
- package/lib/migrations/1691498362273-bootstrap.d.ts +0 -7
- package/lib/migrations/1691498362273-bootstrap.d.ts.map +0 -1
- package/lib/migrations/1691498362273-bootstrap.js +0 -178
- package/lib/migrations/1691498362273-bootstrap.js.map +0 -1
- package/lib/migrations/index.d.ts +0 -4
- package/lib/migrations/index.d.ts.map +0 -1
- package/lib/migrations/index.js +0 -5
- package/lib/migrations/index.js.map +0 -1
- package/lib/migrations-data-source.d.ts +0 -3
- package/lib/migrations-data-source.d.ts.map +0 -1
- package/lib/migrations-data-source.js +0 -8
- package/lib/migrations-data-source.js.map +0 -1
- package/lib/typeorm.d.ts +0 -2
- package/lib/typeorm.d.ts.map +0 -1
- package/lib/typeorm.js +0 -18
- package/lib/typeorm.js.map +0 -1
- package/setup-tests.ts +0 -0
- package/src/entities/document/create-document.ts +0 -72
- package/src/entities/document/decument.entity.test.ts +0 -135
- package/src/entities/document/document.entity.ts +0 -40
- package/src/entities/document/get-all-documents.ts +0 -39
- package/src/entities/document/get-documens-by-type.ts +0 -30
- package/src/entities/document/get-document-by-id.ts +0 -45
- package/src/entities/document/get-document-correlations.ts +0 -34
- package/src/entities/document/helpers.ts +0 -115
- package/src/entities/document/index.ts +0 -9
- package/src/entities/document/remove-document.ts +0 -34
- package/src/entities/document/update-document.ts +0 -25
- package/src/entities/document-type.entity.ts +0 -11
- package/src/entities/log.entity.ts +0 -46
- package/src/entities/network.entity.ts +0 -14
- package/src/entities/transaction.entity.ts +0 -67
- package/src/entities/wallet.entity.ts +0 -37
- package/src/migration/bootstrap-tables.ts +0 -5
- package/src/migration/index.ts +0 -53
- package/src/migration/migration1/index.ts +0 -64
- package/src/migration/migration1/migrate-v1-data.ts +0 -57
- package/src/migration/migration1/v1-data-store.ts +0 -39
- package/src/migrations/1691498362273-bootstrap.ts +0 -130
- package/src/migrations/index.ts +0 -3
- package/src/migrations-data-source.ts +0 -6
- package/src/typeorm.ts +0 -1
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.isRunningOnV1DataStore = exports.migration1 = void 0;
|
|
40
|
-
var v1_data_store_1 = require("./v1-data-store");
|
|
41
|
-
var logger_1 = require("../../logger");
|
|
42
|
-
var migrate_v1_data_1 = require("./migrate-v1-data");
|
|
43
|
-
/**
|
|
44
|
-
* Migrate from v1 to v2
|
|
45
|
-
*
|
|
46
|
-
* v1 data store is stored in local storage
|
|
47
|
-
* v2 will store on typeorm
|
|
48
|
-
*
|
|
49
|
-
*/
|
|
50
|
-
function migration1(_a) {
|
|
51
|
-
var dataStore = _a.dataStore;
|
|
52
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
53
|
-
return __generator(this, function (_b) {
|
|
54
|
-
switch (_b.label) {
|
|
55
|
-
case 0:
|
|
56
|
-
logger_1.logger.debug('Checking if v1 migration is required');
|
|
57
|
-
if (dataStore.version !== 'v1') {
|
|
58
|
-
logger_1.logger.debug('v1 data migration NOT required');
|
|
59
|
-
return [2 /*return*/, {
|
|
60
|
-
migrated: false,
|
|
61
|
-
version: dataStore.version,
|
|
62
|
-
}];
|
|
63
|
-
}
|
|
64
|
-
logger_1.logger.debug('v1 data Migration required');
|
|
65
|
-
return [4 /*yield*/, (0, migrate_v1_data_1.migrateV1Data)({ dataStore: dataStore })];
|
|
66
|
-
case 1:
|
|
67
|
-
_b.sent();
|
|
68
|
-
return [2 /*return*/, {
|
|
69
|
-
migrated: true,
|
|
70
|
-
version: 'v2',
|
|
71
|
-
}];
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
exports.migration1 = migration1;
|
|
77
|
-
/**
|
|
78
|
-
* Check if a migration from v2 is required
|
|
79
|
-
* Once v2 is migrated, the local storage entry will be removed
|
|
80
|
-
*/
|
|
81
|
-
function isRunningOnV1DataStore(_a) {
|
|
82
|
-
var dataStore = _a.dataStore;
|
|
83
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
84
|
-
var v1LocalStorage, documents;
|
|
85
|
-
return __generator(this, function (_b) {
|
|
86
|
-
switch (_b.label) {
|
|
87
|
-
case 0:
|
|
88
|
-
// If sdk version is defined, can skip migration
|
|
89
|
-
if (dataStore.version) {
|
|
90
|
-
return [2 /*return*/, false];
|
|
91
|
-
}
|
|
92
|
-
v1LocalStorage = (0, v1_data_store_1.getV1LocalStorage)();
|
|
93
|
-
if (!v1LocalStorage) {
|
|
94
|
-
logger_1.logger.debug('v1 local storage not found');
|
|
95
|
-
return [2 /*return*/, false];
|
|
96
|
-
}
|
|
97
|
-
return [4 /*yield*/, (0, v1_data_store_1.getWalletDocuments)()];
|
|
98
|
-
case 1:
|
|
99
|
-
documents = _b.sent();
|
|
100
|
-
if (documents.length === 0) {
|
|
101
|
-
logger_1.logger.debug('no documents found on v1 data store');
|
|
102
|
-
return [2 /*return*/, false];
|
|
103
|
-
}
|
|
104
|
-
return [2 /*return*/, true];
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
exports.isRunningOnV1DataStore = isRunningOnV1DataStore;
|
|
110
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/migration/migration1/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAsE;AACtE,uCAAoC;AACpC,qDAAgD;AAIhD;;;;;;GAMG;AACH,SAAsB,UAAU,CAAC,EAElB;QADb,SAAS,eAAA;;;;;oBAET,eAAM,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC;oBAErD,IAAI,SAAS,CAAC,OAAO,KAAK,IAAI,EAAE;wBAC9B,eAAM,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;wBAC/C,sBAAO;gCACL,QAAQ,EAAE,KAAK;gCACf,OAAO,EAAE,SAAS,CAAC,OAAO;6BAC3B,EAAC;qBACH;oBAED,eAAM,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;oBAE3C,qBAAM,IAAA,+BAAa,EAAC,EAAC,SAAS,WAAA,EAAC,CAAC,EAAA;;oBAAhC,SAAgC,CAAC;oBAEjC,sBAAO;4BACL,QAAQ,EAAE,IAAI;4BACd,OAAO,EAAE,IAAI;yBACd,EAAC;;;;CACH;AArBD,gCAqBC;AAED;;;GAGG;AACH,SAAsB,sBAAsB,CAAC,EAE9B;QADb,SAAS,eAAA;;;;;;oBAET,gDAAgD;oBAChD,IAAI,SAAS,CAAC,OAAO,EAAE;wBACrB,sBAAO,KAAK,EAAC;qBACd;oBAEK,cAAc,GAAG,IAAA,iCAAiB,GAAE,CAAC;oBAE3C,IAAI,CAAC,cAAc,EAAE;wBACnB,eAAM,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;wBAC3C,sBAAO,KAAK,EAAC;qBACd;oBAEiB,qBAAM,IAAA,kCAAkB,GAAE,EAAA;;oBAAtC,SAAS,GAAG,SAA0B;oBAE5C,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;wBAC1B,eAAM,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC;wBACpD,sBAAO,KAAK,EAAC;qBACd;oBAED,sBAAO,IAAI,EAAC;;;;CACb;AAvBD,wDAuBC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare function importUniversalWalletDocuments({ documents, dataStore }: {
|
|
2
|
-
documents: any;
|
|
3
|
-
dataStore: any;
|
|
4
|
-
}): Promise<void>;
|
|
5
|
-
export declare function migrateV1Data({ dataStore }: {
|
|
6
|
-
dataStore: any;
|
|
7
|
-
}): Promise<void>;
|
|
8
|
-
//# sourceMappingURL=migrate-v1-data.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-v1-data.d.ts","sourceRoot":"","sources":["../../../src/migration/migration1/migrate-v1-data.ts"],"names":[],"mappings":"AAIA,wBAAsB,8BAA8B,CAAC,EAAC,SAAS,EAAE,SAAS,EAAC;;;CAAA,iBAgB1E;AAqBD,wBAAsB,aAAa,CAAC,EAAC,SAAS,EAAC;;CAAA,iBAe9C"}
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var __values = (this && this.__values) || function(o) {
|
|
39
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
40
|
-
if (m) return m.call(o);
|
|
41
|
-
if (o && typeof o.length === "number") return {
|
|
42
|
-
next: function () {
|
|
43
|
-
if (o && i >= o.length) o = void 0;
|
|
44
|
-
return { value: o && o[i++], done: !o };
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
48
|
-
};
|
|
49
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports.migrateV1Data = exports.importUniversalWalletDocuments = void 0;
|
|
51
|
-
var v1_data_store_1 = require("./v1-data-store");
|
|
52
|
-
var document_1 = require("../../entities/document");
|
|
53
|
-
var helpers_1 = require("../../helpers");
|
|
54
|
-
function importUniversalWalletDocuments(_a) {
|
|
55
|
-
var documents = _a.documents, dataStore = _a.dataStore;
|
|
56
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
57
|
-
var documents_1, documents_1_1, _document, document_2, err_1, e_1_1;
|
|
58
|
-
var e_1, _b;
|
|
59
|
-
return __generator(this, function (_c) {
|
|
60
|
-
switch (_c.label) {
|
|
61
|
-
case 0:
|
|
62
|
-
_c.trys.push([0, 7, 8, 9]);
|
|
63
|
-
documents_1 = __values(documents), documents_1_1 = documents_1.next();
|
|
64
|
-
_c.label = 1;
|
|
65
|
-
case 1:
|
|
66
|
-
if (!!documents_1_1.done) return [3 /*break*/, 6];
|
|
67
|
-
_document = documents_1_1.value;
|
|
68
|
-
document_2 = _document;
|
|
69
|
-
if ((0, helpers_1.documentHasType)(document_2, 'VerifiableCredential') && document_2.value) {
|
|
70
|
-
document_2 = document_2.value;
|
|
71
|
-
}
|
|
72
|
-
_c.label = 2;
|
|
73
|
-
case 2:
|
|
74
|
-
_c.trys.push([2, 4, , 5]);
|
|
75
|
-
return [4 /*yield*/, (0, document_1.createDocument)({
|
|
76
|
-
dataStore: dataStore,
|
|
77
|
-
json: document_2,
|
|
78
|
-
})];
|
|
79
|
-
case 3:
|
|
80
|
-
_c.sent();
|
|
81
|
-
return [3 /*break*/, 5];
|
|
82
|
-
case 4:
|
|
83
|
-
err_1 = _c.sent();
|
|
84
|
-
console.error(err_1);
|
|
85
|
-
return [3 /*break*/, 5];
|
|
86
|
-
case 5:
|
|
87
|
-
documents_1_1 = documents_1.next();
|
|
88
|
-
return [3 /*break*/, 1];
|
|
89
|
-
case 6: return [3 /*break*/, 9];
|
|
90
|
-
case 7:
|
|
91
|
-
e_1_1 = _c.sent();
|
|
92
|
-
e_1 = { error: e_1_1 };
|
|
93
|
-
return [3 /*break*/, 9];
|
|
94
|
-
case 8:
|
|
95
|
-
try {
|
|
96
|
-
if (documents_1_1 && !documents_1_1.done && (_b = documents_1.return)) _b.call(documents_1);
|
|
97
|
-
}
|
|
98
|
-
finally { if (e_1) throw e_1.error; }
|
|
99
|
-
return [7 /*endfinally*/];
|
|
100
|
-
case 9: return [2 /*return*/];
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
exports.importUniversalWalletDocuments = importUniversalWalletDocuments;
|
|
106
|
-
function migrateDocuments(_a) {
|
|
107
|
-
var v1Storage = _a.v1Storage, dataStore = _a.dataStore;
|
|
108
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
109
|
-
var walletJSON, wallet, documents;
|
|
110
|
-
return __generator(this, function (_b) {
|
|
111
|
-
switch (_b.label) {
|
|
112
|
-
case 0: return [4 /*yield*/, v1Storage.getItem('wallet')];
|
|
113
|
-
case 1:
|
|
114
|
-
walletJSON = _b.sent();
|
|
115
|
-
wallet = JSON.parse(walletJSON);
|
|
116
|
-
documents = Object.keys(wallet).map(function (key) { return wallet[key]; });
|
|
117
|
-
return [4 /*yield*/, importUniversalWalletDocuments({ documents: documents, dataStore: dataStore })];
|
|
118
|
-
case 2:
|
|
119
|
-
_b.sent();
|
|
120
|
-
return [2 /*return*/];
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
function migrateNotificaions() { }
|
|
126
|
-
function migrateDevSettings() { }
|
|
127
|
-
function migrateTransactions() {
|
|
128
|
-
// Will skip this migration for performance improvements
|
|
129
|
-
// That would require Realm db as dependency
|
|
130
|
-
// We can drop the realm.db dependency from the wallet-sdk
|
|
131
|
-
// Transactions will be pulled from subscan into in the new data-store automatically
|
|
132
|
-
}
|
|
133
|
-
function migrateV1Data(_a) {
|
|
134
|
-
var dataStore = _a.dataStore;
|
|
135
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
136
|
-
var v1Storage, walletJSON;
|
|
137
|
-
return __generator(this, function (_b) {
|
|
138
|
-
switch (_b.label) {
|
|
139
|
-
case 0:
|
|
140
|
-
v1Storage = (0, v1_data_store_1.getV1LocalStorage)();
|
|
141
|
-
return [4 /*yield*/, migrateDocuments({
|
|
142
|
-
v1Storage: v1Storage,
|
|
143
|
-
dataStore: dataStore,
|
|
144
|
-
})];
|
|
145
|
-
case 1:
|
|
146
|
-
_b.sent();
|
|
147
|
-
return [4 /*yield*/, migrateNotificaions()];
|
|
148
|
-
case 2:
|
|
149
|
-
_b.sent();
|
|
150
|
-
return [4 /*yield*/, migrateDevSettings()];
|
|
151
|
-
case 3:
|
|
152
|
-
_b.sent();
|
|
153
|
-
return [4 /*yield*/, migrateTransactions()];
|
|
154
|
-
case 4:
|
|
155
|
-
_b.sent();
|
|
156
|
-
return [4 /*yield*/, v1Storage.getItem('wallet')];
|
|
157
|
-
case 5:
|
|
158
|
-
walletJSON = _b.sent();
|
|
159
|
-
return [4 /*yield*/, v1Storage.setItem('wallet-backup', walletJSON)];
|
|
160
|
-
case 6:
|
|
161
|
-
_b.sent();
|
|
162
|
-
return [4 /*yield*/, v1Storage.removeItem('wallet')];
|
|
163
|
-
case 7:
|
|
164
|
-
_b.sent();
|
|
165
|
-
return [2 /*return*/];
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
exports.migrateV1Data = migrateV1Data;
|
|
171
|
-
//# sourceMappingURL=migrate-v1-data.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-v1-data.js","sourceRoot":"","sources":["../../../src/migration/migration1/migrate-v1-data.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAkD;AAClD,oDAAuD;AACvD,yCAA8C;AAE9C,SAAsB,8BAA8B,CAAC,EAAsB;QAArB,SAAS,eAAA,EAAE,SAAS,eAAA;;;;;;;;oBAChD,cAAA,SAAA,SAAS,CAAA;;;;oBAAtB,SAAS;oBACd,aAAW,SAAS,CAAC;oBACzB,IAAI,IAAA,yBAAe,EAAC,UAAQ,EAAE,sBAAsB,CAAC,IAAI,UAAQ,CAAC,KAAK,EAAE;wBACvE,UAAQ,GAAG,UAAQ,CAAC,KAAK,CAAC;qBAC3B;;;;oBAGC,qB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C;oBAGT,qBAAM,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAA;;oBAA9C,UAAU,GAAG,SAAiC;oBACpD,qBAAM,SAAS,CAAC,OAAO,CAAC,eAAe,EAAE,UAAU,CAAC,EAAA;;oBAApD,SAAoD,CAAC;oBACrD,qBAAM,SAAS,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAA;;oBAApC,SAAoC,CAAC;;;;;CACtC;AAfD,sCAeC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export type LocalStorage = {
|
|
2
|
-
getItem: (key: string) => Promise<string | null>;
|
|
3
|
-
setItem: (key: string, value: string) => Promise<void>;
|
|
4
|
-
removeItem: (key: string) => Promise<void>;
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* Legacy data-store was based on AsyncLocalStorage
|
|
8
|
-
* The wallet will inject its implementation here, so that the migration scripts can use it
|
|
9
|
-
*
|
|
10
|
-
* @param _impl
|
|
11
|
-
*/
|
|
12
|
-
export declare function setV1LocalStorage(_impl: LocalStorage): void;
|
|
13
|
-
export declare function getV1LocalStorage(): LocalStorage;
|
|
14
|
-
export declare function getWalletDocuments(): Promise<any[]>;
|
|
15
|
-
//# sourceMappingURL=v1-data-store.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"v1-data-store.d.ts","sourceRoot":"","sources":["../../../src/migration/migration1/v1-data-store.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACjD,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5C,CAAC;AAIF;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,YAAY,QAIpD;AAED,wBAAgB,iBAAiB,IAAI,YAAY,CAEhD;AAED,wBAAsB,kBAAkB,mBAYvC"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
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.getWalletDocuments = exports.getV1LocalStorage = exports.setV1LocalStorage = void 0;
|
|
43
|
-
var assert_1 = __importDefault(require("assert"));
|
|
44
|
-
var _localStorage;
|
|
45
|
-
/**
|
|
46
|
-
* Legacy data-store was based on AsyncLocalStorage
|
|
47
|
-
* The wallet will inject its implementation here, so that the migration scripts can use it
|
|
48
|
-
*
|
|
49
|
-
* @param _impl
|
|
50
|
-
*/
|
|
51
|
-
function setV1LocalStorage(_impl) {
|
|
52
|
-
(0, assert_1.default)(!!_impl, 'LocalStorage implementation is required');
|
|
53
|
-
_localStorage = _impl;
|
|
54
|
-
}
|
|
55
|
-
exports.setV1LocalStorage = setV1LocalStorage;
|
|
56
|
-
function getV1LocalStorage() {
|
|
57
|
-
return _localStorage;
|
|
58
|
-
}
|
|
59
|
-
exports.getV1LocalStorage = getV1LocalStorage;
|
|
60
|
-
function getWalletDocuments() {
|
|
61
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
62
|
-
var jsonData, wallet;
|
|
63
|
-
return __generator(this, function (_a) {
|
|
64
|
-
switch (_a.label) {
|
|
65
|
-
case 0: return [4 /*yield*/, _localStorage.getItem('wallet')];
|
|
66
|
-
case 1:
|
|
67
|
-
jsonData = _a.sent();
|
|
68
|
-
if (!jsonData) {
|
|
69
|
-
return [2 /*return*/, []];
|
|
70
|
-
}
|
|
71
|
-
wallet = JSON.parse(jsonData);
|
|
72
|
-
return [2 /*return*/, Object.keys(wallet).map(function (key) {
|
|
73
|
-
return wallet[key];
|
|
74
|
-
})];
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
exports.getWalletDocuments = getWalletDocuments;
|
|
80
|
-
//# sourceMappingURL=v1-data-store.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"v1-data-store.js","sourceRoot":"","sources":["../../../src/migration/migration1/v1-data-store.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA4B;AAQ5B,IAAI,aAA2B,CAAC;AAEhC;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,KAAmB;IACnD,IAAA,gBAAM,EAAC,CAAC,CAAC,KAAK,EAAE,yCAAyC,CAAC,CAAC;IAE3D,aAAa,GAAG,KAAK,CAAC;AACxB,CAAC;AAJD,8CAIC;AAED,SAAgB,iBAAiB;IAC/B,OAAO,aAAa,CAAC;AACvB,CAAC;AAFD,8CAEC;AAED,SAAsB,kBAAkB;;;;;wBACrB,qBAAM,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAA;;oBAAhD,QAAQ,GAAG,SAAqC;oBAEtD,IAAI,CAAC,QAAQ,EAAE;wBACb,sBAAO,EAAE,EAAC;qBACX;oBAEK,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,QAAkB,CAAC,CAAC;oBAE9C,sBAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,UAAA,GAAG;4BAChC,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;wBACrB,CAAC,CAAC,EAAC;;;;CACJ;AAZD,gDAYC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
2
|
-
export declare class Bootstrap1691498362273 implements MigrationInterface {
|
|
3
|
-
name: string;
|
|
4
|
-
up(queryRunner: QueryRunner): Promise<void>;
|
|
5
|
-
down(queryRunner: QueryRunner): Promise<void>;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=1691498362273-bootstrap.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"1691498362273-bootstrap.d.ts","sourceRoot":"","sources":["../../src/migrations/1691498362273-bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,WAAW,EAKZ,MAAM,SAAS,CAAC;AAGjB,qBAAa,sBAAuB,YAAW,kBAAkB;IAC/D,IAAI,SAA4B;IAEnB,EAAE,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAyG3C,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAW3D"}
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.Bootstrap1691498362273 = void 0;
|
|
40
|
-
var typeorm_1 = require("typeorm");
|
|
41
|
-
var logger_1 = require("../logger");
|
|
42
|
-
var Bootstrap1691498362273 = /** @class */ (function () {
|
|
43
|
-
function Bootstrap1691498362273() {
|
|
44
|
-
this.name = 'Bootstrap1691498362273';
|
|
45
|
-
}
|
|
46
|
-
Bootstrap1691498362273.prototype.up = function (queryRunner) {
|
|
47
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
48
|
-
var hasNetworkEntityTable;
|
|
49
|
-
return __generator(this, function (_a) {
|
|
50
|
-
switch (_a.label) {
|
|
51
|
-
case 0: return [4 /*yield*/, queryRunner.hasTable('network_entity')];
|
|
52
|
-
case 1:
|
|
53
|
-
hasNetworkEntityTable = _a.sent();
|
|
54
|
-
if (hasNetworkEntityTable) {
|
|
55
|
-
logger_1.logger.debug('Table already bootstrapped');
|
|
56
|
-
return [2 /*return*/];
|
|
57
|
-
}
|
|
58
|
-
logger_1.logger.debug('Running table bootstrap migration');
|
|
59
|
-
return [4 /*yield*/, queryRunner.createTable(new typeorm_1.Table({
|
|
60
|
-
name: 'network_entity',
|
|
61
|
-
columns: [
|
|
62
|
-
new typeorm_1.TableColumn({ name: 'id', type: 'varchar', isPrimary: true }),
|
|
63
|
-
new typeorm_1.TableColumn({ name: 'name', type: 'varchar' }),
|
|
64
|
-
new typeorm_1.TableColumn({ name: 'configs', type: 'varchar' }),
|
|
65
|
-
],
|
|
66
|
-
}))];
|
|
67
|
-
case 2:
|
|
68
|
-
_a.sent();
|
|
69
|
-
return [4 /*yield*/, queryRunner.createTable(new typeorm_1.Table({
|
|
70
|
-
name: 'document_type_entity',
|
|
71
|
-
columns: [new typeorm_1.TableColumn({ name: 'id', type: 'text', isPrimary: true })],
|
|
72
|
-
}))];
|
|
73
|
-
case 3:
|
|
74
|
-
_a.sent();
|
|
75
|
-
return [4 /*yield*/, queryRunner.createTable(new typeorm_1.Table({
|
|
76
|
-
name: 'document_entity',
|
|
77
|
-
columns: [
|
|
78
|
-
new typeorm_1.TableColumn({ name: 'id', type: 'text', isPrimary: true }),
|
|
79
|
-
new typeorm_1.TableColumn({ name: 'networkId', type: 'text', isNullable: true }),
|
|
80
|
-
new typeorm_1.TableColumn({ name: 'type', type: 'text' }),
|
|
81
|
-
new typeorm_1.TableColumn({ name: 'correlation', type: 'text' }),
|
|
82
|
-
new typeorm_1.TableColumn({ name: 'data', type: 'blob' }),
|
|
83
|
-
],
|
|
84
|
-
}))];
|
|
85
|
-
case 4:
|
|
86
|
-
_a.sent();
|
|
87
|
-
return [4 /*yield*/, queryRunner.createTable(new typeorm_1.Table({
|
|
88
|
-
name: 'wallet_entity',
|
|
89
|
-
columns: [
|
|
90
|
-
new typeorm_1.TableColumn({ name: 'id', type: 'varchar', isPrimary: true }),
|
|
91
|
-
new typeorm_1.TableColumn({ name: 'version', type: 'varchar', isNullable: true }),
|
|
92
|
-
new typeorm_1.TableColumn({ name: 'networkId', type: 'varchar' }),
|
|
93
|
-
],
|
|
94
|
-
}))];
|
|
95
|
-
case 5:
|
|
96
|
-
_a.sent();
|
|
97
|
-
return [4 /*yield*/, queryRunner.createTable(new typeorm_1.Table({
|
|
98
|
-
name: 'document_entity__type_rel_document_type_entity',
|
|
99
|
-
columns: [
|
|
100
|
-
new typeorm_1.TableColumn({
|
|
101
|
-
name: 'documentEntityId',
|
|
102
|
-
type: 'text',
|
|
103
|
-
isPrimary: true,
|
|
104
|
-
}),
|
|
105
|
-
new typeorm_1.TableColumn({
|
|
106
|
-
name: 'documentTypeEntityId',
|
|
107
|
-
type: 'text',
|
|
108
|
-
isPrimary: true,
|
|
109
|
-
}),
|
|
110
|
-
],
|
|
111
|
-
foreignKeys: [
|
|
112
|
-
new typeorm_1.TableForeignKey({
|
|
113
|
-
columnNames: ['documentEntityId'],
|
|
114
|
-
referencedColumnNames: ['id'],
|
|
115
|
-
referencedTableName: 'document_entity',
|
|
116
|
-
onDelete: 'CASCADE',
|
|
117
|
-
onUpdate: 'CASCADE',
|
|
118
|
-
}),
|
|
119
|
-
new typeorm_1.TableForeignKey({
|
|
120
|
-
columnNames: ['documentTypeEntityId'],
|
|
121
|
-
referencedColumnNames: ['id'],
|
|
122
|
-
referencedTableName: 'document_type_entity',
|
|
123
|
-
onDelete: 'NO ACTION',
|
|
124
|
-
onUpdate: 'NO ACTION',
|
|
125
|
-
}),
|
|
126
|
-
],
|
|
127
|
-
}))];
|
|
128
|
-
case 6:
|
|
129
|
-
_a.sent();
|
|
130
|
-
return [4 /*yield*/, queryRunner.createIndex('document_entity__type_rel_document_type_entity', new typeorm_1.TableIndex({
|
|
131
|
-
name: 'IDX_e929f32563f62d753a51bcd8b9',
|
|
132
|
-
columnNames: ['documentEntityId'],
|
|
133
|
-
}))];
|
|
134
|
-
case 7:
|
|
135
|
-
_a.sent();
|
|
136
|
-
return [4 /*yield*/, queryRunner.createIndex('document_entity__type_rel_document_type_entity', new typeorm_1.TableIndex({
|
|
137
|
-
name: 'IDX_7d377ef9ddb323247aedd63d66',
|
|
138
|
-
columnNames: ['documentTypeEntityId'],
|
|
139
|
-
}))];
|
|
140
|
-
case 8:
|
|
141
|
-
_a.sent();
|
|
142
|
-
logger_1.logger.debug('Table bootstrap migration completed');
|
|
143
|
-
return [2 /*return*/];
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
};
|
|
148
|
-
Bootstrap1691498362273.prototype.down = function (queryRunner) {
|
|
149
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
150
|
-
return __generator(this, function (_a) {
|
|
151
|
-
switch (_a.label) {
|
|
152
|
-
case 0:
|
|
153
|
-
logger_1.logger.debug('Running table bootstrap migration revert');
|
|
154
|
-
return [4 /*yield*/, queryRunner.dropTable('document_entity__type_rel_document_type_entity')];
|
|
155
|
-
case 1:
|
|
156
|
-
_a.sent();
|
|
157
|
-
return [4 /*yield*/, queryRunner.dropTable('wallet_entity')];
|
|
158
|
-
case 2:
|
|
159
|
-
_a.sent();
|
|
160
|
-
return [4 /*yield*/, queryRunner.dropTable('document_entity')];
|
|
161
|
-
case 3:
|
|
162
|
-
_a.sent();
|
|
163
|
-
return [4 /*yield*/, queryRunner.dropTable('document_type_entity')];
|
|
164
|
-
case 4:
|
|
165
|
-
_a.sent();
|
|
166
|
-
return [4 /*yield*/, queryRunner.dropTable('network_entity')];
|
|
167
|
-
case 5:
|
|
168
|
-
_a.sent();
|
|
169
|
-
logger_1.logger.debug('Revert completed');
|
|
170
|
-
return [2 /*return*/];
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
};
|
|
175
|
-
return Bootstrap1691498362273;
|
|
176
|
-
}());
|
|
177
|
-
exports.Bootstrap1691498362273 = Bootstrap1691498362273;
|
|
178
|
-
//# sourceMappingURL=1691498362273-bootstrap.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"1691498362273-bootstrap.js","sourceRoot":"","sources":["../../src/migrations/1691498362273-bootstrap.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAOiB;AACjB,oCAAmC;AAEnC;IAAA;QACE,SAAI,GAAG,wBAAwB,CAAC;IAsHlC,CAAC;IApHc,mCAAE,GAAf,UAAgB,WAAwB;;;;;4BACR,qBAAM,WAAW,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAA;;wBAApE,qBAAqB,GAAG,SAA4C;wBAE1E,IAAI,qBAAqB,EAAE;4BACzB,eAAM,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;4BAC3C,sBAAO;yBACR;wBAED,eAAM,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;wBAElD,qBA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d.ts","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,sBAAsB,EAAC,MAAM,2BAA2B,CAAC;;AAEjE,wBAAwC"}
|
package/lib/migrations/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":";;AAAA,sEAAiE;AAEjE,kBAAe,CAAC,iDAAsB,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migrations-data-source.d.ts","sourceRoot":"","sources":["../src/migrations-data-source.ts"],"names":[],"mappings":";AAEA,wBAGG"}
|