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,228 +1,228 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Blueprint = void 0;
4
- class Blueprint {
5
- constructor() {
6
- this.type = '';
7
- this.attrbuites = [];
8
- }
9
- /**
10
- * Assign type 'int' in table
11
- * @return {this} this
12
- */
13
- int() {
14
- this._addAssignType('INT');
15
- return this;
16
- }
17
- /**
18
- * Assign type 'TINYINT' in table
19
- * @param {number} number
20
- * @return {this} this
21
- */
22
- tinyInt(number = 1) {
23
- this._addAssignType(`TINYINT(${number})`);
24
- return this;
25
- }
26
- /**
27
- * Assign type 'BIGINT' in table
28
- * @param {number} number [number = 10]
29
- * @return {this} this
30
- */
31
- bigInt(number = 10) {
32
- this._addAssignType(`BIGINT(${number})`);
33
- return this;
34
- }
35
- /**
36
- * Assign type 'DOUBLE' in table
37
- * @param {number} length between 1-255
38
- * @param {number} decimal 0.000...n
39
- * @return {this} this
40
- */
41
- double(length = 0, decimal = 0) {
42
- if (!length || !decimal) {
43
- this._addAssignType(`DOUBLE`);
44
- return this;
45
- }
46
- this._addAssignType(`DOUBLE(${length},${decimal})`);
47
- return this;
48
- }
49
- /**
50
- * Assign type 'FLOAT' in table
51
- * @param {number} length between 1-255
52
- * @param {number} decimal 0.000...n
53
- * @return {this} this
54
- */
55
- float(length = 0, decimal = 0) {
56
- if (!length || !decimal) {
57
- this._addAssignType(`FLOAT`);
58
- return this;
59
- }
60
- this._addAssignType(`FLOAT(${length},${decimal})`);
61
- return this;
62
- }
63
- /**
64
- * Assign type 'VARCHAR' in table
65
- * @param {number} length [length = 100] length of string
66
- * @return {this} this
67
- */
68
- varchar(length = 100) {
69
- if (length > 255)
70
- length = 255;
71
- this._addAssignType(`VARCHAR(${length})`);
72
- return this;
73
- }
74
- /**
75
- * Assign type 'CHAR' in table
76
- * @param {number} length [length = 1] length of string
77
- * @return {this} this
78
- */
79
- char(length = 1) {
80
- this._addAssignType(`CHAR(${length})`);
81
- return this;
82
- }
83
- /**
84
- * Assign type 'LONGTEXT' in table
85
- * @return {this} this
86
- */
87
- longText() {
88
- this._addAssignType(`LONGTEXT`);
89
- return this;
90
- }
91
- /**
92
- * Assign type 'MEDIUMTEXT' in table
93
- * @param {number} length [length = 1] length of string
94
- * @return {this} this
95
- */
96
- mediumText() {
97
- this._addAssignType(`MEDIUMTEXT`);
98
- return this;
99
- }
100
- /**
101
- * Assign type 'TINYTEXT' in table
102
- * @param {number} length [length = 1] length of string
103
- * @return {this} this
104
- */
105
- tinyText() {
106
- this._addAssignType(`TINYTEXT`);
107
- return this;
108
- }
109
- /**
110
- * Assign type 'TEXT' in table
111
- * @param {number} length [length = 1] length of string
112
- * @return {this} this
113
- */
114
- text() {
115
- this._addAssignType(`TEXT`);
116
- return this;
117
- }
118
- /**
119
- * Assign type 'ENUM'
120
- * @param {...string} enums n1, n2, n3, ...n
121
- * @return {this} this
122
- */
123
- enum(...enums) {
124
- this._addAssignType(`ENUM('${enums}')`);
125
- return this;
126
- }
127
- /**
128
- * Assign type 'DATE' in table
129
- * @return {this} this
130
- */
131
- date() {
132
- this._addAssignType(`DATE`);
133
- return this;
134
- }
135
- /**
136
- * Assign type 'DATETIME' in table
137
- * @return {this} this
138
- */
139
- dateTime() {
140
- this._addAssignType(`DATETIME`);
141
- return this;
142
- }
143
- /**
144
- * Assign type 'TIMESTAMP' in table
145
- * @return {this} this
146
- */
147
- timestamp() {
148
- this._addAssignType(`TIMESTAMP`);
149
- return this;
150
- }
151
- /**
152
- * Assign type 'UNSIGNED' in table
153
- * @return {this} this
154
- */
155
- unsigned() {
156
- this._addAssignAttrbuite(`UNSIGNED`);
157
- return this;
158
- }
159
- /**
160
- * Assign type 'UNIQUE' in table
161
- * @return {this} this
162
- */
163
- unique() {
164
- this._addAssignAttrbuite(`UNIQUE`);
165
- return this;
166
- }
167
- /**
168
- * Assign type 'NULL' in table
169
- * @return {this} this
170
- */
171
- null() {
172
- this._addAssignAttrbuite(`NULL`);
173
- return this;
174
- }
175
- /**
176
- * Assign type 'NOT NULL' in table
177
- * @return {this} this
178
- */
179
- notNull() {
180
- this._addAssignAttrbuite(`NOT NULL`);
181
- return this;
182
- }
183
- /**
184
- * Assign type 'PRIMARY KEY' in table
185
- * @return {this} this
186
- */
187
- primary() {
188
- this._addAssignAttrbuite(`PRIMARY KEY`);
189
- return this;
190
- }
191
- /**
192
- * Assign attrbuites 'default' in table
193
- * @param {string | number} n default value
194
- * @return {this} this
195
- */
196
- default(n) {
197
- this._addAssignAttrbuite(`DEFAULT '${n}'`);
198
- return this;
199
- }
200
- /**
201
- * Assign attrbuites 'default currentTimestamp' in table
202
- * @return {this} this
203
- */
204
- currentTimestamp() {
205
- this._addAssignAttrbuite(`DEFAULT CURRENT_TIMESTAMP`);
206
- return this;
207
- }
208
- /**
209
- * Assign attrbuites 'autoIncrement' in table
210
- * @return {this} this
211
- */
212
- autoIncrement() {
213
- this._addAssignAttrbuite(`AUTO_INCREMENT`);
214
- return this;
215
- }
216
- _addAssignType(type) {
217
- if (this.type)
218
- return this;
219
- this.type = type;
220
- return this;
221
- }
222
- _addAssignAttrbuite(attrbuite) {
223
- this.attrbuites = [...this.attrbuites, attrbuite];
224
- return this;
225
- }
226
- }
227
- exports.Blueprint = Blueprint;
228
- exports.default = Blueprint;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Blueprint = void 0;
4
+ class Blueprint {
5
+ constructor() {
6
+ this.type = '';
7
+ this.attrbuites = [];
8
+ }
9
+ /**
10
+ * Assign type 'int' in table
11
+ * @return {this} this
12
+ */
13
+ int() {
14
+ this._addAssignType('INT');
15
+ return this;
16
+ }
17
+ /**
18
+ * Assign type 'TINYINT' in table
19
+ * @param {number} number
20
+ * @return {this} this
21
+ */
22
+ tinyInt(number = 1) {
23
+ this._addAssignType(`TINYINT(${number})`);
24
+ return this;
25
+ }
26
+ /**
27
+ * Assign type 'BIGINT' in table
28
+ * @param {number} number [number = 10]
29
+ * @return {this} this
30
+ */
31
+ bigInt(number = 10) {
32
+ this._addAssignType(`BIGINT(${number})`);
33
+ return this;
34
+ }
35
+ /**
36
+ * Assign type 'DOUBLE' in table
37
+ * @param {number} length between 1-255
38
+ * @param {number} decimal 0.000...n
39
+ * @return {this} this
40
+ */
41
+ double(length = 0, decimal = 0) {
42
+ if (!length || !decimal) {
43
+ this._addAssignType(`DOUBLE`);
44
+ return this;
45
+ }
46
+ this._addAssignType(`DOUBLE(${length},${decimal})`);
47
+ return this;
48
+ }
49
+ /**
50
+ * Assign type 'FLOAT' in table
51
+ * @param {number} length between 1-255
52
+ * @param {number} decimal 0.000...n
53
+ * @return {this} this
54
+ */
55
+ float(length = 0, decimal = 0) {
56
+ if (!length || !decimal) {
57
+ this._addAssignType(`FLOAT`);
58
+ return this;
59
+ }
60
+ this._addAssignType(`FLOAT(${length},${decimal})`);
61
+ return this;
62
+ }
63
+ /**
64
+ * Assign type 'VARCHAR' in table
65
+ * @param {number} length [length = 100] length of string
66
+ * @return {this} this
67
+ */
68
+ varchar(length = 100) {
69
+ if (length > 255)
70
+ length = 255;
71
+ this._addAssignType(`VARCHAR(${length})`);
72
+ return this;
73
+ }
74
+ /**
75
+ * Assign type 'CHAR' in table
76
+ * @param {number} length [length = 1] length of string
77
+ * @return {this} this
78
+ */
79
+ char(length = 1) {
80
+ this._addAssignType(`CHAR(${length})`);
81
+ return this;
82
+ }
83
+ /**
84
+ * Assign type 'LONGTEXT' in table
85
+ * @return {this} this
86
+ */
87
+ longText() {
88
+ this._addAssignType(`LONGTEXT`);
89
+ return this;
90
+ }
91
+ /**
92
+ * Assign type 'MEDIUMTEXT' in table
93
+ * @param {number} length [length = 1] length of string
94
+ * @return {this} this
95
+ */
96
+ mediumText() {
97
+ this._addAssignType(`MEDIUMTEXT`);
98
+ return this;
99
+ }
100
+ /**
101
+ * Assign type 'TINYTEXT' in table
102
+ * @param {number} length [length = 1] length of string
103
+ * @return {this} this
104
+ */
105
+ tinyText() {
106
+ this._addAssignType(`TINYTEXT`);
107
+ return this;
108
+ }
109
+ /**
110
+ * Assign type 'TEXT' in table
111
+ * @param {number} length [length = 1] length of string
112
+ * @return {this} this
113
+ */
114
+ text() {
115
+ this._addAssignType(`TEXT`);
116
+ return this;
117
+ }
118
+ /**
119
+ * Assign type 'ENUM'
120
+ * @param {...string} enums n1, n2, n3, ...n
121
+ * @return {this} this
122
+ */
123
+ enum(...enums) {
124
+ this._addAssignType(`ENUM('${enums}')`);
125
+ return this;
126
+ }
127
+ /**
128
+ * Assign type 'DATE' in table
129
+ * @return {this} this
130
+ */
131
+ date() {
132
+ this._addAssignType(`DATE`);
133
+ return this;
134
+ }
135
+ /**
136
+ * Assign type 'DATETIME' in table
137
+ * @return {this} this
138
+ */
139
+ dateTime() {
140
+ this._addAssignType(`DATETIME`);
141
+ return this;
142
+ }
143
+ /**
144
+ * Assign type 'TIMESTAMP' in table
145
+ * @return {this} this
146
+ */
147
+ timestamp() {
148
+ this._addAssignType(`TIMESTAMP`);
149
+ return this;
150
+ }
151
+ /**
152
+ * Assign type 'UNSIGNED' in table
153
+ * @return {this} this
154
+ */
155
+ unsigned() {
156
+ this._addAssignAttrbuite(`UNSIGNED`);
157
+ return this;
158
+ }
159
+ /**
160
+ * Assign type 'UNIQUE' in table
161
+ * @return {this} this
162
+ */
163
+ unique() {
164
+ this._addAssignAttrbuite(`UNIQUE`);
165
+ return this;
166
+ }
167
+ /**
168
+ * Assign type 'NULL' in table
169
+ * @return {this} this
170
+ */
171
+ null() {
172
+ this._addAssignAttrbuite(`NULL`);
173
+ return this;
174
+ }
175
+ /**
176
+ * Assign type 'NOT NULL' in table
177
+ * @return {this} this
178
+ */
179
+ notNull() {
180
+ this._addAssignAttrbuite(`NOT NULL`);
181
+ return this;
182
+ }
183
+ /**
184
+ * Assign type 'PRIMARY KEY' in table
185
+ * @return {this} this
186
+ */
187
+ primary() {
188
+ this._addAssignAttrbuite(`PRIMARY KEY`);
189
+ return this;
190
+ }
191
+ /**
192
+ * Assign attrbuites 'default' in table
193
+ * @param {string | number} n default value
194
+ * @return {this} this
195
+ */
196
+ default(n) {
197
+ this._addAssignAttrbuite(`DEFAULT '${n}'`);
198
+ return this;
199
+ }
200
+ /**
201
+ * Assign attrbuites 'default currentTimestamp' in table
202
+ * @return {this} this
203
+ */
204
+ currentTimestamp() {
205
+ this._addAssignAttrbuite(`DEFAULT CURRENT_TIMESTAMP`);
206
+ return this;
207
+ }
208
+ /**
209
+ * Assign attrbuites 'autoIncrement' in table
210
+ * @return {this} this
211
+ */
212
+ autoIncrement() {
213
+ this._addAssignAttrbuite(`AUTO_INCREMENT`);
214
+ return this;
215
+ }
216
+ _addAssignType(type) {
217
+ if (this.type)
218
+ return this;
219
+ this.type = type;
220
+ return this;
221
+ }
222
+ _addAssignAttrbuite(attrbuite) {
223
+ this.attrbuites = [...this.attrbuites, attrbuite];
224
+ return this;
225
+ }
226
+ }
227
+ exports.Blueprint = Blueprint;
228
+ exports.default = Blueprint;