@l-v-yonsama/multi-platform-database-drivers 0.1.1 → 0.1.2
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/build/__tests__/db/drivers/AwsS3Driver.test.d.ts +1 -0
- package/build/__tests__/db/drivers/AwsS3Driver.test.js +83 -0
- package/build/__tests__/db/drivers/AwsS3Driver.test.js.map +1 -0
- package/build/__tests__/db/drivers/MySQLDriver.test.d.ts +1 -0
- package/build/__tests__/db/drivers/MySQLDriver.test.js +115 -0
- package/build/__tests__/db/drivers/MySQLDriver.test.js.map +1 -0
- package/build/__tests__/db/drivers/PostgresDriver.test.d.ts +1 -0
- package/build/__tests__/db/drivers/PostgresDriver.test.js +112 -0
- package/build/__tests__/db/drivers/PostgresDriver.test.js.map +1 -0
- package/build/__tests__/db/drivers/RedisDriver.test.d.ts +1 -0
- package/build/__tests__/db/drivers/RedisDriver.test.js +106 -0
- package/build/__tests__/db/drivers/RedisDriver.test.js.map +1 -0
- package/build/src/db/DBError.d.ts +7 -0
- package/build/src/db/DBError.js +20 -0
- package/build/src/db/DBError.js.map +1 -0
- package/build/src/db/drivers/AwsS3Driver.d.ts +38 -0
- package/build/src/db/drivers/AwsS3Driver.js +457 -0
- package/build/src/db/drivers/AwsS3Driver.js.map +1 -0
- package/build/src/db/drivers/BaseDriver.d.ts +40 -0
- package/build/src/db/drivers/BaseDriver.js +209 -0
- package/build/src/db/drivers/BaseDriver.js.map +1 -0
- package/build/src/db/drivers/MySQLDriver.d.ts +20 -0
- package/build/src/db/drivers/MySQLDriver.js +254 -0
- package/build/src/db/drivers/MySQLDriver.js.map +1 -0
- package/build/src/db/drivers/PostgresDriver.d.ts +22 -0
- package/build/src/db/drivers/PostgresDriver.js +297 -0
- package/build/src/db/drivers/PostgresDriver.js.map +1 -0
- package/build/src/db/drivers/RedisDriver.d.ts +23 -0
- package/build/src/db/drivers/RedisDriver.js +231 -0
- package/build/src/db/drivers/RedisDriver.js.map +1 -0
- package/build/src/db/manager.d.ts +8 -0
- package/build/src/db/manager.js +87 -0
- package/build/src/db/manager.js.map +1 -0
- package/build/src/db/resource/DbResource.d.ts +188 -0
- package/build/src/db/resource/DbResource.js +420 -0
- package/build/src/db/resource/DbResource.js.map +1 -0
- package/build/src/db/resource/MultipleResultSetDataHolder.d.ts +29 -0
- package/build/src/db/resource/MultipleResultSetDataHolder.js +106 -0
- package/build/src/db/resource/MultipleResultSetDataHolder.js.map +1 -0
- package/build/src/db/resource/ResourceUtil.d.ts +39 -0
- package/build/src/db/resource/ResourceUtil.js +337 -0
- package/build/src/db/resource/ResourceUtil.js.map +1 -0
- package/build/src/db/resource/ResultSetDataHolder.d.ts +126 -0
- package/build/src/db/resource/ResultSetDataHolder.js +722 -0
- package/build/src/db/resource/ResultSetDataHolder.js.map +1 -0
- package/build/src/db/resource/types/DBType.d.ts +18 -0
- package/build/src/db/resource/types/DBType.js +52 -0
- package/build/src/db/resource/types/DBType.js.map +1 -0
- package/build/src/db/resource/types/GeneralColumnType.d.ts +75 -0
- package/build/src/db/resource/types/GeneralColumnType.js +332 -0
- package/build/src/db/resource/types/GeneralColumnType.js.map +1 -0
- package/build/src/db/resource/types/MySQLColumnType.d.ts +42 -0
- package/build/src/db/resource/types/MySQLColumnType.js +142 -0
- package/build/src/db/resource/types/MySQLColumnType.js.map +1 -0
- package/build/src/db/resource/types/ODBCVendorType.d.ts +3 -0
- package/build/src/db/resource/types/ODBCVendorType.js +8 -0
- package/build/src/db/resource/types/ODBCVendorType.js.map +1 -0
- package/build/src/db/resource/types/PostgresColumnType.d.ts +53 -0
- package/build/src/db/resource/types/PostgresColumnType.js +105 -0
- package/build/src/db/resource/types/PostgresColumnType.js.map +1 -0
- package/build/src/db/resource/types/RedisKeyType.d.ts +12 -0
- package/build/src/db/resource/types/RedisKeyType.js +55 -0
- package/build/src/db/resource/types/RedisKeyType.js.map +1 -0
- package/build/src/db/resource/types/ResourceType.d.ts +10 -0
- package/build/src/db/resource/types/ResourceType.js +15 -0
- package/build/src/db/resource/types/ResourceType.js.map +1 -0
- package/build/src/main.d.ts +0 -0
- package/build/src/main.js +3 -0
- package/build/src/main.js.map +1 -0
- package/build/src/service/request/general_db_request.d.ts +18 -0
- package/build/src/service/request/general_db_request.js +14 -0
- package/build/src/service/request/general_db_request.js.map +1 -0
- package/{src/service/request/redis_request.ts → build/src/service/request/redis_request.d.ts} +8 -11
- package/build/src/service/request/redis_request.js +14 -0
- package/build/src/service/request/redis_request.js.map +1 -0
- package/build/src/service/request/s3_request.d.ts +14 -0
- package/build/src/service/request/s3_request.js +12 -0
- package/build/src/service/request/s3_request.js.map +1 -0
- package/build/src/service/response/GeneralReponse.d.ts +6 -0
- package/build/src/service/response/GeneralReponse.js +12 -0
- package/build/src/service/response/GeneralReponse.js.map +1 -0
- package/build/src/types/DateModifiedType.d.ts +14 -0
- package/build/src/types/DateModifiedType.js +68 -0
- package/build/src/types/DateModifiedType.js.map +1 -0
- package/build/src/types/FileKindType.d.ts +12 -0
- package/build/src/types/FileKindType.js +75 -0
- package/build/src/types/FileKindType.js.map +1 -0
- package/build/src/util/file_util.d.ts +22 -0
- package/build/src/util/file_util.js +143 -0
- package/build/src/util/file_util.js.map +1 -0
- package/package.json +5 -1
- package/.editorconfig +0 -15
- package/.eslintignore +0 -1
- package/.eslintrc.json +0 -30
- package/.github/workflows/npm-publish-github-packages.yml +0 -50
- package/.prettierrc +0 -12
- package/__tests__/db/drivers/AwsS3Driver.test.ts +0 -97
- package/__tests__/db/drivers/MySQLDriver.test.ts +0 -140
- package/__tests__/db/drivers/PostgresDriver.test.ts +0 -139
- package/__tests__/db/drivers/RedisDriver.test.ts +0 -156
- package/jest.config.js +0 -18
- package/src/db/DBError.ts +0 -26
- package/src/db/drivers/AwsS3Driver.ts +0 -539
- package/src/db/drivers/BaseDriver.ts +0 -256
- package/src/db/drivers/MongoDriver.js +0 -110
- package/src/db/drivers/MySQLDriver.ts +0 -318
- package/src/db/drivers/PostgresDriver.ts +0 -363
- package/src/db/drivers/RedisDriver.ts +0 -277
- package/src/db/manager.ts +0 -95
- package/src/db/resource/DbResource.ts +0 -579
- package/src/db/resource/MultipleResultSetDataHolder.ts +0 -119
- package/src/db/resource/ResourceUtil.ts +0 -366
- package/src/db/resource/ResultSetDataHolder.ts +0 -806
- package/src/db/resource/types/DBType.ts +0 -43
- package/src/db/resource/types/GeneralColumnType.ts +0 -321
- package/src/db/resource/types/MySQLColumnType.ts +0 -134
- package/src/db/resource/types/ODBCVendorType.ts +0 -3
- package/src/db/resource/types/PostgresColumnType.ts +0 -94
- package/src/db/resource/types/RedisKeyType.ts +0 -48
- package/src/db/resource/types/ResourceType.ts +0 -10
- package/src/main.ts +0 -1
- package/src/service/request/general_db_request.ts +0 -20
- package/src/service/request/s3_request.ts +0 -15
- package/src/service/response/GeneralReponse.ts +0 -10
- package/src/types/DateModifiedType.ts +0 -75
- package/src/types/FileKindType.ts +0 -80
- package/src/util/file_util.ts +0 -178
- package/tsconfig.json +0 -23
- package/tsconfig.release.json +0 -23
- package/unit-test.yml +0 -41
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const ResultSetDataHolder_1 = require("./ResultSetDataHolder");
|
|
4
|
+
const short_unique_id_1 = require("short-unique-id");
|
|
5
|
+
const uid = new short_unique_id_1.default();
|
|
6
|
+
class MultipleResultSetDataHolder {
|
|
7
|
+
static createEmpty() {
|
|
8
|
+
return new MultipleResultSetDataHolder();
|
|
9
|
+
}
|
|
10
|
+
static from(obj) {
|
|
11
|
+
const r = new MultipleResultSetDataHolder();
|
|
12
|
+
if (obj.active_id) {
|
|
13
|
+
r.active_id = obj.active_id;
|
|
14
|
+
}
|
|
15
|
+
if (obj.list) {
|
|
16
|
+
obj.list.forEach((lr) => {
|
|
17
|
+
r.push(lr.label, ResultSetDataHolder_1.default.from(lr.rdh), lr.id);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return r;
|
|
21
|
+
}
|
|
22
|
+
constructor() {
|
|
23
|
+
this.list = new Array();
|
|
24
|
+
}
|
|
25
|
+
hasAnnotation(type) {
|
|
26
|
+
let r = false;
|
|
27
|
+
for (let i = 0; i < this.list.length; i++) {
|
|
28
|
+
if (this.list[i].rdh.hasAnnotation(type)) {
|
|
29
|
+
r = true;
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return r;
|
|
34
|
+
}
|
|
35
|
+
push(label, rdh, id) {
|
|
36
|
+
if (id === undefined || id === '') {
|
|
37
|
+
id = uid.randomUUID(8);
|
|
38
|
+
}
|
|
39
|
+
this.list.push({ label, id, rdh });
|
|
40
|
+
}
|
|
41
|
+
clear() {
|
|
42
|
+
this.active_id = undefined;
|
|
43
|
+
this.list.splice(0, this.list.length);
|
|
44
|
+
}
|
|
45
|
+
getActiveData() {
|
|
46
|
+
if (this.active_id) {
|
|
47
|
+
return this.list.find((r) => r.id === this.active_id);
|
|
48
|
+
}
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
moveFirstPosition() {
|
|
52
|
+
this.movePosition('first');
|
|
53
|
+
}
|
|
54
|
+
movePosition(position) {
|
|
55
|
+
if (this.list.length === 0) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (this.active_id) {
|
|
59
|
+
const idx = this.list.findIndex((r) => r.id === this.active_id);
|
|
60
|
+
if (idx < 0) {
|
|
61
|
+
// not found.
|
|
62
|
+
this.active_id = this.list[0].id;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
switch (position.toLocaleLowerCase()) {
|
|
66
|
+
case 'first':
|
|
67
|
+
this.active_id = this.list[0].id;
|
|
68
|
+
break;
|
|
69
|
+
case 'prev':
|
|
70
|
+
if (idx <= 0) {
|
|
71
|
+
this.active_id = this.list[this.list.length - 1].id;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
this.active_id = this.list[idx - 1].id;
|
|
75
|
+
}
|
|
76
|
+
break;
|
|
77
|
+
case 'next':
|
|
78
|
+
if (idx >= this.list.length - 1) {
|
|
79
|
+
this.active_id = this.list[0].id;
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
this.active_id = this.list[idx + 1].id;
|
|
83
|
+
}
|
|
84
|
+
break;
|
|
85
|
+
case 'last':
|
|
86
|
+
this.active_id = this.list[this.list.length - 1].id;
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
this.active_id = this.list[0].id;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
copyFrom(that) {
|
|
96
|
+
this.clear();
|
|
97
|
+
if (that.active_id) {
|
|
98
|
+
this.active_id = that.active_id;
|
|
99
|
+
}
|
|
100
|
+
that.list.forEach((t) => {
|
|
101
|
+
this.list.push(t);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.default = MultipleResultSetDataHolder;
|
|
106
|
+
//# sourceMappingURL=MultipleResultSetDataHolder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MultipleResultSetDataHolder.js","sourceRoot":"","sources":["../../../../src/db/resource/MultipleResultSetDataHolder.ts"],"names":[],"mappings":";;AAAA,+DAA4E;AAC5E,qDAA4C;AAE5C,MAAM,GAAG,GAAG,IAAI,yBAAa,EAAE,CAAC;AAehC,MAAqB,2BAA2B;IAKvC,MAAM,CAAC,WAAW;QACvB,OAAO,IAAI,2BAA2B,EAAE,CAAC;IAC3C,CAAC;IAEM,MAAM,CAAC,IAAI,CAAC,GAAQ;QACzB,MAAM,CAAC,GAAG,IAAI,2BAA2B,EAAE,CAAC;QAC5C,IAAI,GAAG,CAAC,SAAS,EAAE;YACjB,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC;SAC7B;QACD,IAAI,GAAG,CAAC,IAAI,EAAE;YACZ,GAA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C,CAAC,CAAC,CAAC,EAAE,CAAC;yBAClC;6BAAM;4BACL,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;yBACxC;wBACD,MAAM;oBACR,KAAK,MAAM;wBACT,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;wBACpD,MAAM;iBACT;aACF;SACF;aAAM;YACL,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SAClC;IACH,CAAC;IACM,QAAQ,CAAC,IAAiC;QAC/C,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;SACjC;QACD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACtB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AApGD,8CAoGC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { DBType } from './types/DBType';
|
|
2
|
+
import { DbResource, DbS3Key, DbConnection, DbS3Bucket } from './DbResource';
|
|
3
|
+
import { ResourceType } from './types/ResourceType';
|
|
4
|
+
export default class ResourceUtil {
|
|
5
|
+
static getPortDesc(type: DBType): string;
|
|
6
|
+
static getHostDesc(type: DBType): string;
|
|
7
|
+
static getDatabaseDesc(type: DBType): string;
|
|
8
|
+
static getUserDesc(type: DBType): string;
|
|
9
|
+
static getPasswordDesc(type: DBType): string;
|
|
10
|
+
static getUrlDesc(type: DBType): string;
|
|
11
|
+
static getRegionDesc(type: DBType): string;
|
|
12
|
+
static getPortVisible(type: DBType): boolean;
|
|
13
|
+
static getHostVisible(type: DBType): boolean;
|
|
14
|
+
static getDatabaseVisible(type: DBType): boolean;
|
|
15
|
+
static getDatabaseVersionVisible(type: DBType): boolean;
|
|
16
|
+
static getDsVisible(type: DBType): boolean;
|
|
17
|
+
static getUserVisible(type: DBType): boolean;
|
|
18
|
+
static getPasswordVisible(type: DBType): boolean;
|
|
19
|
+
static getUrlVisible(type: DBType): boolean;
|
|
20
|
+
static getRegionVisible(type: DBType): boolean;
|
|
21
|
+
static getSshVisible(type: DBType): boolean;
|
|
22
|
+
static getTestEnabled(type: DBType): boolean;
|
|
23
|
+
static getAbsolutePath(r: DbResource): string;
|
|
24
|
+
static getBucketOf(dir: DbS3Key): DbS3Bucket | undefined;
|
|
25
|
+
static getResourceByAbsolutePath(con_list: Array<DbConnection>, absolute_path: string): DbResource | undefined;
|
|
26
|
+
static createS3Key(dir: DbS3Key): string;
|
|
27
|
+
static getParent(dbRes: DbResource): DbResource | undefined;
|
|
28
|
+
static getDBConnectionDefId(dbRes: DbResource): string | undefined;
|
|
29
|
+
static isConnected(dbRes: DbResource): boolean;
|
|
30
|
+
static getDBConnection(dbRes: DbResource): DbConnection | undefined;
|
|
31
|
+
static findResource(dbRes: DbResource, type: ResourceType, name: string): DbResource | undefined;
|
|
32
|
+
static create(dbRes: DbResource, type: ResourceType): DbResource | undefined;
|
|
33
|
+
static getResourceOf(dbRes: DbResource, type: ResourceType): DbResource | undefined;
|
|
34
|
+
static getAncestorListOf<T extends DbResource>(dbRes: DbResource, type: ResourceType): Array<T>;
|
|
35
|
+
static getAncestorListOfSub<T extends DbResource>(parent: DbResource | undefined, type: ResourceType, arr: Array<T>): void;
|
|
36
|
+
static isRequiredRefresh(res: DbS3Bucket | DbS3Key): boolean;
|
|
37
|
+
static getTextColorModifierByExt(name: string): string;
|
|
38
|
+
static getFaIconByExt(name: string): string;
|
|
39
|
+
}
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const DBType_1 = require("./types/DBType");
|
|
4
|
+
const ResourceType_1 = require("./types/ResourceType");
|
|
5
|
+
class ResourceUtil {
|
|
6
|
+
static getPortDesc(type) {
|
|
7
|
+
switch (type) {
|
|
8
|
+
case DBType_1.DBType.Redis:
|
|
9
|
+
return 'Port of the Redis server.';
|
|
10
|
+
case DBType_1.DBType.Postgres:
|
|
11
|
+
return 'The port number the server is listening on.';
|
|
12
|
+
}
|
|
13
|
+
return '';
|
|
14
|
+
}
|
|
15
|
+
static getHostDesc(type) {
|
|
16
|
+
switch (type) {
|
|
17
|
+
case DBType_1.DBType.Redis:
|
|
18
|
+
return 'Host of the Redis server.';
|
|
19
|
+
case DBType_1.DBType.Postgres:
|
|
20
|
+
return 'The host name of the server.';
|
|
21
|
+
}
|
|
22
|
+
return '';
|
|
23
|
+
}
|
|
24
|
+
static getDatabaseDesc(type) {
|
|
25
|
+
switch (type) {
|
|
26
|
+
case DBType_1.DBType.Redis:
|
|
27
|
+
return 'Database index to use.';
|
|
28
|
+
case DBType_1.DBType.Postgres:
|
|
29
|
+
return 'The database name.';
|
|
30
|
+
}
|
|
31
|
+
return '';
|
|
32
|
+
}
|
|
33
|
+
static getUserDesc(type) {
|
|
34
|
+
switch (type) {
|
|
35
|
+
case DBType_1.DBType.Redis:
|
|
36
|
+
return '';
|
|
37
|
+
case DBType_1.DBType.Postgres:
|
|
38
|
+
return "The database user's id.";
|
|
39
|
+
case DBType_1.DBType.AwsS3:
|
|
40
|
+
return 'your AWS access key ID.';
|
|
41
|
+
case DBType_1.DBType.Minio:
|
|
42
|
+
return 'your Minio access key ID.';
|
|
43
|
+
}
|
|
44
|
+
return '';
|
|
45
|
+
}
|
|
46
|
+
static getPasswordDesc(type) {
|
|
47
|
+
switch (type) {
|
|
48
|
+
case DBType_1.DBType.Redis:
|
|
49
|
+
return 'If set, client will send AUTH command with the value of this option when connected.';
|
|
50
|
+
case DBType_1.DBType.Postgres:
|
|
51
|
+
return "The database user's password.";
|
|
52
|
+
case DBType_1.DBType.AwsS3:
|
|
53
|
+
return 'your AWS secret access key.';
|
|
54
|
+
case DBType_1.DBType.Minio:
|
|
55
|
+
return 'your Minio secret access key.';
|
|
56
|
+
}
|
|
57
|
+
return '';
|
|
58
|
+
}
|
|
59
|
+
static getUrlDesc(type) {
|
|
60
|
+
switch (type) {
|
|
61
|
+
// case DBType.Redis: return 'Database index to use.';
|
|
62
|
+
case DBType_1.DBType.Minio:
|
|
63
|
+
return 'your Minio endpoint-url. (e.g. https://play.minio.io:9000)';
|
|
64
|
+
case DBType_1.DBType.Firestore:
|
|
65
|
+
return 'your Firestore database-url. (e.g. https://abc.firebaseio.com)';
|
|
66
|
+
}
|
|
67
|
+
return '';
|
|
68
|
+
}
|
|
69
|
+
static getRegionDesc(type) {
|
|
70
|
+
switch (type) {
|
|
71
|
+
case DBType_1.DBType.AwsS3:
|
|
72
|
+
case DBType_1.DBType.Minio:
|
|
73
|
+
return 'the region to send service requests to.';
|
|
74
|
+
}
|
|
75
|
+
return '';
|
|
76
|
+
}
|
|
77
|
+
// visible
|
|
78
|
+
static getPortVisible(type) {
|
|
79
|
+
switch (type) {
|
|
80
|
+
case DBType_1.DBType.AwsS3:
|
|
81
|
+
case DBType_1.DBType.Minio:
|
|
82
|
+
case DBType_1.DBType.Firestore:
|
|
83
|
+
case DBType_1.DBType.IndexedDB:
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
static getHostVisible(type) {
|
|
89
|
+
switch (type) {
|
|
90
|
+
case DBType_1.DBType.AwsS3:
|
|
91
|
+
case DBType_1.DBType.Minio:
|
|
92
|
+
case DBType_1.DBType.Firestore:
|
|
93
|
+
case DBType_1.DBType.IndexedDB:
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
static getDatabaseVisible(type) {
|
|
99
|
+
switch (type) {
|
|
100
|
+
case DBType_1.DBType.AwsS3:
|
|
101
|
+
case DBType_1.DBType.Minio:
|
|
102
|
+
case DBType_1.DBType.Firestore:
|
|
103
|
+
case DBType_1.DBType.IndexedDB:
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
static getDatabaseVersionVisible(type) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
static getDsVisible(type) {
|
|
112
|
+
switch (type) {
|
|
113
|
+
case DBType_1.DBType.ODBC:
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
static getUserVisible(type) {
|
|
119
|
+
switch (type) {
|
|
120
|
+
case DBType_1.DBType.Firestore:
|
|
121
|
+
case DBType_1.DBType.IndexedDB:
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
static getPasswordVisible(type) {
|
|
127
|
+
switch (type) {
|
|
128
|
+
case DBType_1.DBType.Firestore:
|
|
129
|
+
case DBType_1.DBType.IndexedDB:
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
static getUrlVisible(type) {
|
|
135
|
+
switch (type) {
|
|
136
|
+
case DBType_1.DBType.AwsS3:
|
|
137
|
+
case DBType_1.DBType.Postgres:
|
|
138
|
+
case DBType_1.DBType.MySQL:
|
|
139
|
+
case DBType_1.DBType.IndexedDB:
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
static getRegionVisible(type) {
|
|
145
|
+
switch (type) {
|
|
146
|
+
case DBType_1.DBType.AwsS3:
|
|
147
|
+
case DBType_1.DBType.Minio:
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
static getSshVisible(type) {
|
|
153
|
+
switch (type) {
|
|
154
|
+
case DBType_1.DBType.Firestore:
|
|
155
|
+
case DBType_1.DBType.IndexedDB:
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
static getTestEnabled(type) {
|
|
161
|
+
return true;
|
|
162
|
+
}
|
|
163
|
+
static getAbsolutePath(r) {
|
|
164
|
+
const ret = Array();
|
|
165
|
+
let guard = true;
|
|
166
|
+
while (guard) {
|
|
167
|
+
ret.unshift(r.getName());
|
|
168
|
+
const p = r.getParent();
|
|
169
|
+
if (p === undefined) {
|
|
170
|
+
guard = false;
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
r = p;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return ret.join('||');
|
|
177
|
+
}
|
|
178
|
+
static getBucketOf(dir) {
|
|
179
|
+
const r = ResourceUtil.getResourceOf(dir, ResourceType_1.ResourceType.Bucket);
|
|
180
|
+
if (r) {
|
|
181
|
+
return r;
|
|
182
|
+
}
|
|
183
|
+
return undefined;
|
|
184
|
+
}
|
|
185
|
+
static getResourceByAbsolutePath(con_list, absolute_path) {
|
|
186
|
+
const names = absolute_path.split('||');
|
|
187
|
+
let searchRes = con_list.find((a) => a.getName() === names[0]);
|
|
188
|
+
if (searchRes) {
|
|
189
|
+
for (let i = 1; i < names.length; i++) {
|
|
190
|
+
const name = names[i];
|
|
191
|
+
const r = searchRes.getChildByName(name);
|
|
192
|
+
if (r === undefined) {
|
|
193
|
+
return undefined;
|
|
194
|
+
}
|
|
195
|
+
searchRes = r;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return searchRes;
|
|
199
|
+
}
|
|
200
|
+
static createS3Key(dir) {
|
|
201
|
+
const dirs = ResourceUtil.getAncestorListOf(dir, ResourceType_1.ResourceType.Key);
|
|
202
|
+
if (dirs.length === 0) {
|
|
203
|
+
return dir.getName();
|
|
204
|
+
}
|
|
205
|
+
return dirs.map((a) => a.getName()).join('') + dir.getName();
|
|
206
|
+
}
|
|
207
|
+
static getParent(dbRes) {
|
|
208
|
+
return dbRes.getParent();
|
|
209
|
+
}
|
|
210
|
+
static getDBConnectionDefId(dbRes) {
|
|
211
|
+
const dbCon = ResourceUtil.getDBConnection(dbRes);
|
|
212
|
+
if (dbCon) {
|
|
213
|
+
return dbCon.id;
|
|
214
|
+
}
|
|
215
|
+
return undefined;
|
|
216
|
+
}
|
|
217
|
+
static isConnected(dbRes) {
|
|
218
|
+
const con = ResourceUtil.getDBConnection(dbRes);
|
|
219
|
+
if (con && con.isConnected) {
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
static getDBConnection(dbRes) {
|
|
225
|
+
return (ResourceUtil.getResourceOf(dbRes, ResourceType_1.ResourceType.Connection));
|
|
226
|
+
}
|
|
227
|
+
static findResource(dbRes, type, name) {
|
|
228
|
+
if (dbRes.getResouceType() === type && dbRes.getName() === name) {
|
|
229
|
+
return dbRes;
|
|
230
|
+
}
|
|
231
|
+
if (dbRes.getResouceType() === type) {
|
|
232
|
+
return undefined;
|
|
233
|
+
}
|
|
234
|
+
const list = dbRes.getChildren();
|
|
235
|
+
// console.log('ResUtil#dindRes ', dbRes.getName(), name, list);
|
|
236
|
+
for (let i = 0; i < list.length; i++) {
|
|
237
|
+
const r = ResourceUtil.findResource(list[i], type, name);
|
|
238
|
+
if (r) {
|
|
239
|
+
return r;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return undefined;
|
|
243
|
+
}
|
|
244
|
+
static create(dbRes, type) {
|
|
245
|
+
if (dbRes.getResouceType() === type) {
|
|
246
|
+
return dbRes;
|
|
247
|
+
}
|
|
248
|
+
if (dbRes.getParent() === undefined) {
|
|
249
|
+
return undefined;
|
|
250
|
+
}
|
|
251
|
+
return ResourceUtil.getResourceOf(dbRes.getParent(), type);
|
|
252
|
+
}
|
|
253
|
+
static getResourceOf(dbRes, type) {
|
|
254
|
+
if (dbRes.getResouceType() === type) {
|
|
255
|
+
return dbRes;
|
|
256
|
+
}
|
|
257
|
+
if (dbRes.getParent() === undefined) {
|
|
258
|
+
return undefined;
|
|
259
|
+
}
|
|
260
|
+
return ResourceUtil.getResourceOf(dbRes.getParent(), type);
|
|
261
|
+
}
|
|
262
|
+
static getAncestorListOf(dbRes, type) {
|
|
263
|
+
const ret = new Array();
|
|
264
|
+
ResourceUtil.getAncestorListOfSub(dbRes.getParent(), type, ret);
|
|
265
|
+
return ret;
|
|
266
|
+
}
|
|
267
|
+
static getAncestorListOfSub(parent, type, arr) {
|
|
268
|
+
if (parent === undefined || parent === null) {
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
if (parent.getResouceType() === type) {
|
|
272
|
+
arr.unshift(parent);
|
|
273
|
+
ResourceUtil.getAncestorListOfSub(parent.getParent(), type, arr);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
static isRequiredRefresh(res) {
|
|
277
|
+
if (res.refreshed === undefined) {
|
|
278
|
+
return true;
|
|
279
|
+
}
|
|
280
|
+
return new Date().getTime() - res.refreshed.getTime() > 1000 * 60 * 60;
|
|
281
|
+
}
|
|
282
|
+
static getTextColorModifierByExt(name) {
|
|
283
|
+
if (name.endsWith('/')) {
|
|
284
|
+
// yellow
|
|
285
|
+
return 'has-text-warning';
|
|
286
|
+
}
|
|
287
|
+
else if (name.endsWith('.xlsx') || name.endsWith('.xls')) {
|
|
288
|
+
// green
|
|
289
|
+
return 'has-text-success';
|
|
290
|
+
}
|
|
291
|
+
else if (name.endsWith('.docx') || name.endsWith('.doc')) {
|
|
292
|
+
// blue
|
|
293
|
+
return 'has-text-link';
|
|
294
|
+
}
|
|
295
|
+
else if (name.endsWith('.pptx') ||
|
|
296
|
+
name.endsWith('.ppt') ||
|
|
297
|
+
name.endsWith('.pdf')) {
|
|
298
|
+
// red
|
|
299
|
+
return 'has-text-danger';
|
|
300
|
+
}
|
|
301
|
+
return '';
|
|
302
|
+
}
|
|
303
|
+
static getFaIconByExt(name) {
|
|
304
|
+
if (name.endsWith('/')) {
|
|
305
|
+
return 'fa-folder';
|
|
306
|
+
}
|
|
307
|
+
else if (name.endsWith('.xlsx') || name.endsWith('.xls')) {
|
|
308
|
+
return 'fa-file-excel';
|
|
309
|
+
}
|
|
310
|
+
else if (name.endsWith('.docx') || name.endsWith('.doc')) {
|
|
311
|
+
return 'fa-file-word';
|
|
312
|
+
}
|
|
313
|
+
else if (name.endsWith('.pptx') || name.endsWith('.ppt')) {
|
|
314
|
+
return 'fa-file-powerpoint';
|
|
315
|
+
}
|
|
316
|
+
else if (name.endsWith('.m3u8') ||
|
|
317
|
+
name.endsWith('.mp4') ||
|
|
318
|
+
name.endsWith('.wmv') ||
|
|
319
|
+
name.endsWith('.avi')) {
|
|
320
|
+
return 'fa-file-video';
|
|
321
|
+
}
|
|
322
|
+
else if (name.endsWith('.jpg') ||
|
|
323
|
+
name.endsWith('.jpeg') ||
|
|
324
|
+
name.endsWith('.png') ||
|
|
325
|
+
name.endsWith('.gif') ||
|
|
326
|
+
name.endsWith('.bmp') ||
|
|
327
|
+
name.endsWith('.tiff')) {
|
|
328
|
+
return 'fa-file-image';
|
|
329
|
+
}
|
|
330
|
+
else if (name.endsWith('.pdf')) {
|
|
331
|
+
return 'fa-file-pdf';
|
|
332
|
+
}
|
|
333
|
+
return 'fa-file';
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
exports.default = ResourceUtil;
|
|
337
|
+
//# sourceMappingURL=ResourceUtil.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResourceUtil.js","sourceRoot":"","sources":["../../../../src/db/resource/ResourceUtil.ts"],"names":[],"mappings":";;AAAA,2CAAwC;AAExC,uDAAoD;AAEpD,MAAqB,YAAY;IAC/B,MAAM,CAAC,WAAW,CAAC,IAAY;QAC7B,QAAQ,IAAI,EAAE;YACZ,KAAK,eAAM,CAAC,KAAK;gBACf,OAAO,2BAA2B,CAAC;YACrC,KAAK,eAAM,CAAC,QAAQ;g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AC;SACxB;aAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;YAChC,OAAO,aAAa,CAAC;SACtB;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAzWD,+BAyWC"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { DbResource } from './DbResource';
|
|
2
|
+
import { GeneralColumnType } from './types/GeneralColumnType';
|
|
3
|
+
export declare class SampleClassPair {
|
|
4
|
+
clazz_value: any;
|
|
5
|
+
sample_values: any[];
|
|
6
|
+
}
|
|
7
|
+
export declare class SampleGroupByClass {
|
|
8
|
+
pairs: SampleClassPair[];
|
|
9
|
+
clazz_key: string;
|
|
10
|
+
sample_keys: string[];
|
|
11
|
+
is_shuffled: boolean;
|
|
12
|
+
constructor(clazz_key: string, sample_keys: string[]);
|
|
13
|
+
}
|
|
14
|
+
export declare class RdhKey {
|
|
15
|
+
name: string;
|
|
16
|
+
comment: string;
|
|
17
|
+
type: GeneralColumnType;
|
|
18
|
+
width?: number;
|
|
19
|
+
meta?: {
|
|
20
|
+
is_image?: boolean;
|
|
21
|
+
is_hyperlink?: boolean;
|
|
22
|
+
};
|
|
23
|
+
constructor(name: string, type?: GeneralColumnType, comment?: string);
|
|
24
|
+
toString(): string;
|
|
25
|
+
}
|
|
26
|
+
export declare enum AnnotationType {
|
|
27
|
+
Del = 0,
|
|
28
|
+
Upd = 1,
|
|
29
|
+
Add = 2,
|
|
30
|
+
Err = 3,
|
|
31
|
+
Lnt = 4,
|
|
32
|
+
Stl = 5
|
|
33
|
+
}
|
|
34
|
+
export interface AnnotationOptions {
|
|
35
|
+
message?: string;
|
|
36
|
+
result?: any;
|
|
37
|
+
style?: AnnotationStyleOptions;
|
|
38
|
+
}
|
|
39
|
+
export interface AnnotationStyleOptions {
|
|
40
|
+
f?: {
|
|
41
|
+
s: number;
|
|
42
|
+
n: string;
|
|
43
|
+
};
|
|
44
|
+
a?: {
|
|
45
|
+
h?: string;
|
|
46
|
+
v?: string;
|
|
47
|
+
};
|
|
48
|
+
b?: string;
|
|
49
|
+
fmt?: string;
|
|
50
|
+
}
|
|
51
|
+
export declare class CellAnnotation {
|
|
52
|
+
type: AnnotationType;
|
|
53
|
+
options?: AnnotationOptions;
|
|
54
|
+
styles?: AnnotationStyleOptions;
|
|
55
|
+
constructor(type: AnnotationType, options?: AnnotationOptions);
|
|
56
|
+
}
|
|
57
|
+
export interface MergedCell {
|
|
58
|
+
row: number;
|
|
59
|
+
col: number;
|
|
60
|
+
rowspan: number;
|
|
61
|
+
colspan: number;
|
|
62
|
+
}
|
|
63
|
+
export declare class RdhRow {
|
|
64
|
+
meta: any;
|
|
65
|
+
values: any;
|
|
66
|
+
constructor(meta: any, values: any);
|
|
67
|
+
pushAnnotation(key: string, type: AnnotationType, options?: AnnotationOptions): void;
|
|
68
|
+
clearAnnotations(type: AnnotationType): void;
|
|
69
|
+
getAnnotations(type: AnnotationType): CellAnnotation[];
|
|
70
|
+
getFirstAnnotationsOf(key: string, type: AnnotationType): CellAnnotation | undefined;
|
|
71
|
+
getAnnotationsOf(key: string, type: AnnotationType): CellAnnotation[];
|
|
72
|
+
hasAnnotation(type: AnnotationType): boolean;
|
|
73
|
+
}
|
|
74
|
+
export default class ResultSetDataHolder {
|
|
75
|
+
static create(err?: Error): ResultSetDataHolder;
|
|
76
|
+
is_empty: boolean;
|
|
77
|
+
keys: RdhKey[];
|
|
78
|
+
rows: Array<RdhRow>;
|
|
79
|
+
dbRes: DbResource | undefined;
|
|
80
|
+
sqlStatement: string | undefined;
|
|
81
|
+
errorMessage: string | undefined;
|
|
82
|
+
shuffledIndexes?: number[];
|
|
83
|
+
shuffledNextCounter?: number;
|
|
84
|
+
mergeCells?: MergedCell[];
|
|
85
|
+
constructor(keys: Array<string | RdhKey>, dbRes?: DbResource);
|
|
86
|
+
static createEmpty(): ResultSetDataHolder;
|
|
87
|
+
static from(list: any, i_titles?: string | string[]): ResultSetDataHolder;
|
|
88
|
+
/**
|
|
89
|
+
* The correlation is a measure of how correlated two datasets are, between -1 and 1
|
|
90
|
+
* @param key_x first input
|
|
91
|
+
* @param key_y first input
|
|
92
|
+
* @returns sample correlation
|
|
93
|
+
*/
|
|
94
|
+
sampleCorrelation(key_x: string, key_y: string): number;
|
|
95
|
+
describe(): ResultSetDataHolder;
|
|
96
|
+
splitRows(test_percentage: number, with_shuffle?: boolean): [ResultSetDataHolder, ResultSetDataHolder];
|
|
97
|
+
/**
|
|
98
|
+
* Sample a data from each class of this resutlsets.
|
|
99
|
+
*
|
|
100
|
+
* @param {number} numExamplesPerClass Number of examples per class.
|
|
101
|
+
*/
|
|
102
|
+
sampleXKeysGroupByClass(numExamplesPerClass: number, xKeys: string[], clazz: string, shuffle?: boolean): SampleGroupByClass;
|
|
103
|
+
nextXYBatch(batch_size: number, xKeys: string[], yKey: string): [any[][], any[]];
|
|
104
|
+
hasKey(key: string): boolean;
|
|
105
|
+
drop(key: string): void;
|
|
106
|
+
assign(key: string, list: any): void;
|
|
107
|
+
assignFromDictionary(new_key: string, existing_key: string, dictionary: string[]): void;
|
|
108
|
+
toVector(key_name: string, is_only_number?: boolean): Array<any>;
|
|
109
|
+
toMatrixArray(key_names?: string[]): Array<Array<any>>;
|
|
110
|
+
toCsv(config?: {
|
|
111
|
+
key_names?: string[];
|
|
112
|
+
}): string;
|
|
113
|
+
addRow(recordData: any, default_meta?: any): void;
|
|
114
|
+
clearRows(): void;
|
|
115
|
+
copyFrom(that: ResultSetDataHolder): void;
|
|
116
|
+
setSqlStatement(sqlStatement: string): void;
|
|
117
|
+
setDbRes(dbRes: DbResource): void;
|
|
118
|
+
hasAnnotation(type: AnnotationType): boolean;
|
|
119
|
+
fillnull(how: 'mean' | 'median'): void;
|
|
120
|
+
resetKeyTypeByRows(): void;
|
|
121
|
+
setKeys(keys: Array<string | RdhKey>): void;
|
|
122
|
+
keynames(is_only_numeric_like?: boolean): string[];
|
|
123
|
+
addKey(k: string | RdhKey): void;
|
|
124
|
+
private toShortString;
|
|
125
|
+
toString(num_of_print?: number): string;
|
|
126
|
+
}
|