@l-v-yonsama/multi-platform-database-drivers 0.1.5 → 0.1.7

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 (112) hide show
  1. package/built/src/db/drivers/index.d.ts +5 -0
  2. package/built/src/db/drivers/index.js +9 -0
  3. package/built/src/db/drivers/index.js.map +1 -0
  4. package/built/src/db/index.d.ts +4 -0
  5. package/built/src/db/index.js +8 -0
  6. package/built/src/db/index.js.map +1 -0
  7. package/built/src/db/resource/index.d.ts +5 -0
  8. package/built/src/db/resource/index.js +9 -0
  9. package/built/src/db/resource/index.js.map +1 -0
  10. package/built/src/db/resource/types/index.d.ts +7 -0
  11. package/built/src/db/resource/types/index.js +11 -0
  12. package/built/src/db/resource/types/index.js.map +1 -0
  13. package/built/src/main.d.ts +3 -0
  14. package/built/src/main.js +7 -0
  15. package/built/src/main.js.map +1 -0
  16. package/built/src/types/index.d.ts +2 -0
  17. package/built/src/types/index.js +6 -0
  18. package/built/src/types/index.js.map +1 -0
  19. package/built/src/util/index.d.ts +1 -0
  20. package/built/src/util/index.js +5 -0
  21. package/built/src/util/index.js.map +1 -0
  22. package/package.json +5 -4
  23. package/build/__tests__/db/drivers/AwsS3Driver.test.d.ts +0 -1
  24. package/build/__tests__/db/drivers/AwsS3Driver.test.js +0 -83
  25. package/build/__tests__/db/drivers/AwsS3Driver.test.js.map +0 -1
  26. package/build/__tests__/db/drivers/MySQLDriver.test.d.ts +0 -1
  27. package/build/__tests__/db/drivers/MySQLDriver.test.js +0 -115
  28. package/build/__tests__/db/drivers/MySQLDriver.test.js.map +0 -1
  29. package/build/__tests__/db/drivers/PostgresDriver.test.d.ts +0 -1
  30. package/build/__tests__/db/drivers/PostgresDriver.test.js +0 -112
  31. package/build/__tests__/db/drivers/PostgresDriver.test.js.map +0 -1
  32. package/build/__tests__/db/drivers/RedisDriver.test.d.ts +0 -1
  33. package/build/__tests__/db/drivers/RedisDriver.test.js +0 -106
  34. package/build/__tests__/db/drivers/RedisDriver.test.js.map +0 -1
  35. package/build/src/main.d.ts +0 -0
  36. package/build/src/main.js +0 -3
  37. package/build/src/main.js.map +0 -1
  38. /package/{build → built}/src/db/DBError.d.ts +0 -0
  39. /package/{build → built}/src/db/DBError.js +0 -0
  40. /package/{build → built}/src/db/DBError.js.map +0 -0
  41. /package/{build → built}/src/db/drivers/AwsS3Driver.d.ts +0 -0
  42. /package/{build → built}/src/db/drivers/AwsS3Driver.js +0 -0
  43. /package/{build → built}/src/db/drivers/AwsS3Driver.js.map +0 -0
  44. /package/{build → built}/src/db/drivers/BaseDriver.d.ts +0 -0
  45. /package/{build → built}/src/db/drivers/BaseDriver.js +0 -0
  46. /package/{build → built}/src/db/drivers/BaseDriver.js.map +0 -0
  47. /package/{build → built}/src/db/drivers/MySQLDriver.d.ts +0 -0
  48. /package/{build → built}/src/db/drivers/MySQLDriver.js +0 -0
  49. /package/{build → built}/src/db/drivers/MySQLDriver.js.map +0 -0
  50. /package/{build → built}/src/db/drivers/PostgresDriver.d.ts +0 -0
  51. /package/{build → built}/src/db/drivers/PostgresDriver.js +0 -0
  52. /package/{build → built}/src/db/drivers/PostgresDriver.js.map +0 -0
  53. /package/{build → built}/src/db/drivers/RedisDriver.d.ts +0 -0
  54. /package/{build → built}/src/db/drivers/RedisDriver.js +0 -0
  55. /package/{build → built}/src/db/drivers/RedisDriver.js.map +0 -0
  56. /package/{build → built}/src/db/manager.d.ts +0 -0
  57. /package/{build → built}/src/db/manager.js +0 -0
  58. /package/{build → built}/src/db/manager.js.map +0 -0
  59. /package/{build → built}/src/db/resource/DbResource.d.ts +0 -0
  60. /package/{build → built}/src/db/resource/DbResource.js +0 -0
  61. /package/{build → built}/src/db/resource/DbResource.js.map +0 -0
  62. /package/{build → built}/src/db/resource/MultipleResultSetDataHolder.d.ts +0 -0
  63. /package/{build → built}/src/db/resource/MultipleResultSetDataHolder.js +0 -0
  64. /package/{build → built}/src/db/resource/MultipleResultSetDataHolder.js.map +0 -0
  65. /package/{build → built}/src/db/resource/ResourceUtil.d.ts +0 -0
  66. /package/{build → built}/src/db/resource/ResourceUtil.js +0 -0
  67. /package/{build → built}/src/db/resource/ResourceUtil.js.map +0 -0
  68. /package/{build → built}/src/db/resource/ResultSetDataHolder.d.ts +0 -0
  69. /package/{build → built}/src/db/resource/ResultSetDataHolder.js +0 -0
  70. /package/{build → built}/src/db/resource/ResultSetDataHolder.js.map +0 -0
  71. /package/{build → built}/src/db/resource/types/DBType.d.ts +0 -0
  72. /package/{build → built}/src/db/resource/types/DBType.js +0 -0
  73. /package/{build → built}/src/db/resource/types/DBType.js.map +0 -0
  74. /package/{build → built}/src/db/resource/types/GeneralColumnType.d.ts +0 -0
  75. /package/{build → built}/src/db/resource/types/GeneralColumnType.js +0 -0
  76. /package/{build → built}/src/db/resource/types/GeneralColumnType.js.map +0 -0
  77. /package/{build → built}/src/db/resource/types/MySQLColumnType.d.ts +0 -0
  78. /package/{build → built}/src/db/resource/types/MySQLColumnType.js +0 -0
  79. /package/{build → built}/src/db/resource/types/MySQLColumnType.js.map +0 -0
  80. /package/{build → built}/src/db/resource/types/ODBCVendorType.d.ts +0 -0
  81. /package/{build → built}/src/db/resource/types/ODBCVendorType.js +0 -0
  82. /package/{build → built}/src/db/resource/types/ODBCVendorType.js.map +0 -0
  83. /package/{build → built}/src/db/resource/types/PostgresColumnType.d.ts +0 -0
  84. /package/{build → built}/src/db/resource/types/PostgresColumnType.js +0 -0
  85. /package/{build → built}/src/db/resource/types/PostgresColumnType.js.map +0 -0
  86. /package/{build → built}/src/db/resource/types/RedisKeyType.d.ts +0 -0
  87. /package/{build → built}/src/db/resource/types/RedisKeyType.js +0 -0
  88. /package/{build → built}/src/db/resource/types/RedisKeyType.js.map +0 -0
  89. /package/{build → built}/src/db/resource/types/ResourceType.d.ts +0 -0
  90. /package/{build → built}/src/db/resource/types/ResourceType.js +0 -0
  91. /package/{build → built}/src/db/resource/types/ResourceType.js.map +0 -0
  92. /package/{build → built}/src/service/request/general_db_request.d.ts +0 -0
  93. /package/{build → built}/src/service/request/general_db_request.js +0 -0
  94. /package/{build → built}/src/service/request/general_db_request.js.map +0 -0
  95. /package/{build → built}/src/service/request/redis_request.d.ts +0 -0
  96. /package/{build → built}/src/service/request/redis_request.js +0 -0
  97. /package/{build → built}/src/service/request/redis_request.js.map +0 -0
  98. /package/{build → built}/src/service/request/s3_request.d.ts +0 -0
  99. /package/{build → built}/src/service/request/s3_request.js +0 -0
  100. /package/{build → built}/src/service/request/s3_request.js.map +0 -0
  101. /package/{build → built}/src/service/response/GeneralReponse.d.ts +0 -0
  102. /package/{build → built}/src/service/response/GeneralReponse.js +0 -0
  103. /package/{build → built}/src/service/response/GeneralReponse.js.map +0 -0
  104. /package/{build → built}/src/types/DateModifiedType.d.ts +0 -0
  105. /package/{build → built}/src/types/DateModifiedType.js +0 -0
  106. /package/{build → built}/src/types/DateModifiedType.js.map +0 -0
  107. /package/{build → built}/src/types/FileKindType.d.ts +0 -0
  108. /package/{build → built}/src/types/FileKindType.js +0 -0
  109. /package/{build → built}/src/types/FileKindType.js.map +0 -0
  110. /package/{build → built}/src/util/file_util.d.ts +0 -0
  111. /package/{build → built}/src/util/file_util.js +0 -0
  112. /package/{build → built}/src/util/file_util.js.map +0 -0
