tspace-mysql 1.3.0 → 1.3.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.
Files changed (56) hide show
  1. package/README.md +72 -14
  2. package/dist/cli/dump/db.d.ts +4 -4
  3. package/dist/cli/dump/db.js +25 -25
  4. package/dist/cli/generate/make.d.ts +4 -4
  5. package/dist/cli/generate/make.js +45 -45
  6. package/dist/cli/generate/model.d.ts +2 -2
  7. package/dist/cli/generate/model.js +6 -6
  8. package/dist/cli/index.d.ts +2 -2
  9. package/dist/cli/index.js +58 -58
  10. package/dist/cli/migrate/make.d.ts +4 -4
  11. package/dist/cli/migrate/make.js +30 -30
  12. package/dist/cli/models/make.d.ts +4 -4
  13. package/dist/cli/models/make.js +51 -51
  14. package/dist/cli/models/model.d.ts +2 -2
  15. package/dist/cli/models/model.js +20 -11
  16. package/dist/cli/query/index.d.ts +4 -4
  17. package/dist/cli/query/index.js +7 -7
  18. package/dist/cli/tables/make.d.ts +4 -4
  19. package/dist/cli/tables/make.js +26 -26
  20. package/dist/cli/tables/table.d.ts +2 -2
  21. package/dist/cli/tables/table.js +6 -6
  22. package/dist/lib/connection/index.d.ts +30 -30
  23. package/dist/lib/connection/index.js +144 -143
  24. package/dist/lib/connection/options.d.ts +15 -4
  25. package/dist/lib/connection/options.js +43 -42
  26. package/dist/lib/constants/index.d.ts +5 -8
  27. package/dist/lib/constants/index.js +162 -158
  28. package/dist/lib/index.d.ts +8 -8
  29. package/dist/lib/index.js +36 -36
  30. package/dist/lib/tspace/{AbstractDatabase.d.ts → AbstractBuilder.d.ts} +124 -116
  31. package/dist/lib/tspace/{AbstractDatabase.js → AbstractBuilder.js} +36 -34
  32. package/dist/lib/tspace/AbstractDB.d.ts +18 -18
  33. package/dist/lib/tspace/AbstractDB.js +11 -11
  34. package/dist/lib/tspace/AbstractModel.d.ts +43 -41
  35. package/dist/lib/tspace/AbstractModel.js +11 -11
  36. package/dist/lib/tspace/Blueprint.d.ts +136 -136
  37. package/dist/lib/tspace/Blueprint.js +228 -228
  38. package/dist/lib/tspace/{Database.d.ts → Builder.d.ts} +825 -706
  39. package/dist/lib/tspace/{Database.js → Builder.js} +2548 -2363
  40. package/dist/lib/tspace/DB.d.ts +152 -126
  41. package/dist/lib/tspace/DB.js +373 -264
  42. package/dist/lib/tspace/Interface.d.ts +110 -109
  43. package/dist/lib/tspace/Interface.js +2 -2
  44. package/dist/lib/tspace/Logger.d.ts +8 -8
  45. package/dist/lib/tspace/Logger.js +49 -49
  46. package/dist/lib/tspace/Model.d.ts +708 -609
  47. package/dist/lib/tspace/Model.js +2519 -2477
  48. package/dist/lib/tspace/ProxyHandler.d.ts +14 -14
  49. package/dist/lib/tspace/ProxyHandler.js +31 -31
  50. package/dist/lib/tspace/Schema.d.ts +8 -8
  51. package/dist/lib/tspace/Schema.js +45 -44
  52. package/dist/lib/tspace/index.d.ts +15 -15
  53. package/dist/lib/tspace/index.js +20 -20
  54. package/dist/lib/utils/index.d.ts +15 -15
  55. package/dist/lib/utils/index.js +155 -165
  56. package/package.json +2 -4
