@l-v-yonsama/multi-platform-database-drivers 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/built/src/db/drivers/AwsS3Driver.d.ts +1 -1
  2. package/built/src/db/drivers/AwsS3Driver.js +4 -4
  3. package/built/src/db/drivers/AwsS3Driver.js.map +1 -1
  4. package/built/src/db/drivers/BaseDriver.d.ts +6 -6
  5. package/built/src/db/drivers/BaseDriver.js +30 -49
  6. package/built/src/db/drivers/BaseDriver.js.map +1 -1
  7. package/built/src/db/drivers/MySQLDriver.d.ts +1 -1
  8. package/built/src/db/drivers/MySQLDriver.js +4 -3
  9. package/built/src/db/drivers/MySQLDriver.js.map +1 -1
  10. package/built/src/db/drivers/PostgresDriver.d.ts +1 -1
  11. package/built/src/db/drivers/PostgresDriver.js +4 -3
  12. package/built/src/db/drivers/PostgresDriver.js.map +1 -1
  13. package/built/src/db/drivers/RedisDriver.d.ts +2 -2
  14. package/built/src/db/drivers/RedisDriver.js +12 -12
  15. package/built/src/db/drivers/RedisDriver.js.map +1 -1
  16. package/built/src/db/index.d.ts +0 -1
  17. package/built/src/db/index.js +0 -1
  18. package/built/src/db/index.js.map +1 -1
  19. package/built/src/db/resource/DbResource.d.ts +43 -35
  20. package/built/src/db/resource/DbResource.js +80 -53
  21. package/built/src/db/resource/DbResource.js.map +1 -1
  22. package/built/src/db/resource/ResourceHelper.d.ts +6 -0
  23. package/built/src/db/resource/ResourceHelper.js +59 -0
  24. package/built/src/db/resource/ResourceHelper.js.map +1 -0
  25. package/built/src/db/resource/index.d.ts +1 -1
  26. package/built/src/db/resource/index.js +1 -1
  27. package/built/src/db/resource/index.js.map +1 -1
  28. package/built/src/db/resource/types/MySQLColumnType.js +9 -12
  29. package/built/src/db/resource/types/MySQLColumnType.js.map +1 -1
  30. package/built/src/index.d.ts +1 -1
  31. package/built/src/index.js +1 -1
  32. package/built/src/index.js.map +1 -1
  33. package/built/src/service/DBAccessService.d.ts +20 -0
  34. package/built/src/service/DBAccessService.js +302 -0
  35. package/built/src/service/DBAccessService.js.map +1 -0
  36. package/built/src/service/DBDriverResolver.d.ts +17 -0
  37. package/built/src/service/DBDriverResolver.js +101 -0
  38. package/built/src/service/DBDriverResolver.js.map +1 -0
  39. package/built/src/service/SQLService.d.ts +5 -0
  40. package/built/src/service/SQLService.js +71 -0
  41. package/built/src/service/SQLService.js.map +1 -0
  42. package/built/src/service/index.d.ts +5 -0
  43. package/built/src/service/index.js +9 -0
  44. package/built/src/service/index.js.map +1 -0
  45. package/built/src/service/request/{redis_request.d.ts → RedisRequest.d.ts} +1 -1
  46. package/built/src/service/request/{redis_request.js → RedisRequest.js} +1 -1
  47. package/built/src/service/request/RedisRequest.js.map +1 -0
  48. package/built/src/service/request/{s3_request.d.ts → S3Request.d.ts} +1 -1
  49. package/built/src/service/request/{s3_request.js → S3Request.js} +1 -1
  50. package/built/src/service/request/S3Request.js.map +1 -0
  51. package/built/src/service/request/index.d.ts +69 -0
  52. package/built/src/service/request/index.js +19 -0
  53. package/built/src/service/request/index.js.map +1 -0
  54. package/built/src/service/response/GeneralDBResponse.d.ts +8 -0
  55. package/built/src/service/response/GeneralDBResponse.js +3 -0
  56. package/built/src/service/response/GeneralDBResponse.js.map +1 -0
  57. package/built/src/service/response/GeneralResponse.d.ts +6 -0
  58. package/built/src/service/response/GeneralResponse.js +13 -0
  59. package/built/src/service/response/GeneralResponse.js.map +1 -0
  60. package/built/src/service/response/index.d.ts +2 -0
  61. package/built/src/service/response/index.js +6 -0
  62. package/built/src/service/response/index.js.map +1 -0
  63. package/built/src/service/response/reply/ConnectionResult.d.ts +3 -0
  64. package/built/src/service/response/reply/ConnectionResult.js +3 -0
  65. package/built/src/service/response/reply/ConnectionResult.js.map +1 -0
  66. package/built/src/service/response/reply/FileExportReply.d.ts +10 -0
  67. package/built/src/service/response/reply/FileExportReply.js +17 -0
  68. package/built/src/service/response/reply/FileExportReply.js.map +1 -0
  69. package/built/src/service/response/reply/FileProcessResult.d.ts +14 -0
  70. package/built/src/service/response/reply/FileProcessResult.js +28 -0
  71. package/built/src/service/response/reply/FileProcessResult.js.map +1 -0
  72. package/built/src/service/response/{GeneralReponse.d.ts → reply/GeneralReply.d.ts} +1 -1
  73. package/built/src/service/response/{GeneralReponse.js → reply/GeneralReply.js} +3 -3
  74. package/built/src/service/response/reply/GeneralReply.js.map +1 -0
  75. package/built/src/service/response/reply/OutputReply.d.ts +9 -0
  76. package/built/src/service/response/reply/OutputReply.js +16 -0
  77. package/built/src/service/response/reply/OutputReply.js.map +1 -0
  78. package/built/src/service/response/reply/ProgressReply.d.ts +7 -0
  79. package/built/src/service/response/reply/ProgressReply.js +13 -0
  80. package/built/src/service/response/reply/ProgressReply.js.map +1 -0
  81. package/built/src/service/response/reply/types/FileExportType.d.ts +3 -0
  82. package/built/src/service/response/reply/types/FileExportType.js +9 -0
  83. package/built/src/service/response/reply/types/FileExportType.js.map +1 -0
  84. package/built/src/service/response/reply/types/OutputType.d.ts +11 -0
  85. package/built/src/service/response/reply/types/OutputType.js +16 -0
  86. package/built/src/service/response/reply/types/OutputType.js.map +1 -0
  87. package/built/src/service/response/reply/types/ReplyEventType.d.ts +10 -0
  88. package/built/src/service/response/reply/types/ReplyEventType.js +16 -0
  89. package/built/src/service/response/reply/types/ReplyEventType.js.map +1 -0
  90. package/package.json +9 -5
  91. package/built/src/db/manager.d.ts +0 -8
  92. package/built/src/db/manager.js +0 -87
  93. package/built/src/db/manager.js.map +0 -1
  94. package/built/src/db/resource/ResourceUtil.d.ts +0 -39
  95. package/built/src/db/resource/ResourceUtil.js +0 -337
  96. package/built/src/db/resource/ResourceUtil.js.map +0 -1
  97. package/built/src/service/request/general_db_request.d.ts +0 -18
  98. package/built/src/service/request/general_db_request.js +0 -14
  99. package/built/src/service/request/general_db_request.js.map +0 -1
  100. package/built/src/service/request/redis_request.js.map +0 -1
  101. package/built/src/service/request/s3_request.js.map +0 -1
  102. package/built/src/service/response/GeneralReponse.js.map +0 -1
  103. package/built/src/util/file_util.d.ts +0 -22
  104. package/built/src/util/file_util.js +0 -143
  105. package/built/src/util/file_util.js.map +0 -1
  106. package/built/src/util/index.d.ts +0 -1
  107. package/built/src/util/index.js +0 -5
  108. package/built/src/util/index.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { RedisKeyType } from '../../db/resource/types/RedisKeyType';
2
2
  export interface RedisRequest {
3
- connection_id: string;
3
+ connectionId: string;
4
4
  index: number;
5
5
  command: RedisCommandType;
6
6
  key?: string;
@@ -11,4 +11,4 @@ var RedisCommandType;
11
11
  RedisCommandType["Scan"] = "Scan";
12
12
  RedisCommandType["SetValue"] = "SetValue";
13
13
  })(RedisCommandType = exports.RedisCommandType || (exports.RedisCommandType = {}));
14
- //# sourceMappingURL=redis_request.js.map
14
+ //# sourceMappingURL=RedisRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RedisRequest.js","sourceRoot":"","sources":["../../../../src/service/request/RedisRequest.ts"],"names":[],"mappings":";;;AAWA,IAAY,gBAQX;AARD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,yCAAqB,CAAA;IACrB,uCAAmB,CAAA;IACnB,yCAAqB,CAAA;IACrB,iCAAa,CAAA;IACb,iCAAa,CAAA;IACb,yCAAqB,CAAA;AACvB,CAAC,EARW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAQ3B"}
@@ -1,5 +1,5 @@
1
1
  export interface S3Request {
2
- connection_id: string;
2
+ connectionId: string;
3
3
  command: S3CommandType;
4
4
  Bucket: string;
5
5
  key?: string;
@@ -9,4 +9,4 @@ var S3CommandType;
9
9
  S3CommandType["listObject"] = "listObject";
10
10
  S3CommandType["getObject"] = "getObject";
11
11
  })(S3CommandType = exports.S3CommandType || (exports.S3CommandType = {}));
12
- //# sourceMappingURL=s3_request.js.map
12
+ //# sourceMappingURL=S3Request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"S3Request.js","sourceRoot":"","sources":["../../../../src/service/request/S3Request.ts"],"names":[],"mappings":";;;AAQA,IAAY,aAMX;AAND,WAAY,aAAa;IACvB,wCAAuB,CAAA;IACvB,kCAAiB,CAAA;IACjB,4CAA2B,CAAA;IAC3B,0CAAyB,CAAA;IACzB,wCAAuB,CAAA;AACzB,CAAC,EANW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAMxB"}
@@ -0,0 +1,69 @@
1
+ import { ConnectionSetting, SchemaAndTableHints } from '../../db';
2
+ export interface GeneralDBRequest<U = any> {
3
+ /** Connection毎のユニークなID */
4
+ connectionId?: string;
5
+ options?: U;
6
+ }
7
+ export interface RequestInConnectedState<U = any> {
8
+ /** Connection毎のユニークなID */
9
+ connectionId: string;
10
+ options?: U;
11
+ }
12
+ export interface AddConnectionSettingRequest {
13
+ setting: ConnectionSetting;
14
+ }
15
+ export interface RemoveConnectionSettingRequest {
16
+ connectionName: string;
17
+ }
18
+ export interface TestConnectionSettingRequest {
19
+ setting: ConnectionSetting;
20
+ }
21
+ export interface ConnectRequest {
22
+ connectionName: string;
23
+ }
24
+ export interface ViewDataRequest extends RequestInConnectedState<{
25
+ autoConnection?: boolean;
26
+ schemaName?: string;
27
+ tableName: string;
28
+ columns?: string[];
29
+ }> {
30
+ }
31
+ export interface ListProposalsRequest extends RequestInConnectedState {
32
+ keyword?: string;
33
+ }
34
+ export interface ExecuteSqlRequest extends GeneralDBRequest<{
35
+ needsColumnResolve?: boolean;
36
+ autoConnection?: boolean;
37
+ maxRows?: number;
38
+ sql: string;
39
+ }> {
40
+ connectionId: string;
41
+ }
42
+ export interface CountTablesRequest extends GeneralDBRequest<{
43
+ tables: SchemaAndTableHints;
44
+ }> {
45
+ connectionId: string;
46
+ }
47
+ export interface BatchInsertFromArrayRequest extends GeneralDBRequest<{
48
+ autoConnection?: boolean;
49
+ schemaName?: string;
50
+ tableName: string;
51
+ columns?: string[];
52
+ dataList: any[];
53
+ }> {
54
+ connectionId: string;
55
+ }
56
+ export declare enum GeneralDBCommandType {
57
+ CountTables = "CountTables",
58
+ ViewData = "ViewData",
59
+ ListProposals = "ListProposals",
60
+ GetInfomationSchemas = "GetInfomationSchemas",
61
+ ExecuteSql = "ExecuteSql",
62
+ AddConnectionSetting = "AddConnectionSetting",
63
+ RemoveConnectionSetting = "RemoveConnectionSetting",
64
+ TestConnectionSetting = "TestConnectionSetting",
65
+ Connect = "Connect",
66
+ Disconnect = "Disconnect",
67
+ DisconnectAll = "DisconnectAll",
68
+ BatchInsertFromArray = "BatchInsertFromArray"
69
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GeneralDBCommandType = void 0;
4
+ var GeneralDBCommandType;
5
+ (function (GeneralDBCommandType) {
6
+ GeneralDBCommandType["CountTables"] = "CountTables";
7
+ GeneralDBCommandType["ViewData"] = "ViewData";
8
+ GeneralDBCommandType["ListProposals"] = "ListProposals";
9
+ GeneralDBCommandType["GetInfomationSchemas"] = "GetInfomationSchemas";
10
+ GeneralDBCommandType["ExecuteSql"] = "ExecuteSql";
11
+ GeneralDBCommandType["AddConnectionSetting"] = "AddConnectionSetting";
12
+ GeneralDBCommandType["RemoveConnectionSetting"] = "RemoveConnectionSetting";
13
+ GeneralDBCommandType["TestConnectionSetting"] = "TestConnectionSetting";
14
+ GeneralDBCommandType["Connect"] = "Connect";
15
+ GeneralDBCommandType["Disconnect"] = "Disconnect";
16
+ GeneralDBCommandType["DisconnectAll"] = "DisconnectAll";
17
+ GeneralDBCommandType["BatchInsertFromArray"] = "BatchInsertFromArray";
18
+ })(GeneralDBCommandType = exports.GeneralDBCommandType || (exports.GeneralDBCommandType = {}));
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/service/request/index.ts"],"names":[],"mappings":";;;AA0EA,IAAY,oBAaX;AAbD,WAAY,oBAAoB;IAC9B,mDAA2B,CAAA;IAC3B,6CAAqB,CAAA;IACrB,uDAA+B,CAAA;IAC/B,qEAA6C,CAAA;IAC7C,iDAAyB,CAAA;IACzB,qEAA6C,CAAA;IAC7C,2EAAmD,CAAA;IACnD,uEAA+C,CAAA;IAC/C,2CAAmB,CAAA;IACnB,iDAAyB,CAAA;IACzB,uDAA+B,CAAA;IAC/B,qEAA6C,CAAA;AAC/C,CAAC,EAbW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAa/B"}
@@ -0,0 +1,8 @@
1
+ import { GeneralDBCommandType } from '../request';
2
+ export interface GeneralDBResponse<T = any> {
3
+ command: GeneralDBCommandType;
4
+ ok: boolean;
5
+ message: string;
6
+ elapsed_time: number;
7
+ result?: T;
8
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=GeneralDBResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GeneralDBResponse.js","sourceRoot":"","sources":["../../../../src/service/response/GeneralDBResponse.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ export declare class GeneralResponse<T = any> {
2
+ ok: boolean;
3
+ message: string;
4
+ result?: T;
5
+ constructor(ok?: boolean, message?: string);
6
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GeneralResponse = void 0;
4
+ class GeneralResponse {
5
+ constructor(ok = true, message = '') {
6
+ this.ok = true;
7
+ this.message = '';
8
+ this.ok = ok;
9
+ this.message = message;
10
+ }
11
+ }
12
+ exports.GeneralResponse = GeneralResponse;
13
+ //# sourceMappingURL=GeneralResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GeneralResponse.js","sourceRoot":"","sources":["../../../../src/service/response/GeneralResponse.ts"],"names":[],"mappings":";;;AAAA,MAAa,eAAe;IAK1B,YAAY,EAAE,GAAG,IAAI,EAAE,OAAO,GAAG,EAAE;QAJ5B,OAAE,GAAG,IAAI,CAAC;QACV,YAAO,GAAG,EAAE,CAAC;QAIlB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AATD,0CASC"}
@@ -0,0 +1,2 @@
1
+ export * from './GeneralDBResponse';
2
+ export * from './GeneralResponse';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./GeneralDBResponse"), exports);
5
+ tslib_1.__exportStar(require("./GeneralResponse"), exports);
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/service/response/index.ts"],"names":[],"mappings":";;;AAAA,8DAAoC;AACpC,4DAAkC"}
@@ -0,0 +1,3 @@
1
+ export interface ConnectionResult {
2
+ connectionId: string;
3
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ConnectionResult.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConnectionResult.js","sourceRoot":"","sources":["../../../../../src/service/response/reply/ConnectionResult.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import GeneralReply from './GeneralReply';
2
+ import { FileExportType } from './types/FileExportType';
3
+ export default class FileExportReply extends GeneralReply {
4
+ export_type: FileExportType;
5
+ request_id: string;
6
+ ok: boolean;
7
+ message: string;
8
+ target_path: string;
9
+ constructor(export_type: FileExportType, target_path: string);
10
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const short_unique_id_1 = require("short-unique-id");
4
+ const GeneralReply_1 = require("./GeneralReply");
5
+ const uid = new short_unique_id_1.default();
6
+ class FileExportReply extends GeneralReply_1.default {
7
+ constructor(export_type, target_path) {
8
+ super(true, '');
9
+ this.ok = true;
10
+ this.message = '';
11
+ this.export_type = export_type;
12
+ this.request_id = uid.randomUUID(6);
13
+ this.target_path = target_path;
14
+ }
15
+ }
16
+ exports.default = FileExportReply;
17
+ //# sourceMappingURL=FileExportReply.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileExportReply.js","sourceRoot":"","sources":["../../../../../src/service/response/reply/FileExportReply.ts"],"names":[],"mappings":";;AAAA,qDAA4C;AAC5C,iDAA0C;AAG1C,MAAM,GAAG,GAAG,IAAI,yBAAa,EAAE,CAAC;AAEhC,MAAqB,eAAgB,SAAQ,sBAAY;IAOvD,YAAY,WAA2B,EAAE,WAAmB;QAC1D,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QALX,OAAE,GAAG,IAAI,CAAC;QACV,YAAO,GAAG,EAAE,CAAC;QAKlB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QACpC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;CACF;AAbD,kCAaC"}
@@ -0,0 +1,14 @@
1
+ /// <reference types="node" />
2
+ import GeneralReply from './GeneralReply';
3
+ export default class FileProcessResult extends GeneralReply {
4
+ extension: string;
5
+ file_url?: string;
6
+ file_path?: string;
7
+ file_name: string;
8
+ data?: string | Buffer;
9
+ constructor(ok: boolean, message: string, options: {
10
+ file_path?: string;
11
+ file_url?: string;
12
+ data?: string | Buffer;
13
+ });
14
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const path = require("path");
4
+ const GeneralReply_1 = require("./GeneralReply");
5
+ class FileProcessResult extends GeneralReply_1.default {
6
+ constructor(ok, message, options) {
7
+ super(ok, message);
8
+ this.extension = '';
9
+ this.file_name = '';
10
+ if (options.file_path) {
11
+ this.file_path = options.file_path;
12
+ this.file_name = path.basename(options.file_path);
13
+ }
14
+ if (options.file_url) {
15
+ this.file_url = options.file_url;
16
+ this.file_name = path.basename(options.file_url);
17
+ }
18
+ const dot = this.file_name.lastIndexOf(".");
19
+ if (dot >= 0) {
20
+ this.extension = this.file_name.substring(dot + 1);
21
+ }
22
+ if (options.data) {
23
+ this.data = options.data;
24
+ }
25
+ }
26
+ }
27
+ exports.default = FileProcessResult;
28
+ //# sourceMappingURL=FileProcessResult.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileProcessResult.js","sourceRoot":"","sources":["../../../../../src/service/response/reply/FileProcessResult.ts"],"names":[],"mappings":";;AAAA,6BAA6B;AAC7B,iDAA0C;AAE1C,MAAqB,iBAAkB,SAAQ,sBAAY;IAOzD,YAAY,EAAW,EAAE,OAAe,EAAE,OAIzC;QACC,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QAXd,cAAS,GAAG,EAAE,CAAC;QAGf,cAAS,GAAG,EAAE,CAAC;QASpB,IAAI,OAAO,CAAC,SAAS,EAAE;YACrB,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;YACnC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;SACnD;QACD,IAAI,OAAO,CAAC,QAAQ,EAAE;YACpB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;YACjC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;SAClD;QACD,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAC5C,IAAI,GAAG,IAAI,CAAC,EAAE;YACZ,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;SACpD;QACD,IAAI,OAAO,CAAC,IAAI,EAAE;YAChB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;SAC1B;IACH,CAAC;CACF;AA7BD,oCA6BC"}
@@ -1,4 +1,4 @@
1
- export default class GeneralResponse {
1
+ export default class GeneralReply {
2
2
  ok: boolean;
3
3
  message: string;
4
4
  result: any;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- class GeneralResponse {
3
+ class GeneralReply {
4
4
  constructor(ok = true, message = '') {
5
5
  this.ok = true;
6
6
  this.message = '';
@@ -8,5 +8,5 @@ class GeneralResponse {
8
8
  this.message = message;
9
9
  }
10
10
  }
11
- exports.default = GeneralResponse;
12
- //# sourceMappingURL=GeneralReponse.js.map
11
+ exports.default = GeneralReply;
12
+ //# sourceMappingURL=GeneralReply.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GeneralReply.js","sourceRoot":"","sources":["../../../../../src/service/response/reply/GeneralReply.ts"],"names":[],"mappings":";;AAAA,MAAqB,YAAY;IAK/B,YAAY,EAAE,GAAG,IAAI,EAAE,OAAO,GAAG,EAAE;QAJ5B,OAAE,GAAG,IAAI,CAAC;QACV,YAAO,GAAG,EAAE,CAAC;QAIlB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AATD,+BASC"}
@@ -0,0 +1,9 @@
1
+ import { OutputType } from './types/OutputType';
2
+ import GeneralReply from './GeneralReply';
3
+ export default class OutputReply extends GeneralReply {
4
+ output_type: OutputType;
5
+ request_id: string;
6
+ label: string;
7
+ content: any;
8
+ constructor(output_type: OutputType, label: string, content: any);
9
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const short_unique_id_1 = require("short-unique-id");
4
+ const GeneralReply_1 = require("./GeneralReply");
5
+ const uid = new short_unique_id_1.default();
6
+ class OutputReply extends GeneralReply_1.default {
7
+ constructor(output_type, label, content) {
8
+ super(true, '');
9
+ this.output_type = output_type;
10
+ this.request_id = uid.randomUUID(6);
11
+ this.label = label;
12
+ this.content = content;
13
+ }
14
+ }
15
+ exports.default = OutputReply;
16
+ //# sourceMappingURL=OutputReply.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OutputReply.js","sourceRoot":"","sources":["../../../../../src/service/response/reply/OutputReply.ts"],"names":[],"mappings":";;AAAA,qDAA4C;AAE5C,iDAA0C;AAE1C,MAAM,GAAG,GAAG,IAAI,yBAAa,EAAE,CAAC;AAEhC,MAAqB,WAAY,SAAQ,sBAAY;IAMnD,YAAY,WAAuB,EAAE,KAAa,EAAE,OAAY;QAC9D,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAChB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QACpC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAbD,8BAaC"}
@@ -0,0 +1,7 @@
1
+ import GeneralReply from './GeneralReply';
2
+ export default class ProgressReply extends GeneralReply {
3
+ source: string;
4
+ progress: number;
5
+ options?: any;
6
+ constructor(source: string, message: string, progress: number, options?: any);
7
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const GeneralReply_1 = require("./GeneralReply");
4
+ class ProgressReply extends GeneralReply_1.default {
5
+ constructor(source, message, progress, options) {
6
+ super(true, message);
7
+ this.source = source;
8
+ this.progress = progress;
9
+ this.options = options;
10
+ }
11
+ }
12
+ exports.default = ProgressReply;
13
+ //# sourceMappingURL=ProgressReply.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProgressReply.js","sourceRoot":"","sources":["../../../../../src/service/response/reply/ProgressReply.ts"],"names":[],"mappings":";;AAAA,iDAA0C;AAE1C,MAAqB,aAAc,SAAQ,sBAAY;IAKrD,YAAY,MAAc,EAAE,OAAe,EAAE,QAAgB,EAAE,OAAa;QAC1E,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAXD,gCAWC"}
@@ -0,0 +1,3 @@
1
+ export declare enum FileExportType {
2
+ Excel = "Excel"
3
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FileExportType = void 0;
4
+ var FileExportType;
5
+ (function (FileExportType) {
6
+ FileExportType["Excel"] = "Excel";
7
+ })(FileExportType = exports.FileExportType || (exports.FileExportType = {}));
8
+ ;
9
+ //# sourceMappingURL=FileExportType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileExportType.js","sourceRoot":"","sources":["../../../../../../src/service/response/reply/types/FileExportType.ts"],"names":[],"mappings":";;;AAAA,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,iCAAe,CAAA;AACjB,CAAC,EAFW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAEzB;AAAA,CAAC"}
@@ -0,0 +1,11 @@
1
+ export declare enum OutputType {
2
+ Log = "output.Log",
3
+ SqlHistory = "output.SqlHistory",
4
+ SingleResultSet = "output.SingleResultSet",
5
+ CountTableRowsResult = "output.CountTableRowsResult",
6
+ MultipleResultSet = "output.MultipleResultSet",
7
+ RedisCommandResultSet = "output.RedisCommandResultSet",
8
+ S3ContantFilePath = "output.S3ContantFilePath",
9
+ IndexedDBKeyWithValue = "output.IndexedDBKeyWithValue",
10
+ RestResponse = "output.RestResponse"
11
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OutputType = void 0;
4
+ var OutputType;
5
+ (function (OutputType) {
6
+ OutputType["Log"] = "output.Log";
7
+ OutputType["SqlHistory"] = "output.SqlHistory";
8
+ OutputType["SingleResultSet"] = "output.SingleResultSet";
9
+ OutputType["CountTableRowsResult"] = "output.CountTableRowsResult";
10
+ OutputType["MultipleResultSet"] = "output.MultipleResultSet";
11
+ OutputType["RedisCommandResultSet"] = "output.RedisCommandResultSet";
12
+ OutputType["S3ContantFilePath"] = "output.S3ContantFilePath";
13
+ OutputType["IndexedDBKeyWithValue"] = "output.IndexedDBKeyWithValue";
14
+ OutputType["RestResponse"] = "output.RestResponse";
15
+ })(OutputType = exports.OutputType || (exports.OutputType = {}));
16
+ //# sourceMappingURL=OutputType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OutputType.js","sourceRoot":"","sources":["../../../../../../src/service/response/reply/types/OutputType.ts"],"names":[],"mappings":";;;AAAA,IAAY,UAUX;AAVD,WAAY,UAAU;IACpB,gCAAkB,CAAA;IAClB,8CAAgC,CAAA;IAChC,wDAA0C,CAAA;IAC1C,kEAAoD,CAAA;IACpD,4DAA8C,CAAA;IAC9C,oEAAsD,CAAA;IACtD,4DAA8C,CAAA;IAC9C,oEAAsD,CAAA;IACtD,kDAAoC,CAAA;AACtC,CAAC,EAVW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAUrB"}
@@ -0,0 +1,10 @@
1
+ export declare enum ReplyEventType {
2
+ REPLY_RESOURCE_LIST = "reply.resource.list",
3
+ REPLY_SQL_OUTPUT = "reply.sql.output",
4
+ REPLY_TOGGLE_CONNECT = "reply.toggle.connect",
5
+ REPLY_TEST_CONNECTION = "reply.test.connection",
6
+ REPLY_S3_GET_OBJECT = "reply.s3.getObject",
7
+ REPLY_FILE_OUTPUT = "reply.file.output",
8
+ REPLY_AUTOMATION_CREATE = "reply.automation.create",
9
+ REPLY_AUTOMATION_DESTROY = "reply.automation.destroy"
10
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReplyEventType = void 0;
4
+ var ReplyEventType;
5
+ (function (ReplyEventType) {
6
+ ReplyEventType["REPLY_RESOURCE_LIST"] = "reply.resource.list";
7
+ ReplyEventType["REPLY_SQL_OUTPUT"] = "reply.sql.output";
8
+ ReplyEventType["REPLY_TOGGLE_CONNECT"] = "reply.toggle.connect";
9
+ ReplyEventType["REPLY_TEST_CONNECTION"] = "reply.test.connection";
10
+ ReplyEventType["REPLY_S3_GET_OBJECT"] = "reply.s3.getObject";
11
+ ReplyEventType["REPLY_FILE_OUTPUT"] = "reply.file.output";
12
+ ReplyEventType["REPLY_AUTOMATION_CREATE"] = "reply.automation.create";
13
+ ReplyEventType["REPLY_AUTOMATION_DESTROY"] = "reply.automation.destroy";
14
+ })(ReplyEventType = exports.ReplyEventType || (exports.ReplyEventType = {}));
15
+ ;
16
+ //# sourceMappingURL=ReplyEventType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReplyEventType.js","sourceRoot":"","sources":["../../../../../../src/service/response/reply/types/ReplyEventType.ts"],"names":[],"mappings":";;;AAAA,IAAY,cASX;AATD,WAAY,cAAc;IACxB,6DAA2C,CAAA;IAC3C,uDAAqC,CAAA;IACrC,+DAA6C,CAAA;IAC7C,iEAA+C,CAAA;IAC/C,4DAA0C,CAAA;IAC1C,yDAAuC,CAAA;IACvC,qEAAmD,CAAA;IACnD,uEAAqD,CAAA;AACvD,CAAC,EATW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QASzB;AAAA,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@l-v-yonsama/multi-platform-database-drivers",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "multi-platform database drivers in TypeScript.",
5
5
  "type": "module",
6
6
  "engines": {
@@ -26,16 +26,19 @@
26
26
  "start": "node built/src/index.js",
27
27
  "clean": "rimraf coverage built tmp",
28
28
  "prebuild": "npm run lint",
29
- "build": "tsc -p tsconfig.json",
30
- "build:watch": "tsc -w -p tsconfig.json",
29
+ "build": "npm run clean && tsc -p tsconfig.json",
30
+ "build:watch": "npm run clean && tsc -w -p tsconfig.json",
31
31
  "build:release": "npm run clean && tsc -p tsconfig.release.json",
32
32
  "prepublishOnly": "npm run build:release",
33
33
  "lint": "eslint . --ext .ts --ext .mts",
34
34
  "lint:fix": "eslint --fix . --ext .ts --ext .mts",
35
35
  "test0": "jest --coverage",
36
- "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
37
- "test:postgres": "node --experimental-vm-modules node_modules/jest/bin/jest.js __tests__/db/drivers/PostgresDriver.test.ts",
36
+ "test": "npm run clean && node --experimental-vm-modules node_modules/jest/bin/jest.js --runInBand",
37
+ "test:driver:mysql": "node --experimental-vm-modules node_modules/jest/bin/jest.js __tests__/db/drivers/MySQLDriver.test.ts",
38
+ "test:driver:postgres": "node --experimental-vm-modules node_modules/jest/bin/jest.js __tests__/db/drivers/PostgresDriver.test.ts",
38
39
  "test:minio": "node --experimental-vm-modules node_modules/jest/bin/jest.js __tests__/db/drivers/AwsS3Driver.test.ts",
40
+ "test:access:mysql": "node --experimental-vm-modules node_modules/jest/bin/jest.js __tests__/service/DBAccessService.mysql.test.ts",
41
+ "test:sql": "node --experimental-vm-modules node_modules/jest/bin/jest.js __tests__/service/SQLService.test.ts",
39
42
  "prettier": "prettier --config .prettierrc --write .",
40
43
  "test:watch": "jest --watch"
41
44
  },
@@ -52,6 +55,7 @@
52
55
  "jconv": "^0.1.5",
53
56
  "list-it": "^1.3.10",
54
57
  "mysql2": "^3.1.2",
58
+ "node-sql-parser": "^4.6.5",
55
59
  "pg": "^8.9.0",
56
60
  "pretty-bytes": "^6.1.0",
57
61
  "short-unique-id": "^4.4.4",
@@ -1,8 +0,0 @@
1
- import BaseDriver from './drivers/BaseDriver';
2
- import { DbConnection } from './resource/DbResource';
3
- export { getConResList, getDefByName, getDefById, getDriverById, asyncCloseAll, };
4
- declare function getConResList(): Array<DbConnection>;
5
- declare function getDefById(id: string): DbConnection | undefined;
6
- declare function getDefByName(defName: string): DbConnection | undefined;
7
- declare function getDriverById(id: string): BaseDriver | undefined;
8
- declare function asyncCloseAll(): Promise<string>;
@@ -1,87 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.asyncCloseAll = exports.getDriverById = exports.getDefById = exports.getDefByName = exports.getConResList = void 0;
4
- // import MongoDriver from './drivers/MongoDriver'
5
- // import ODBCDriver from './drivers/ODBCDriver';
6
- const RedisDriver_1 = require("./drivers/RedisDriver");
7
- const MySQLDriver_1 = require("./drivers/MySQLDriver");
8
- const PostgresDriver_1 = require("./drivers/PostgresDriver");
9
- const AwsS3Driver_1 = require("./drivers/AwsS3Driver");
10
- const DBType_1 = require("./resource/types/DBType");
11
- const driverMap = new Map();
12
- const conResList = new Array();
13
- function getConResList() {
14
- return conResList;
15
- }
16
- exports.getConResList = getConResList;
17
- function getDefById(id) {
18
- return conResList.find((def) => def.id === id);
19
- }
20
- exports.getDefById = getDefById;
21
- function getDefByName(defName) {
22
- return conResList.find((def) => def.name === defName);
23
- }
24
- exports.getDefByName = getDefByName;
25
- function getDriverById(id) {
26
- const conDef = getDefById(id);
27
- if (conDef === undefined) {
28
- return undefined;
29
- }
30
- let driver = driverMap.get(id);
31
- if (driver) {
32
- return driver;
33
- }
34
- driver = createDriver(conDef);
35
- if (driver) {
36
- driverMap.set(id, driver);
37
- }
38
- return driver;
39
- }
40
- exports.getDriverById = getDriverById;
41
- function createDriver(conRes) {
42
- let driver = undefined;
43
- switch (conRes.db_type) {
44
- // case DBType.ODBC:
45
- // driver = new ODBCDriver(conRes);
46
- // break;
47
- case DBType_1.DBType.MySQL:
48
- driver = new MySQLDriver_1.default(conRes);
49
- break;
50
- case DBType_1.DBType.Postgres:
51
- driver = new PostgresDriver_1.default(conRes);
52
- break;
53
- case DBType_1.DBType.Redis:
54
- driver = new RedisDriver_1.default(conRes);
55
- break;
56
- // case DBType.Firestore:
57
- // // driver = new FirestoreDriver(conRes);
58
- // break;
59
- case DBType_1.DBType.AwsS3:
60
- case DBType_1.DBType.Minio:
61
- driver = new AwsS3Driver_1.default(conRes);
62
- break;
63
- // case DBType.Mongodb:
64
- // // driver = new MongoDriver(conDef)
65
- // break
66
- // case DBType.IndexedDB:
67
- // driver = new IndexedDBDriver(conRes);
68
- // break;
69
- default:
70
- throw new Error(`${conRes.db_type} is not supported.`);
71
- }
72
- return driver;
73
- }
74
- async function asyncCloseAll() {
75
- let errorMessage = '';
76
- driverMap.forEach(async (driver) => {
77
- try {
78
- await driver.asyncClose();
79
- }
80
- catch (e) {
81
- errorMessage += e.message + '\n';
82
- }
83
- });
84
- return errorMessage;
85
- }
86
- exports.asyncCloseAll = asyncCloseAll;
87
- //# sourceMappingURL=manager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"manager.js","sourceRoot":"","sources":["../../../src/db/manager.ts"],"names":[],"mappings":";;;AAAA,kDAAkD;AAClD,iDAAiD;AACjD,uDAAgD;AAChD,uDAAgD;AAChD,6DAAsD;AACtD,uDAAgD;AAIhD,oDAAiD;AAEjD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAsB,CAAC;AAChD,MAAM,UAAU,GAAG,IAAI,KAAK,EAAgB,CAAC;AAU7C,SAAS,aAAa;IACpB,OAAO,UAAU,CAAC;AACpB,CAAC;AATC,sCAAa;AAWf,SAAS,UAAU,CAAC,EAAU;IAC5B,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AACjD,CAAC;AAXC,gCAAU;AAaZ,SAAS,YAAY,CAAC,OAAe;IACnC,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC;AACxD,CAAC;AAhBC,oCAAY;AAkBd,SAAS,aAAa,CAAC,EAAU;IAC/B,MAAM,MAAM,GAAG,UAAU,CAAC,EAAE,CAAC,CAAC;IAC9B,IAAI,MAAM,KAAK,SAAS,EAAE;QACxB,OAAO,SAAS,CAAC;KAClB;IACD,IAAI,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC/B,IAAI,MAAM,EAAE;QACV,OAAO,MAAM,CAAC;KACf;IACD,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IAC9B,IAAI,MAAM,EAAE;QACV,SAAS,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;KAC3B;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AA9BC,sCAAa;AAgCf,SAAS,YAAY,CAAC,MAAoB;IACxC,IAAI,MAAM,GAAG,SAAS,CAAC;IACvB,QAAQ,MAAM,CAAC,OAAO,EAAE;QACtB,oBAAoB;QACpB,qCAAqC;QACrC,WAAW;QACX,KAAK,eAAM,CAAC,KAAK;YACf,MAAM,GAAG,IAAI,qBAAW,CAAC,MAAM,CAAC,CAAC;YACjC,MAAM;QACR,KAAK,eAAM,CAAC,QAAQ;YAClB,MAAM,GAAG,IAAI,wBAAc,CAAC,MAAM,CAAC,CAAC;YACpC,MAAM;QACR,KAAK,eAAM,CAAC,KAAK;YACf,MAAM,GAAG,IAAI,qBAAW,CAAC,MAAM,CAAC,CAAC;YACjC,MAAM;QACR,yBAAyB;QACzB,6CAA6C;QAC7C,WAAW;QACX,KAAK,eAAM,CAAC,KAAK,CAAC;QAClB,KAAK,eAAM,CAAC,KAAK;YACf,MAAM,GAAG,IAAI,qBAAW,CAAC,MAAM,CAAC,CAAC;YACjC,MAAM;QACR,uBAAuB;QACvB,wCAAwC;QACxC,UAAU;QACV,yBAAyB;QACzB,0CAA0C;QAC1C,WAAW;QACX;YACE,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAC;KAC1D;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,KAAK,UAAU,aAAa;IAC1B,IAAI,YAAY,GAAG,EAAE,CAAC;IACtB,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,MAAkB,EAAE,EAAE;QAC7C,IAAI;YACF,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;SAC3B;QAAC,OAAO,CAAC,EAAE;YACV,YAAY,IAAI,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC;SAClC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,YAAY,CAAC;AACtB,CAAC;AA3EC,sCAAa"}