@@ -0,0 +1,5 @@
1
+ export * from './AwsS3Driver';
2
+ export * from './BaseDriver';
3
+ export * from './MySQLDriver';
4
+ export * from './PostgresDriver';
5
+ export * from './RedisDriver';
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./AwsS3Driver"), exports);
5
+ tslib_1.__exportStar(require("./BaseDriver"), exports);
6
+ tslib_1.__exportStar(require("./MySQLDriver"), exports);
7
+ tslib_1.__exportStar(require("./PostgresDriver"), exports);
8
+ tslib_1.__exportStar(require("./RedisDriver"), exports);
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/db/drivers/index.ts"],"names":[],"mappings":";;;AAAA,wDAA8B;AAC9B,uDAA6B;AAC7B,wDAA8B;AAC9B,2DAAiC;AACjC,wDAA8B"}
@@ -0,0 +1,4 @@
1
+ export * from './DBError';
2
+ export * from './manager';
3
+ export * from './drivers';
4
+ export * from './resource';
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./DBError"), exports);
5
+ tslib_1.__exportStar(require("./manager"), exports);
6
+ tslib_1.__exportStar(require("./drivers"), exports);
7
+ tslib_1.__exportStar(require("./resource"), exports);
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/db/index.ts"],"names":[],"mappings":";;;AAAA,oDAA0B;AAC1B,oDAA0B;AAC1B,oDAA0B;AAC1B,qDAA2B"}
@@ -0,0 +1,5 @@
1
+ export * from './types';
2
+ export * from './DbResource';
3
+ export * from './MultipleResultSetDataHolder';
4
+ export * from './ResultSetDataHolder';
5
+ export * from './ResourceUtil';
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./types"), exports);
5
+ tslib_1.__exportStar(require("./DbResource"), exports);
6
+ tslib_1.__exportStar(require("./MultipleResultSetDataHolder"), exports);
7
+ tslib_1.__exportStar(require("./ResultSetDataHolder"), exports);
8
+ tslib_1.__exportStar(require("./ResourceUtil"), exports);
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/db/resource/index.ts"],"names":[],"mappings":";;;AAAA,kDAAwB;AACxB,uDAA6B;AAC7B,wEAA8C;AAC9C,gEAAsC;AACtC,yDAA+B"}
@@ -0,0 +1,7 @@
1
+ export * from './DBType';
2
+ export * from './GeneralColumnType';
3
+ export * from './MySQLColumnType';
4
+ export * from './ODBCVendorType';
5
+ export * from './PostgresColumnType';
6
+ export * from './RedisKeyType';
7
+ export * from './ResourceType';
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./DBType"), exports);
5
+ tslib_1.__exportStar(require("./GeneralColumnType"), exports);
6
+ tslib_1.__exportStar(require("./MySQLColumnType"), exports);
7
+ tslib_1.__exportStar(require("./ODBCVendorType"), exports);
8
+ tslib_1.__exportStar(require("./PostgresColumnType"), exports);
9
+ tslib_1.__exportStar(require("./RedisKeyType"), exports);
10
+ tslib_1.__exportStar(require("./ResourceType"), exports);
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/db/resource/types/index.ts"],"names":[],"mappings":";;;AAAA,mDAAyB;AACzB,8DAAoC;AACpC,4DAAkC;AAClC,2DAAiC;AACjC,+DAAqC;AACrC,yDAA+B;AAC/B,yDAA+B"}
@@ -0,0 +1,3 @@
1
+ export * from './db';
2
+ export * from './types';
3
+ export * from './util';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./db"), exports);
5
+ tslib_1.__exportStar(require("./types"), exports);
6
+ tslib_1.__exportStar(require("./util"), exports);
7
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":";;;AAAA,+CAAqB;AACrB,kDAAwB;AACxB,iDAAuB"}
@@ -0,0 +1,2 @@
1
+ export * from './DateModifiedType';
2
+ export * from './FileKindType';
@@ -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("./DateModifiedType"), exports);
5
+ tslib_1.__exportStar(require("./FileKindType"), exports);
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":";;;AAAA,6DAAmC;AACnC,yDAA+B"}
@@ -0,0 +1 @@
1
+ export * from './file_util';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./file_util"), exports);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/util/index.ts"],"names":[],"mappings":";;;AAAA,sDAA4B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@l-v-yonsama/multi-platform-database-drivers",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "multi-platform database drivers in TypeScript.",
5
5
  "type": "module",