@@ -1,126 +1,152 @@
1
- import { AbstractDB } from './AbstractDB';
2
- import { Connection, ConnectionOptions, ConnectionTransaction } from './Interface';
3
- declare class DB extends AbstractDB {
4
- constructor(table?: string);
5
- /**
6
- * Assign table name
7
- * @param {string} table table name
8
- * @return {this} this
9
- */
10
- table(table: string): this;
11
- /**
12
- * Get constant
13
- * @param {string} constant
14
- * @return {string | object} string || object
15
- */
16
- constants(constant?: string): string | {
17
- [key: string]: any;
18
- };
19
- /**
20
- * cases query
21
- * @param {arrayObject} cases array object {when , then }
22
- * @param {string?} final else condition
23
- * @return {string} string
24
- */
25
- caseUpdate(cases: {
26
- when: string;
27
- then: string;
28
- }[], final?: string): string | [];
29
- /**
30
- * generate UUID
31
- * @return {string} string
32
- */
33
- generateUUID(): string;
34
- /**
35
- * Assign raw query for schema validation
36
- * @param {string} sql
37
- * @return {string} string
38
- */
39
- raw(sql: string): string;
40
- /**
41
- * Get a pool connection
42
- * @param {Object} options options for connection database with credentials
43
- * @param {string} option.host
44
- * @param {number} option.port
45
- * @param {string} option.database
46
- * @param {string} option.username
47
- * @param {string} option.password
48
- * @return {Connection}
49
- */
50
- getConnection(options: ConnectionOptions): Connection;
51
- /**
52
- * Get a connection
53
- * @return {ConnectionTransaction} object
54
- * @type {object} connection
55
- * @property {function} connection.query - execute query sql then release connection to pool
56
- * @property {function} connection.startTransaction - start transaction of query
57
- * @property {function} connection.commit - commit transaction of query
58
- * @property {function} connection.rollback - rollback transaction of query
59
- */
60
- beginTransaction(): Promise<ConnectionTransaction>;
61
- /**
62
- * Assign table name
63
- * @static
64
- * @param {string} table table name
65
- * @return {DB} DB
66
- */
67
- static table(table: string): DB;
68
- /**
69
- * select by cases
70
- * @static
71
- * @param {arrayObject} cases array object {when , then }
72
- * @param {string?} final else condition
73
- * @return {this}
74
- */
75
- static caseUpdate(cases: {
76
- when: string;
77
- then: string;
78
- }[], final?: string): string | [];
79
- /**
80
- * Assign raw query for schema validation
81
- * @static
82
- * @param {string} sql
83
- * @return {string} string
84
- */
85
- static raw(sql: string): string;
86
- /**
87
- * generate UUID
88
- * @static
89
- * @return {string} string
90
- */
91
- static generateUUID(): string;
92
- /**
93
- * Get constant
94
- * @static
95
- * @param {string} constant
96
- * @return {string | object} string || object
97
- */
98
- static constants(constant?: string): string | {
99
- [key: string]: any;
100
- };
101
- /**
102
- * Get a connection
103
- * @static
104
- * @return {ConnectionTransaction} object
105
- * @type {object} connection
106
- * @property {function} connection.query - execute query sql then release connection to pool
107
- * @property {function} connection.startTransaction - start transaction of query
108
- * @property {function} connection.commit - commit transaction of query
109
- * @property {function} connection.rollback - rollback transaction of query
110
- */
111
- static beginTransaction(): Promise<ConnectionTransaction>;
112
- /**
113
- * Get a pool connection
114
- * @param {Object} options options for connection database with credentials
115
- * @param {string} option.host
116
- * @param {number} option.port
117
- * @param {string} option.database
118
- * @param {string} option.username
119
- * @param {string} option.password
120
- * @return {Connection}
121
- */
122
- static getConnection(options: ConnectionOptions): Connection;
123
- private _initialDB;
124
- }
125
- export { DB };
126
- export default DB;
1
+ import { AbstractDB } from './AbstractDB';
2
+ import { Connection, ConnectionOptions, ConnectionTransaction } from './Interface';
3
+ declare class DB extends AbstractDB {
4
+ constructor(table?: string);
5
+ union(a: string, b: string): Promise<any[]>;
6
+ /**
7
+ * Covert result to array
8
+ * @param {any} result table name
9
+ * @return {Array} array
10
+ */
11
+ makeArray(result: any): Array<any>;
12
+ /**
13
+ * Covert result to object or null
14
+ * @param {any} result table name
15
+ * @return {Record | null} object or null
16
+ */
17
+ makeObject(result: any): Record<string, any> | null;
18
+ /**
19
+ * Assign table name
20
+ * @param {string} table table name
21
+ * @return {this} this
22
+ */
23
+ table(table: string): this;
24
+ /**
25
+ * Get constant
26
+ * @param {string} constant
27
+ * @return {string | object} string || object
28
+ */
29
+ constants(constant?: string): string | {
30
+ [key: string]: any;
31
+ };
32
+ /**
33
+ * cases query
34
+ * @param {arrayObject} cases array object {when , then }
35
+ * @param {string?} final else condition
36
+ * @return {string} string
37
+ */
38
+ caseUpdate(cases: {
39
+ when: string;
40
+ then: string;
41
+ }[], final?: string): string | [];
42
+ /**
43
+ * generate UUID
44
+ * @return {string} string
45
+ */
46
+ generateUUID(): string;
47
+ /**
48
+ * Assign raw query for schema validation
49
+ * @param {string} sql
50
+ * @return {string} string
51
+ */
52
+ raw(sql: string): string;
53
+ /**
54
+ * Get a pool connection
55
+ * @param {Object} options options for connection database with credentials
56
+ * @param {string} option.host
57
+ * @param {number} option.port
58
+ * @param {string} option.database
59
+ * @param {string} option.username
60
+ * @param {string} option.password
61
+ * @return {Connection}
62
+ */
63
+ getConnection(options: ConnectionOptions): Connection;
64
+ /**
65
+ * Covert result to array
66
+ * @param {any} result table name
67
+ * @return {Array} array
68
+ */
69
+ static makeArray(result: any): any[];
70
+ /**
71
+ * Covert result to object | null
72
+ * @param {any} result table name
73
+ * @return {Record | null} object | null
74
+ */
75
+ static makeObject(result: any): Record<string, any> | null;
76
+ /**
77
+ * Get a connection
78
+ * @return {ConnectionTransaction} object - Connection for the transaction
79
+ * @type {object} connection
80
+ * @property {function} connection.query - execute query sql then release connection to pool
81
+ * @property {function} connection.startTransaction - start transaction of query
82
+ * @property {function} connection.commit - commit transaction of query
83
+ * @property {function} connection.rollback - rollback transaction of query
84
+ */
85
+ beginTransaction(): Promise<ConnectionTransaction>;
86
+ /**
87
+ * Assign table name
88
+ * @static
89
+ * @param {string} table table name
90
+ * @return {DB} DB
91
+ */
92
+ static table(table: string): DB;
93
+ /**
94
+ * select by cases
95
+ * @static
96
+ * @param {arrayObject} cases array object {when , then }
97
+ * @param {string?} final else condition
98
+ * @return {this}
99
+ */
100
+ static caseUpdate(cases: {
101
+ when: string;
102
+ then: string;
103
+ }[], final?: string): string | [];
104
+ /**
105
+ * Assign raw query for schema validation
106
+ * @static
107
+ * @param {string} sql
108
+ * @return {string} string
109
+ */
110
+ static raw(sql: string): string;
111
+ /**
112
+ * generate UUID
113
+ * @static
114
+ * @return {string} string
115
+ */
116
+ static generateUUID(): string;
117
+ /**
118
+ * Get constant
119
+ * @static
120
+ * @param {string} constant
121
+ * @return {string | object} string || object
122
+ */
123
+ static constants(constant?: string): string | {
124
+ [key: string]: any;
125
+ };
126
+ /**
127
+ * Get a connection
128
+ * @static
129
+ * @return {ConnectionTransaction} object - Connection for the transaction
130
+ * @type {object} connection
131
+ * @property {function} connection.query - execute query sql then release connection to pool
132
+ * @property {function} connection.startTransaction - start transaction of query
133
+ * @property {function} connection.commit - commit transaction of query
134
+ * @property {function} connection.rollback - rollback transaction of query
135
+ */
136
+ static beginTransaction(): Promise<ConnectionTransaction>;
137
+ /**
138
+ * Get a pool connection
139
+ * @param {Object} options options for connection database with credentials
140
+ * @param {string} option.host
141
+ * @param {number} option.port
142
+ * @param {string} option.database
143
+ * @param {string} option.username
144
+ * @param {string} option.password
145
+ * @return {Connection}
146
+ */
147
+ static getConnection(options: ConnectionOptions): Connection;
148
+ private _typeOf;
149
+ private _initialDB;
150
+ }
151
+ export { DB };
152
+ export default DB;