6
6
  "engines": {
@@ -23,8 +23,8 @@
23
23
  "typescript": "~4.9"
24
24
  },
25
25
  "scripts": {
26
- "start": "node build/src/main.js",
27
- "clean": "rimraf coverage build tmp",
26
+ "start": "node built/src/main.js",
27
+ "clean": "rimraf coverage built tmp",
28
28
  "prebuild": "npm run lint",
29
29
  "build": "tsc -p tsconfig.json",
30
30
  "build:watch": "tsc -w -p tsconfig.json",
@@ -63,8 +63,9 @@
63
63
  "volta": {
64
64
  "node": "18.12.1"
65
65
  },
66
+ "main": "built/src/index.js",
66
67
  "files": [
67
- "build"
68
+ "built/src"
68
69
  ],
69
70
  "repository": {
70
71
  "type": "git",
@@ -1 +0,0 @@
1
- export {};
@@ -1,83 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const AwsS3Driver_1 = require("../../../src/db/drivers/AwsS3Driver");
4
- const DbResource_1 = require("../../../src/db/resource/DbResource");
5
- const DBType_1 = require("../../../src/db/resource/types/DBType");
6
- const connectOption = {
7
- port: 6003,
8
- user: 'testuser',
9
- password: 'testpass',
10
- url: 'http://127.0.0.1:6003',
11
- region: 'us-west-1',
12
- };
13
- describe('AwsS3Driver', () => {
14
- let driver;
15
- const bucket = 'testbucket';
16
- beforeAll(async () => {
17
- driver = createDriver();
18
- await driver.asyncConnect();
19
- try {
20
- await driver.removeBucket({ bucket });
21
- }
22
- catch (e) {
23
- // The specified bucket does not exist
24
- // console.error('error:' + e.message);
25
- }
26
- await driver.createBucket({ bucket });
27
- await driver.putObject({ bucket, key: 'text/abc.txt', body: 'abc' });
28
- await driver.putObject({
29
- bucket,
30
- key: 'text/folder/abc.txt',
31
- body: 'abc',
32
- });
33
- await driver.putObject({ bucket, key: 'text/empty.txt', body: '' });
34
- });
35
- afterAll(async () => {
36
- await driver.asyncClose();
37
- });
38
- describe('getName', () => {
39
- it('should return constructor name', () => {
40
- expect(driver.getName()).toBe('AwsS3Driver');
41
- });
42
- });
43
- describe('asyncGetResouces', () => {
44
- let testDbRes;
45
- let testBucketRes;
46
- it('should return Database resource', async () => {
47
- const dbRootRes = await driver.getResouces({});
48
- expect(dbRootRes).toHaveLength(1);
49
- testDbRes = dbRootRes[0];
50
- expect(testDbRes.getName()).toBe('S3');
51
- });
52
- it('should have DbS3Bucket resource', async () => {
53
- testBucketRes = testDbRes.getChildByName(bucket);
54
- expect(testBucketRes.getName()).toBe(bucket);
55
- });
56
- it('should have DbS3Owner resource', async () => {
57
- const owner = testDbRes.getChildByName('minio');
58
- expect(owner.getName()).toBe('minio');
59
- });
60
- it('should have values', async () => {
61
- const textValue = await driver.getValueByKey({
62
- bucket,
63
- key: 'text/abc.txt',
64
- });
65
- expect(textValue).toBe('abc');
66
- const textValue2 = await driver.getValueByKey({
67
- bucket,
68
- key: 'text/folder/abc.txt',
69
- });
70
- expect(textValue2).toBe('abc');
71
- const textValue3 = await driver.getValueByKey({
72
- bucket,
73
- key: 'text/empty.txt',
74
- });
75
- expect(textValue3).toBe('');
76
- });
77
- });
78
- function createDriver() {
79
- const con = new DbResource_1.DbConnection(Object.assign(Object.assign({}, connectOption), { db_type: DBType_1.DBType.Minio }));
80
- return new AwsS3Driver_1.default(con);
81
- }
82
- });
83
- //# sourceMappingURL=AwsS3Driver.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AwsS3Driver.test.js","sourceRoot":"","sources":["../../../../__tests__/db/drivers/AwsS3Driver.test.ts"],"names":[],"mappings":";;AAAA,qEAA8D;AAC9D,oEAK6C;AAC7C,kEAA+D;AAE/D,MAAM,aAAa,GAAG;IACpB,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,UAAU;IAChB,QAAQ,EAAE,UAAU;IACpB,GAAG,EAAE,uBAAuB;IAC5B,MAAM,EAAE,WAAW;CACpB,CAAC;AAEF,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,IAAI,MAAmB,CAAC;IACxB,MAAM,MAAM,GAAG,YAAY,CAAC;IAE5B,SAAS,CAAC,KAAK,IAAI,EAAE;QACnB,MAAM,GAAG,YAAY,EAAE,CAAC;QACxB,MAAM,MAAM,CAAC,YAAY,EAAE,CAAC;QAC5B,IAAI;YACF,MAAM,MAAM,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;SACvC;QAAC,OAAO,CAAC,EAAE;YACV,sCAAsC;YACtC,uCAAuC;SACxC;QACD,MAAM,MAAM,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;QACtC,MAAM,MAAM,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QACrE,MAAM,MAAM,CAAC,SAAS,CAAC;YACrB,MAAM;YACN,GAAG,EAAE,qBAAqB;YAC1B,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;QACH,MAAM,MAA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AAC;YAC7D,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,oBAAoB,EAAE,KAAK,IAAI,EAAE;YAClC,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC;gBAC3C,MAAM;gBACN,GAAG,EAAE,cAAc;aACpB,CAAC,CAAC;YACH,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAE9B,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC;gBAC5C,MAAM;gBACN,GAAG,EAAE,qBAAqB;aAC3B,CAAC,CAAC;YACH,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAE/B,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC;gBAC5C,MAAM;gBACN,GAAG,EAAE,gBAAgB;aACtB,CAAC,CAAC;YACH,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,SAAS,YAAY;QACnB,MAAM,GAAG,GAAG,IAAI,yBAAY,iCAAM,aAAa,KAAE,OAAO,EAAE,eAAM,CAAC,KAAK,IAAG,CAAC;QAC1E,OAAO,IAAI,qBAAW,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,115 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const MySQLDriver_1 = require("../../../src/db/drivers/MySQLDriver");
4
- const DbResource_1 = require("../../../src/db/resource/DbResource");
5
- const DBType_1 = require("../../../src/db/resource/types/DBType");
6
- const mysql = require("mysql2/promise");
7
- const GeneralColumnType_1 = require("../../../src/db/resource/types/GeneralColumnType");
8
- const baseConnectOption = {
9
- host: '127.0.0.1',
10
- port: 6001,
11
- user: 'testuser',
12
- password: 'testpass',
13
- database: 'testdb',
14
- };
15
- const connectOption = Object.assign(Object.assign({}, baseConnectOption), { db_type: DBType_1.DBType.MySQL, enviroment: 'ut' });
16
- const CREATE_TABLE_STATEMENT = `
17
- CREATE TABLE testtable (
18
- ID int auto_increment PRIMARY KEY,
19
- n0 BIT,
20
- n1 TINYINT COMMENT 'MAX 127',
21
- n2 SMALLINT COMMENT 'MAX 32767',
22
- n3 MEDIUMINT COMMENT 'MAX 8388607',
23
- n4 BIGINT COMMENT 'MAX 9223372036854775807',
24
- f1 DECIMAL(6,4),
25
- f2 FLOAT,
26
- f3 DOUBLE,
27
-
28
- d1 DATE COMMENT '“Zero” Value 0000-00-00',
29
- d2 TIME COMMENT '“Zero” Value 00:00:00',
30
- d3 DATETIME COMMENT '“Zero” Value 0000-00-00 00:00:00',
31
- d4 TIMESTAMP COMMENT '“Zero” Value 0000-00-00 00:00:00',
32
- d5 YEAR COMMENT '“Zero” Value 0000',
33
-
34
- s1 CHAR(10),
35
- s2 VARCHAR(10),
36
- s3 TEXT,
37
- s4 ENUM('a','b','c') COMMENT 'A list of a,b or c',
38
- s5 BINARY(10),
39
- s6 VARBINARY(10),
40
- s7 BLOB,
41
- s8 SET('a','b','c'),
42
-
43
- g1 geometry NOT NULL,
44
-
45
- j1 JSON COMMENT 'JSON data type'
46
-
47
- ) COMMENT='table with various data types'
48
- `;
49
- describe('MySQLDriver', () => {
50
- let driver;
51
- let conRes;
52
- let con;
53
- beforeAll(async () => {
54
- driver = createDriver();
55
- con = await mysql.createConnection(baseConnectOption);
56
- await con.connect();
57
- await con.execute('DROP TABLE IF EXISTS testtable');
58
- await con.execute(CREATE_TABLE_STATEMENT);
59
- });
60
- afterAll(async () => {
61
- await driver.asyncClose();
62
- con.destroy();
63
- });
64
- it('asyncConnect', async () => {
65
- expect(await driver.asyncConnect()).toBe('');
66
- });
67
- describe('getName', () => {
68
- it('should return constructor name', () => {
69
- expect(driver.getName()).toBe('MySQLDriver');
70
- });
71
- });
72
- describe('asyncGetResouces', () => {
73
- let testDbRes;
74
- let testSchemaRes;
75
- let testTableRes;
76
- it('should return Database resource', async () => {
77
- const dbRootRes = await driver.getResouces({});
78
- expect(dbRootRes).toHaveLength(1);
79
- testDbRes = dbRootRes[0];
80
- expect(testDbRes.getName()).toBe(driver.getConnectionRes().database);
81
- });
82
- it('should have Schema resource', async () => {
83
- expect(testDbRes.getChildren()).toHaveLength(1);
84
- testSchemaRes = testDbRes.getChildren()[0];
85
- expect(testSchemaRes.getName()).toBe('testdb');
86
- });
87
- it('should have Table resource', async () => {
88
- testTableRes = testSchemaRes.getChildByName('testtable');
89
- expect(testTableRes.getName()).toBe('testtable');
90
- expect(testTableRes.table_type).toBe('TABLE');
91
- expect(testTableRes.comment).toBe('table with various data types');
92
- });
93
- it('should have Column resource', async () => {
94
- // ID
95
- const idRes = testTableRes.getChildByName('ID');
96
- expect(idRes.col_type).toBe(GeneralColumnType_1.GeneralColumnType.INTEGER);
97
- expect(idRes.nullable).toBe(false);
98
- expect(idRes.key).toBe('PRI');
99
- expect(idRes.extra).toBe('auto_increment');
100
- // n0
101
- const n0Res = testTableRes.getChildByName('n0');
102
- expect(n0Res.col_type).toBe(GeneralColumnType_1.GeneralColumnType.BIT);
103
- expect(n0Res.nullable).toBe(true);
104
- // n1
105
- const n1Res = testTableRes.getChildByName('n1');
106
- expect(n1Res.col_type).toBe(GeneralColumnType_1.GeneralColumnType.TINYINT);
107
- expect(n1Res.nullable).toBe(true);
108
- });
109
- });
110
- function createDriver() {
111
- conRes = new DbResource_1.DbConnection(connectOption);
112
- return new MySQLDriver_1.default(conRes);
113
- }
114
- });
115
- //# sourceMappingURL=MySQLDriver.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MySQLDriver.test.js","sourceRoot":"","sources":["../../../../__tests__/db/drivers/MySQLDriver.test.ts"],"names":[],"mappings":";;AAAA,qEAA8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AAC,MAAM,CAAC,CAAC;IACjC,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,112 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const PostgresDriver_1 = require("../../../src/db/drivers/PostgresDriver");
4
- const DbResource_1 = require("../../../src/db/resource/DbResource");
5
- const DBType_1 = require("../../../src/db/resource/types/DBType");
6
- const pg_1 = require("pg");
7
- const GeneralColumnType_1 = require("../../../src/db/resource/types/GeneralColumnType");
8
- const baseConnectOption = {
9
- host: '127.0.0.1',
10
- port: 6002,
11
- user: 'testuser',
12
- password: 'testpass',
13
- database: 'testdb',
14
- };
15
- const connectOption = Object.assign(Object.assign({}, baseConnectOption), { db_type: DBType_1.DBType.Postgres, enviroment: 'ut' });
16
- const CREATE_TABLE_STATEMENT = `
17
- CREATE TABLE testtable (
18
- ID SERIAL NOT NULL PRIMARY KEY,
19
- n0 BIT,
20
- n1 INT,
21
- n2 BIGINT,
22
- n3 SMALLSERIAL,
23
- n4 BIGSERIAL,
24
- f1 NUMERIC(6,4),
25
- f2 DOUBLE PRECISION,
26
- f3 REAL,
27
-
28
- d1 DATE,
29
- d2 TIME,
30
- d3 TIMESTAMP,
31
- d4 TIMESTAMP WITH TIME ZONE,
32
- d5 INTERVAL YEAR,
33
-
34
- s1 CHAR(10),
35
- s2 VARCHAR(10),
36
- s3 TEXT,
37
- s4 mood,
38
- s5 BYTEA,
39
- s6 uuid,
40
-
41
- j1 JSON
42
-
43
- )`;
44
- describe('PostgresDriver', () => {
45
- let driver;
46
- let conRes;
47
- let client;
48
- beforeAll(async () => {
49
- driver = createDriver();
50
- client = new pg_1.default.Client(baseConnectOption);
51
- await client.connect();
52
- await client.query('DROP TABLE IF EXISTS testtable');
53
- await client.query('DROP TYPE IF EXISTS mood');
54
- await client.query("CREATE TYPE mood AS ENUM ('sad', 'ok', 'happy')");
55
- await client.query(CREATE_TABLE_STATEMENT);
56
- await client.query("COMMENT ON TABLE testtable IS 'table with various data types'");
57
- });
58
- afterAll(async () => {
59
- await driver.asyncClose();
60
- client.end();
61
- });
62
- it('asyncConnect', async () => {
63
- expect(await driver.asyncConnect()).toBe('');
64
- });
65
- describe('getName', () => {
66
- it('should return constructor name', () => {
67
- expect(driver.getName()).toBe('PostgresDriver');
68
- });
69
- });
70
- describe('asyncGetResouces', () => {
71
- let testDbRes;
72
- let testSchemaRes;
73
- let testTableRes;
74
- it('should return Database resource', async () => {
75
- const dbRootRes = await driver.getResouces({});
76
- testDbRes = dbRootRes.find((it) => it.name === 'testdb');
77
- expect(testDbRes.getName()).toBe(driver.getConnectionRes().database);
78
- });
79
- it('should have Schema resource', async () => {
80
- expect(testDbRes.getChildren()).toHaveLength(1);
81
- testSchemaRes = testDbRes.getChildren()[0];
82
- expect(testSchemaRes.getName()).toBe('public');
83
- });
84
- it('should have Table resource', async () => {
85
- testTableRes = testSchemaRes.getChildByName('testtable');
86
- expect(testTableRes.getName()).toBe('testtable');
87
- expect(testTableRes.table_type).toBe('TABLE');
88
- expect(testTableRes.comment).toBe('table with various data types');
89
- });
90
- it('should have Column resource', async () => {
91
- // ID
92
- const idRes = testTableRes.getChildByName('ID');
93
- expect(idRes.col_type).toBe(GeneralColumnType_1.GeneralColumnType.INTEGER);
94
- expect(idRes.nullable).toBe(false);
95
- expect(idRes.key).toBe('PRI');
96
- expect(idRes.default).toContain('nextval');
97
- // n0
98
- const n0Res = testTableRes.getChildByName('n0');
99
- expect(n0Res.col_type).toBe(GeneralColumnType_1.GeneralColumnType.BIT);
100
- expect(n0Res.nullable).toBe(true);
101
- // n1
102
- const n1Res = testTableRes.getChildByName('n1');
103
- expect(n1Res.col_type).toBe(GeneralColumnType_1.GeneralColumnType.INTEGER);
104
- expect(n1Res.nullable).toBe(true);
105
- });
106
- });
107
- function createDriver() {
108
- conRes = new DbResource_1.DbConnection(connectOption);
109
- return new PostgresDriver_1.default(conRes);
110
- }
111
- });
112
- //# sourceMappingURL=PostgresDriver.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PostgresDriver.test.js","sourceRoot":"","sources":["../../../../__tests__/db/drivers/PostgresDriver.test.ts"],"names":[],"mappings":";;AAAA,2EAAoE;AACpE,oEAM6C;AAC7C,kEAA+D;AAC/D,2BAAmC;AACnC,wFAAqF;AAErF,MAAM,iBAAiB,GAAG;IACxB,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,UAAU;IAChB,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,QAAQ;CACnB,CAAC;AACF,MAAM,aAAa,mCACd,iBAAiB,KACpB,OAAO,EAAE,eAAM,CAAC,QAAQ,EACxB,UAAU,EAAE,IAAI,GACjB,CAAC;AAEF,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2B7B,CAAC;AAEH,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,IAAI,MAAsB,CAAC;IAC3B,IAAI,MAAoB,CAAC;IACzB,IAAI,MAAiB,CAAC;IAEtB,SAAS,CAAC,KAAK,IAAI,EAAE;QACnB,MAAM,GAAG,YAAY,EAAE,CAAC;QAExB,MAAM,GAAG,IAAI,YAAE,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAE1C,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;QAEvB,MAAM,MAAM,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;QACrD,MAAM,MAAM,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC/C,MAAM,MAAM,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAAC;QAEtE,MAAM,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAE3C,MAAM,MAAM,CAAC,KAAK,CAChB,+DAA+D,CAChE,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,KAAK,IAAI,EAAE;QAClB,MAAM,MAAM,CAAC,UAAU,EAAE,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AAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,qCAAiB,CAAC,OAAO,CAAC,CAAC;YACvD,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,SAAS,YAAY;QACnB,MAAM,GAAG,IAAI,yBAAY,CAAC,aAAa,CAAC,CAAC;QACzC,OAAO,IAAI,wBAAc,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,106 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const RedisDriver_1 = require("../../../src/db/drivers/RedisDriver");
4
- const ioredis_1 = require("ioredis");
5
- const DbResource_1 = require("../../../src/db/resource/DbResource");
6
- const redis_request_1 = require("../../../src/service/request/redis_request");
7
- const RedisKeyType_1 = require("../../../src/db/resource/types/RedisKeyType");
8
- const connectOption = {
9
- port: 6000,
10
- host: '127.0.0.1',
11
- password: 'testpass',
12
- };
13
- describe('RedisDriver', () => {
14
- let redisClient;
15
- let driver;
16
- beforeAll(async () => {
17
- redisClient = new ioredis_1.Redis(Object.assign(Object.assign({}, connectOption), { db: 0 }));
18
- driver = createDriver();
19
- await redisClient.flushall();
20
- await redisClient.set('s1', 'text', 'EX', 100);
21
- const user = {
22
- name: 'Bob',
23
- // The value of a Redis key can not be a number.
24
- // We can write `age: 20` here but ioredis will convert it to a string anyway.
25
- age: '20',
26
- description: 'I am a programmer',
27
- };
28
- await redisClient.mset(user);
29
- await redisClient.hmset('user-hash', user);
30
- await redisClient.zadd('sortedSet', 1, 'one', 2, 'dos', 4, 'quatro', 3, 'three');
31
- await redisClient.set('n1', 1);
32
- await redisClient.rpush('list3', '1', '2', '3');
33
- });
34
- afterAll(async () => {
35
- await redisClient.quit();
36
- await driver.asyncClose();
37
- });
38
- it('asyncConnect', async () => {
39
- expect(await driver.asyncConnect()).toBe('');
40
- });
41
- describe('getName', () => {
42
- it('should return constructor name', () => {
43
- expect(driver.getName()).toBe('RedisDriver');
44
- });
45
- });
46
- describe('asyncGetResouces', () => {
47
- let testRedisDb0Res;
48
- it('should return Database resource', async () => {
49
- const dbRootRes = await driver.getResouces({});
50
- expect(dbRootRes).toHaveLength(16);
51
- testRedisDb0Res = dbRootRes[0];
52
- expect(testRedisDb0Res.getName()).toBe(driver.getConnectionRes().database);
53
- });
54
- });
55
- describe('asyncScan', () => {
56
- it('should return values', async () => {
57
- const keys = await driver.scan(0, '*', 1000, true,
58
- // eslint-disable-next-line @typescript-eslint/no-empty-function
59
- () => { });
60
- let key = keys.find((it) => it.name === 'n1');
61
- expect(key.val).toBe('1');
62
- expect(key.type).toBe(RedisKeyType_1.RedisKeyType.string);
63
- expect(key.ttl).toBe(-1);
64
- key = keys.find((it) => it.name === 'age');
65
- expect(key.val).toBe('20');
66
- expect(key.type).toBe(RedisKeyType_1.RedisKeyType.string);
67
- key = keys.find((it) => it.name === 'name');
68
- expect(key.val).toBe('Bob');
69
- expect(key.type).toBe(RedisKeyType_1.RedisKeyType.string);
70
- key = keys.find((it) => it.name === 'description');
71
- expect(key.val).toBe('I am a programmer');
72
- expect(key.type).toBe(RedisKeyType_1.RedisKeyType.string);
73
- key = keys.find((it) => it.name === 'user-hash');
74
- expect(key.val).toEqual({
75
- name: 'Bob',
76
- age: '20',
77
- description: 'I am a programmer',
78
- });
79
- expect(key.type).toBe(RedisKeyType_1.RedisKeyType.hash);
80
- key = keys.find((it) => it.name === 'list3');
81
- expect(key.val).toEqual(['1', '2', '3']);
82
- expect(key.type).toBe(RedisKeyType_1.RedisKeyType.list);
83
- key = keys.find((it) => it.name === 'sortedSet');
84
- expect(key.val).toEqual(['one', 'dos', 'three', 'quatro']);
85
- expect(key.type).toBe(RedisKeyType_1.RedisKeyType.zset);
86
- });
87
- });
88
- describe('RedisCommandType.GetValue', () => {
89
- it('should return values', async () => {
90
- const key = (await driver.executeCommand(createRedisRequest(redis_request_1.RedisCommandType.GetValue, {
91
- key: 'n1',
92
- type: RedisKeyType_1.RedisKeyType.string,
93
- })));
94
- expect(key.val).toBe('1');
95
- expect(key.ttl).toBe(-1);
96
- });
97
- });
98
- function createDriver() {
99
- const con = new DbResource_1.DbConnection(Object.assign(Object.assign({}, connectOption), { database: '0' }));
100
- return new RedisDriver_1.default(con);
101
- }
102
- function createRedisRequest(command, options) {
103
- return Object.assign({ connection_id: '1', index: 0, command }, options);
104
- }
105
- });
106
- //# sourceMappingURL=RedisDriver.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RedisDriver.test.js","sourceRoot":"","sources":["../../../../__tests__/db/drivers/RedisDriver.test.ts"],"names":[],"mappings":";;AAAA,qEAA8D;AAC9D,qCAA8C;AAC9C,oEAI6C;AAC7C,8EAGoD;AACpD,8EAA2E;AAE3E,MAAM,aAAa,GAAiB;IAClC,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,WAAW;IACjB,QAAQ,EAAE,UAAU;CACrB,CAAC;AAEF,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,IAAI,WAAkB,CAAC;IACvB,IAAI,MAAmB,CAAC;IAExB,SAAS,CAAC,KAAK,IAAI,EAAE;QACnB,WAAW,GAAG,IAAI,eAAK,iCAAM,aAAa,KAAE,EAAE,EAAE,CAAC,IAAG,CAAC;QACrD,MAAM,GAAG,YAAY,EAAE,CAAC;QACxB,MAAM,WAAW,CAAC,QAAQ,EAAE,CAAC;QAC7B,MAAM,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;QAC/C,MAAM,IAAI,GAAG;YACX,IAAI,EAAE,KAAK;YACX,gDAAgD;YAChD,8EAA8E;YAC9E,GAAG,EAAE,IAAI;YACT,WAAW,EAAE,mBAAmB;SACjC,CAAC;QAEF,MAAM,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC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AAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;YAC3D,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,2BAAY,CAAC,IAAI,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACzC,EAAE,CAAC,sBAAsB,EAAE,KAAK,IAAI,EAAE;YACpC,MAAM,GAAG,GAAG,CAAC,MAAM,MAAM,CAAC,cAAc,CACtC,kBAAkB,CAAC,gCAAgB,CAAC,QAAQ,EAAE;gBAC5C,GAAG,EAAE,IAAI;gBACT,IAAI,EAAE,2BAAY,CAAC,MAAM;aAC1B,CAAC,CACH,CAAU,CAAC;YACZ,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC1B,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,SAAS,YAAY;QACnB,MAAM,GAAG,GAAG,IAAI,yBAAY,iCAAM,aAAa,KAAE,QAAQ,EAAE,GAAG,IAAG,CAAC;QAClE,OAAO,IAAI,qBAAW,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;IAED,SAAS,kBAAkB,CACzB,OAAyB,EACzB,OAA8C;QAE9C,uBACE,aAAa,EAAE,GAAG,EAClB,KAAK,EAAE,CAAC,EACR,OAAO,IACJ,OAAO,EACV;IACJ,CAAC;AACH,CAAC,CAAC,CAAC"}
File without changes
package/build/src/main.js DELETED
@@ -1,3 +0,0 @@
1
- "use strict";
2
- console.log('hoge');
3
- //# sourceMappingURL=main.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":";AAAA,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes