tspace-mysql 1.0.0 → 1.0.3

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 (42) hide show
  1. package/README.md +14 -15
  2. package/dist/cli/index.d.ts +2 -0
  3. package/dist/cli/index.js +10 -6
  4. package/dist/cli/migrate/make.d.ts +4 -0
  5. package/dist/cli/migrate/make.js +9 -9
  6. package/dist/cli/models/make.d.ts +4 -0
  7. package/dist/cli/models/make.js +14 -17
  8. package/dist/cli/models/model.d.ts +2 -0
  9. package/dist/cli/models/model.js +1 -1
  10. package/dist/cli/tables/make.d.ts +4 -0
  11. package/dist/cli/tables/make.js +21 -22
  12. package/dist/cli/tables/table.d.ts +2 -0
  13. package/dist/cli/tables/table.js +1 -1
  14. package/dist/lib/config/env.d.ts +8 -0
  15. package/dist/lib/config/env.js +1 -1
  16. package/dist/lib/connections/index.d.ts +2 -0
  17. package/dist/lib/connections/index.js +1 -1
  18. package/dist/lib/connections/options.d.ts +4 -0
  19. package/dist/lib/constants/index.d.ts +4 -0
  20. package/dist/lib/{utils/constant.js → constants/index.js} +0 -2
  21. package/dist/lib/index.d.ts +8 -0
  22. package/dist/lib/index.js +6 -2
  23. package/dist/lib/tspace/AbstractDB.d.ts +7 -0
  24. package/dist/lib/tspace/AbstractDatabase.d.ts +102 -0
  25. package/dist/lib/tspace/AbstractModel.d.ts +20 -0
  26. package/dist/lib/tspace/DB.d.ts +15 -0
  27. package/dist/lib/tspace/DB.js +10 -7
  28. package/dist/lib/tspace/Database.d.ts +155 -0
  29. package/dist/lib/tspace/Database.js +232 -168
  30. package/dist/lib/tspace/Interface.d.ts +25 -0
  31. package/dist/lib/tspace/Logger.d.ts +1 -0
  32. package/dist/lib/tspace/Logger.js +4 -3
  33. package/dist/lib/tspace/Model.d.ts +233 -0
  34. package/dist/lib/tspace/Model.js +247 -236
  35. package/dist/lib/tspace/ProxyHandler.d.ts +5 -0
  36. package/dist/lib/tspace/ProxyHandler.js +2 -2
  37. package/dist/lib/tspace/Schema.d.ts +45 -0
  38. package/dist/lib/tspace/Schema.js +9 -11
  39. package/dist/lib/tspace/index.d.ts +14 -0
  40. package/dist/lib/utils/index.d.ts +17 -0
  41. package/dist/lib/utils/index.js +8 -8
  42. package/package.json +3 -6
@@ -125,7 +125,7 @@ var Database = /** @class */ (function (_super) {
125
125
  };
126
126
  Database.prototype.distinct = function (column) {
127
127
  if (column === void 0) { column = 'id'; }
128
- this.$db.set('SELECT', this.$utils().constants('SELECT') + " " + this.$utils().constants('DISTINCT') + " " + column);
128
+ this.$db.set('SELECT', "".concat(this.$utils().constants('SELECT'), " ").concat(this.$utils().constants('DISTINCT'), " ").concat(column));
129
129
  return this;
130
130
  };
131
131
  Database.prototype.select = function () {
@@ -136,7 +136,24 @@ var Database = /** @class */ (function (_super) {
136
136
  var select = '*';
137
137
  if (params === null || params === void 0 ? void 0 : params.length)
138
138
  select = params.join(',');
139
- this.$db.set('SELECT', this.$utils().constants('SELECT') + " " + select);
139
+ this.$db.set('SELECT', "".concat(this.$utils().constants('SELECT'), " ").concat(select));
140
+ return this;
141
+ };
142
+ Database.prototype.chunk = function (chunk) {
143
+ this.$db.set('CHUNK', chunk);
144
+ return this;
145
+ };
146
+ Database.prototype.when = function (value, cb) {
147
+ if (value)
148
+ cb(this);
149
+ return this;
150
+ };
151
+ Database.prototype.whereRaw = function (query) {
152
+ if (!this.$db.get('WHERE').includes(this.$utils().constants('WHERE'))) {
153
+ this.$db.set('WHERE', "".concat(this.$utils().constants('WHERE'), " ").concat(query));
154
+ return this;
155
+ }
156
+ this.$db.set('WHERE', "".concat(this.$db.get('WHERE'), " ").concat(this.$utils().constants('AND'), " ").concat(query));
140
157
  return this;
141
158
  };
142
159
  Database.prototype.where = function (column, operator, value) {
@@ -145,40 +162,44 @@ var Database = /** @class */ (function (_super) {
145
162
  value = this.$utils().escape(value);
146
163
  value = this._valueTrueFalse(value);
147
164
  if (operator === this.$utils().constants('LIKE'))
148
- value = "%" + value + "%";
149
- if (!this.$db.get('WHERE').includes(this.$utils().constants('WHERE')))
150
- this.$db.set('WHERE', this.$utils().constants('WHERE') + " " + column + " " + operator + " '" + value + "'");
151
- else
152
- this.$db.set('WHERE', this.$db.get('WHERE') + " " + this.$utils().constants('AND') + " " + column + " " + operator + " '" + value + "'");
165
+ value = "%".concat(value, "%");
166
+ if (!this.$db.get('WHERE').includes(this.$utils().constants('WHERE'))) {
167
+ this.$db.set('WHERE', "".concat(this.$utils().constants('WHERE'), " ").concat(column, " ").concat(operator, " '").concat(value, "'"));
168
+ return this;
169
+ }
170
+ this.$db.set('WHERE', "".concat(this.$db.get('WHERE'), " ").concat(this.$utils().constants('AND'), " ").concat(column, " ").concat(operator, " '").concat(value, "'"));
153
171
  return this;
154
172
  };
155
173
  Database.prototype.whereId = function (id) {
156
174
  var column = 'id';
157
175
  var operator = '=';
158
- if (!this.$db.get('WHERE').includes(this.$utils().constants('WHERE')))
159
- this.$db.set('WHERE', this.$utils().constants('WHERE') + " " + column + " " + operator + " '" + id + "'");
160
- else
161
- this.$db.set('WHERE', this.$db.get('WHERE') + " " + this.$utils().constants('AND') + " " + column + " " + operator + " '" + id + "'");
176
+ if (!this.$db.get('WHERE').includes(this.$utils().constants('WHERE'))) {
177
+ this.$db.set('WHERE', "".concat(this.$utils().constants('WHERE'), " ").concat(column, " ").concat(operator, " '").concat(id, "'"));
178
+ return this;
179
+ }
180
+ this.$db.set('WHERE', "".concat(this.$db.get('WHERE'), " ").concat(this.$utils().constants('AND'), " ").concat(column, " ").concat(operator, " '").concat(id, "'"));
162
181
  return this;
163
182
  };
164
183
  Database.prototype.whereEmail = function (email) {
165
184
  var column = 'email';
166
185
  var operator = '=';
167
186
  email = this.$utils().escape(email);
168
- if (!this.$db.get('WHERE').includes(this.$utils().constants('WHERE')))
169
- this.$db.set('WHERE', this.$utils().constants('WHERE') + " " + column + " " + operator + " '" + email + "'");
170
- else
171
- this.$db.set('WHERE', this.$db.get('WHERE') + " " + this.$utils().constants('AND') + " " + column + " " + operator + " '" + email + "'");
187
+ if (!this.$db.get('WHERE').includes(this.$utils().constants('WHERE'))) {
188
+ this.$db.set('WHERE', "".concat(this.$utils().constants('WHERE'), " ").concat(column, " ").concat(operator, " '").concat(email, "'"));
189
+ return this;
190
+ }
191
+ this.$db.set('WHERE', "".concat(this.$db.get('WHERE'), " ").concat(this.$utils().constants('AND'), " ").concat(column, " ").concat(operator, " '").concat(email, "'"));
172
192
  return this;
173
193
  };
174
194
  Database.prototype.whereUser = function (id) {
175
195
  var column = 'user_id';
176
196
  var operator = '=';
177
197
  id = this.$utils().escape(id);
178
- if (!this.$db.get('WHERE').includes(this.$utils().constants('WHERE')))
179
- this.$db.set('WHERE', this.$utils().constants('WHERE') + " " + column + " " + operator + " '" + id + "'");
180
- else
181
- this.$db.set('WHERE', this.$db.get('WHERE') + " " + this.$utils().constants('AND') + " " + column + " " + operator + " '" + id + "'");
198
+ if (!this.$db.get('WHERE').includes(this.$utils().constants('WHERE'))) {
199
+ this.$db.set('WHERE', "".concat(this.$utils().constants('WHERE'), " ").concat(column, " ").concat(operator, " '").concat(id, "'"));
200
+ return this;
201
+ }
202
+ this.$db.set('WHERE', "".concat(this.$db.get('WHERE'), " ").concat(this.$utils().constants('AND'), " ").concat(column, " ").concat(operator, " '").concat(id, "'"));
182
203
  return this;
183
204
  };
184
205
  Database.prototype.orWhere = function (column, operator, value) {
@@ -186,80 +207,83 @@ var Database = /** @class */ (function (_super) {
186
207
  _a = __read(this._valueAndOperator(value, operator, arguments.length === 2), 2), value = _a[0], operator = _a[1];
187
208
  value = this.$utils().escape(value);
188
209
  if (operator === this.$utils().constants('LIKE'))
189
- value = "%" + value + "%";
190
- if (this.$db.get('WHERE').includes(this.$utils().constants('WHERE')))
191
- this.$db.set('WHERE', this.$db.get('WHERE') + " " + this.$utils().constants('OR') + " " + column + " " + operator + " '" + value + "'");
192
- else
193
- this.$db.set('WHERE', this.$utils().constants('WHERE') + " " + column + " " + operator + " '" + value + "'");
210
+ value = "%".concat(value, "%");
211
+ if (this.$db.get('WHERE').includes(this.$utils().constants('WHERE'))) {
212
+ this.$db.set('WHERE', "".concat(this.$db.get('WHERE'), " ").concat(this.$utils().constants('OR'), " ").concat(column, " ").concat(operator, " '").concat(value, "'"));
213
+ return this;
214
+ }
215
+ this.$db.set('WHERE', "".concat(this.$utils().constants('WHERE'), " ").concat(column, " ").concat(operator, " '").concat(value, "'"));
194
216
  return this;
195
217
  };
196
218
  Database.prototype.whereIn = function (column, arrayValues) {
197
- var sql = this.$db.get('WHERE');
198
219
  if (!Array.isArray(arrayValues))
199
- throw new Error("[" + arrayValues + "] is't array");
220
+ throw new Error("[".concat(arrayValues, "] is't array"));
200
221
  if (!arrayValues.length)
201
222
  arrayValues = ['0'];
202
- var values = "" + arrayValues.map(function (value) { return "'" + value + "'"; }).join(',');
203
- if (!sql.includes(this.$utils().constants('WHERE'))) {
204
- this.$db.set('WHERE', this.$utils().constants('WHERE') + " " + column + " " + this.$utils().constants('IN') + " (" + values + ")");
223
+ var values = "".concat(arrayValues.map(function (value) { return "'".concat(value, "'"); }).join(','));
224
+ if (!this.$db.get('WHERE').includes(this.$utils().constants('WHERE'))) {
225
+ this.$db.set('WHERE', "".concat(this.$utils().constants('WHERE'), " ").concat(column, " ").concat(this.$utils().constants('IN'), " (").concat(values, ")"));
205
226
  return this;
206
227
  }
207
- this.$db.set('WHERE', this.$db.get('WHERE') + " " + this.$utils().constants('AND') + " " + column + " " + this.$utils().constants('IN') + " (" + values + ")");
228
+ this.$db.set('WHERE', "".concat(this.$db.get('WHERE'), " ").concat(this.$utils().constants('AND'), " ").concat(column, " ").concat(this.$utils().constants('IN'), " (").concat(values, ")"));
208
229
  return this;
209
230
  };
210
231
  Database.prototype.orWhereIn = function (column, arrayValues) {
211
232
  var sql = this.$db.get('WHERE');
212
233
  if (!Array.isArray(arrayValues))
213
- throw new Error("[" + arrayValues + "] is't array");
234
+ throw new Error("[".concat(arrayValues, "] is't array"));
214
235
  if (!arrayValues.length)
215
236
  arrayValues = ['0'];
216
- var values = "" + arrayValues.map(function (value) { return "'" + value + "'"; }).join(',');
237
+ var values = "".concat(arrayValues.map(function (value) { return "'".concat(value, "'"); }).join(','));
217
238
  if (!sql.includes(this.$utils().constants('WHERE'))) {
218
- this.$db.set('WHERE', this.$utils().constants('WHERE') + " " + column + " " + this.$utils().constants('IN') + " (" + values + ")");
239
+ this.$db.set('WHERE', "".concat(this.$utils().constants('WHERE'), " ").concat(column, " ").concat(this.$utils().constants('IN'), " (").concat(values, ")"));
219
240
  return this;
220
241
  }
221
- this.$db.set('WHERE', this.$db.get('WHERE') + " " + this.$utils().constants('OR') + " " + column + " " + this.$utils().constants('IN') + " (" + values + ")");
242
+ this.$db.set('WHERE', "".concat(this.$db.get('WHERE'), " ").concat(this.$utils().constants('OR'), " ").concat(column, " ").concat(this.$utils().constants('IN'), " (").concat(values, ")"));
222
243
  return this;
223
244
  };
224
245
  Database.prototype.whereNotIn = function (column, arrayValues) {
225
246
  var sql = this.$db.get('WHERE');
226
247
  if (!Array.isArray(arrayValues))
227
- throw new Error("[" + arrayValues + "] is't array");
248
+ throw new Error("[".concat(arrayValues, "] is't array"));
228
249
  if (!arrayValues.length)
229
250
  arrayValues = ['0'];
230
- var values = "" + arrayValues.map(function (value) { return "'" + value + "'"; }).join(',');
251
+ var values = "".concat(arrayValues.map(function (value) { return "'".concat(value, "'"); }).join(','));
231
252
  if (!sql.includes(this.$utils().constants('WHERE'))) {
232
- this.$db.set('WHERE', this.$utils().constants('WHERE') + " " + column + " " + this.$utils().constants('NOT_IN') + " (" + values + ")");
253
+ this.$db.set('WHERE', "".concat(this.$utils().constants('WHERE'), " ").concat(column, " ").concat(this.$utils().constants('NOT_IN'), " (").concat(values, ")"));
233
254
  return this;
234
255
  }
235
- this.$db.set('WHERE', this.$db.get('WHERE') + " " + this.$utils().constants('AND') + " " + column + " " + this.$utils().constants('NOT_IN') + " (" + values + ")");
256
+ this.$db.set('WHERE', "".concat(this.$db.get('WHERE'), " ").concat(this.$utils().constants('AND'), " ").concat(column, " ").concat(this.$utils().constants('NOT_IN'), " (").concat(values, ")"));
236
257
  return this;
237
258
  };
238
259
  Database.prototype.whereSubQuery = function (column, subQuery) {
239
260
  var whereSubQuery = this.$db.get('WHERE');
240
261
  subQuery = this.$utils().escapeSubQuery(subQuery);
241
- if (!whereSubQuery.includes(this.$utils().constants('WHERE')))
242
- this.$db.set('WHERE', this.$utils().constants('WHERE') + " " + column + " " + this.$utils().constants('IN') + " (" + subQuery + ")");
243
- else
244
- this.$db.set('WHERE', this.$db.get('WHERE') + " " + this.$utils().constants('AND') + " " + column + " " + this.$utils().constants('IN') + " (" + subQuery + ")");
262
+ if (!whereSubQuery.includes(this.$utils().constants('WHERE'))) {
263
+ this.$db.set('WHERE', "".concat(this.$utils().constants('WHERE'), " ").concat(column, " ").concat(this.$utils().constants('IN'), " (").concat(subQuery, ")"));
264
+ return this;
265
+ }
266
+ this.$db.set('WHERE', "".concat(this.$db.get('WHERE'), " ").concat(this.$utils().constants('AND'), " ").concat(column, " ").concat(this.$utils().constants('IN'), " (").concat(subQuery, ")"));
245
267
  return this;
246
268
  };
247
269
  Database.prototype.whereNotInSubQuery = function (column, subQuery) {
248
270
  var whereSubQuery = this.$db.get('WHERE');
249
271
  subQuery = this.$utils().escapeSubQuery(subQuery);
250
- if (!whereSubQuery.includes(this.$utils().constants('WHERE')))
251
- this.$db.set('WHERE', this.$utils().constants('WHERE') + " " + column + " " + this.$utils().constants('IN') + " (" + subQuery + ")");
252
- else
253
- this.$db.set('WHERE', this.$db.get('WHERE') + " " + this.$utils().constants('AND') + " " + column + " " + this.$utils().constants('NOT_IN') + " (" + subQuery + ")");
272
+ if (!whereSubQuery.includes(this.$utils().constants('WHERE'))) {
273
+ this.$db.set('WHERE', "".concat(this.$utils().constants('WHERE'), " ").concat(column, " ").concat(this.$utils().constants('IN'), " (").concat(subQuery, ")"));
274
+ return this;
275
+ }
276
+ this.$db.set('WHERE', "".concat(this.$db.get('WHERE'), " ").concat(this.$utils().constants('AND'), " ").concat(column, " ").concat(this.$utils().constants('NOT_IN'), " (").concat(subQuery, ")"));
254
277
  return this;
255
278
  };
256
279
  Database.prototype.orWhereSubQuery = function (column, subQuery) {
257
280
  var whereSubQuery = this.$db.get('WHERE');
258
281
  subQuery = this.$utils().escapeSubQuery(subQuery);
259
- if (!whereSubQuery.includes(this.$utils().constants('WHERE')))
260
- this.$db.set('WHERE', this.$utils().constants('WHERE') + " " + column + " " + this.$utils().constants('IN') + " (" + subQuery + ")");
261
- else
262
- this.$db.set('WHERE', this.$db.get('WHERE') + " " + this.$utils().constants('OR') + " " + column + " " + this.$utils().constants('IN') + " (" + subQuery + ")");
282
+ if (!whereSubQuery.includes(this.$utils().constants('WHERE'))) {
283
+ this.$db.set('WHERE', "".concat(this.$utils().constants('WHERE'), " ").concat(column, " ").concat(this.$utils().constants('IN'), " (").concat(subQuery, ")"));
284
+ return this;
285
+ }
286
+ this.$db.set('WHERE', "".concat(this.$db.get('WHERE'), " ").concat(this.$utils().constants('OR'), " ").concat(column, " ").concat(this.$utils().constants('IN'), " (").concat(subQuery, ")"));
263
287
  return this;
264
288
  };
265
289
  Database.prototype.whereBetween = function (column, arrayValue) {
@@ -272,24 +296,26 @@ var Database = /** @class */ (function (_super) {
272
296
  value2 = this.$utils().escape(value2);
273
297
  var sql = this.$db.get('WHERE');
274
298
  if (!sql.includes(this.$utils().constants('WHERE'))) {
275
- this.$db.set('WHERE', this.$utils().constants('WHERE') + " " + column + " " + this.$utils().constants('BETWEEN') + " '" + value1 + "' " + this.$utils().constants('AND') + " '" + value2 + "'");
299
+ this.$db.set('WHERE', "".concat(this.$utils().constants('WHERE'), " ").concat(column, " ").concat(this.$utils().constants('BETWEEN'), " '").concat(value1, "' ").concat(this.$utils().constants('AND'), " '").concat(value2, "'"));
276
300
  return this;
277
301
  }
278
- this.$db.set('WHERE', this.$db.get('WHERE') + " " + this.$utils().constants('AND') + " " + column + " " + this.$utils().constants('BETWEEN') + " '" + value1 + "' " + this.$utils().constants('AND') + " '" + value2 + "'");
302
+ this.$db.set('WHERE', "".concat(this.$db.get('WHERE'), " ").concat(this.$utils().constants('AND'), " ").concat(column, " ").concat(this.$utils().constants('BETWEEN'), " '").concat(value1, "' ").concat(this.$utils().constants('AND'), " '").concat(value2, "'"));
279
303
  return this;
280
304
  };
281
305
  Database.prototype.whereNull = function (column) {
282
- if (!this.$db.get('WHERE').includes(this.$utils().constants('WHERE')))
283
- this.$db.set('WHERE', this.$utils().constants('WHERE') + " " + column + " " + this.$utils().constants('IS_NULL'));
284
- else
285
- this.$db.set('WHERE', this.$db.get('WHERE') + " " + this.$utils().constants('AND') + " " + column + " " + this.$utils().constants('IS_NULL'));
306
+ if (!this.$db.get('WHERE').includes(this.$utils().constants('WHERE'))) {
307
+ this.$db.set('WHERE', "".concat(this.$utils().constants('WHERE'), " ").concat(column, " ").concat(this.$utils().constants('IS_NULL')));
308
+ return this;
309
+ }
310
+ this.$db.set('WHERE', "".concat(this.$db.get('WHERE'), " ").concat(this.$utils().constants('AND'), " ").concat(column, " ").concat(this.$utils().constants('IS_NULL')));
286
311
  return this;
287
312
  };
288
313
  Database.prototype.whereNotNull = function (column) {
289
- if (!this.$db.get('WHERE').includes(this.$utils().constants('WHERE')))
290
- this.$db.set('WHERE', this.$utils().constants('WHERE') + " " + column + " " + this.$utils().constants('IS_NOT_NULL'));
291
- else
292
- this.$db.set('WHERE', this.$db.get('WHERE') + " " + this.$utils().constants('AND') + " " + column + " " + this.$utils().constants('IS_NOT_NULL'));
314
+ if (!this.$db.get('WHERE').includes(this.$utils().constants('WHERE'))) {
315
+ this.$db.set('WHERE', "".concat(this.$utils().constants('WHERE'), " ").concat(column, " ").concat(this.$utils().constants('IS_NOT_NULL')));
316
+ return this;
317
+ }
318
+ this.$db.set('WHERE', "".concat(this.$db.get('WHERE'), " ").concat(this.$utils().constants('AND'), " ").concat(column, " ").concat(this.$utils().constants('IS_NOT_NULL')));
293
319
  return this;
294
320
  };
295
321
  Database.prototype.whereSensitive = function (column, operator, value) {
@@ -297,12 +323,11 @@ var Database = /** @class */ (function (_super) {
297
323
  _a = __read(this._valueAndOperator(value, operator, arguments.length === 2), 2), value = _a[0], operator = _a[1];
298
324
  value = this.$utils().escape(value);
299
325
  value = this._valueTrueFalse(value);
300
- if (operator === this.$utils().constants('LIKE'))
301
- value = "%" + value + "%";
302
- if (!this.$db.get('WHERE').includes(this.$utils().constants('WHERE')))
303
- this.$db.set('WHERE', this.$utils().constants('WHERE') + " BINARY " + column + " " + operator + " '" + value + "'");
304
- else
305
- this.$db.set('WHERE', this.$db.get('WHERE') + " " + this.$utils().constants('AND') + " BINARY " + column + " " + operator + " '" + value + "'");
326
+ if (!this.$db.get('WHERE').includes(this.$utils().constants('WHERE'))) {
327
+ this.$db.set('WHERE', "".concat(this.$utils().constants('WHERE'), " BINARY ").concat(column, " ").concat(operator, " '").concat(value, "'"));
328
+ return this;
329
+ }
330
+ this.$db.set('WHERE', "".concat(this.$db.get('WHERE'), " ").concat(this.$utils().constants('AND'), " BINARY ").concat(column, " ").concat(operator, " '").concat(value, "'"));
306
331
  return this;
307
332
  };
308
333
  Database.prototype.whereGroupStart = function (column, operator, value) {
@@ -311,11 +336,12 @@ var Database = /** @class */ (function (_super) {
311
336
  value = this.$utils().escape(value);
312
337
  value = this._valueTrueFalse(value);
313
338
  if (operator === this.$utils().constants('LIKE'))
314
- value = "%" + value + "%";
315
- if (!this.$db.get('WHERE').includes(this.$utils().constants('WHERE')))
316
- this.$db.set('WHERE', this.$utils().constants('WHERE') + " (" + column + " " + operator + " '" + value + "'");
317
- else
318
- this.$db.set('WHERE', this.$db.get('WHERE') + " " + this.$utils().constants('AND') + " (" + column + " " + operator + " '" + value + "'");
339
+ value = "%".concat(value, "%");
340
+ if (!this.$db.get('WHERE').includes(this.$utils().constants('WHERE'))) {
341
+ this.$db.set('WHERE', "".concat(this.$utils().constants('WHERE'), " (").concat(column, " ").concat(operator, " '").concat(value, "'"));
342
+ return this;
343
+ }
344
+ this.$db.set('WHERE', "".concat(this.$db.get('WHERE'), " ").concat(this.$utils().constants('AND'), " (").concat(column, " ").concat(operator, " '").concat(value, "'"));
319
345
  return this;
320
346
  };
321
347
  Database.prototype.orWhereGroupStart = function (column, operator, value) {
@@ -324,11 +350,12 @@ var Database = /** @class */ (function (_super) {
324
350
  value = this.$utils().escape(value);
325
351
  value = this._valueTrueFalse(value);
326
352
  if (operator === this.$utils().constants('LIKE'))
327
- value = "%" + value + "%";
328
- if (!this.$db.get('WHERE').includes(this.$utils().constants('WHERE')))
329
- this.$db.set('WHERE', this.$utils().constants('WHERE') + " (" + column + " " + operator + " '" + value + "'");
330
- else
331
- this.$db.set('WHERE', this.$db.get('WHERE') + " " + this.$utils().constants('AND') + " (" + column + " " + operator + " '" + value + "'");
353
+ value = "%".concat(value, "%");
354
+ if (!this.$db.get('WHERE').includes(this.$utils().constants('WHERE'))) {
355
+ this.$db.set('WHERE', "".concat(this.$utils().constants('WHERE'), " (").concat(column, " ").concat(operator, " '").concat(value, "'"));
356
+ return this;
357
+ }
358
+ this.$db.set('WHERE', "".concat(this.$db.get('WHERE'), " ").concat(this.$utils().constants('AND'), " (").concat(column, " ").concat(operator, " '").concat(value, "'"));
332
359
  return this;
333
360
  };
334
361
  Database.prototype.whereGroupEnd = function (column, operator, value) {
@@ -337,11 +364,12 @@ var Database = /** @class */ (function (_super) {
337
364
  value = this.$utils().escape(value);
338
365
  value = this._valueTrueFalse(value);
339
366
  if (operator === this.$utils().constants('LIKE'))
340
- value = "%" + value + "%";
341
- if (!this.$db.get('WHERE').includes(this.$utils().constants('WHERE')))
342
- this.$db.set('WHERE', this.$utils().constants('WHERE') + " " + column + " " + operator + " '" + value + "')");
343
- else
344
- this.$db.set('WHERE', this.$db.get('WHERE') + " " + this.$utils().constants('OR') + " " + column + " " + operator + " '" + value + "')");
367
+ value = "%".concat(value, "%");
368
+ if (!this.$db.get('WHERE').includes(this.$utils().constants('WHERE'))) {
369
+ this.$db.set('WHERE', "".concat(this.$utils().constants('WHERE'), " ").concat(column, " ").concat(operator, " '").concat(value, "')"));
370
+ return this;
371
+ }
372
+ this.$db.set('WHERE', "".concat(this.$db.get('WHERE'), " ").concat(this.$utils().constants('OR'), " ").concat(column, " ").concat(operator, " '").concat(value, "')"));
345
373
  return this;
346
374
  };
347
375
  Database.prototype.orWhereGroupEnd = function (column, operator, value) {
@@ -350,11 +378,12 @@ var Database = /** @class */ (function (_super) {
350
378
  value = this.$utils().escape(value);
351
379
  value = this._valueTrueFalse(value);
352
380
  if (operator === this.$utils().constants('LIKE'))
353
- value = "%" + value + "%";
354
- if (!this.$db.get('WHERE').includes(this.$utils().constants('WHERE')))
355
- this.$db.set('WHERE', this.$utils().constants('WHERE') + " " + column + " " + operator + " '" + value + "')");
356
- else
357
- this.$db.set('WHERE', this.$db.get('WHERE') + " " + this.$utils().constants('OR') + " " + column + " " + operator + " '" + value + "')");
381
+ value = "%".concat(value, "%");
382
+ if (!this.$db.get('WHERE').includes(this.$utils().constants('WHERE'))) {
383
+ this.$db.set('WHERE', "".concat(this.$utils().constants('WHERE'), " ").concat(column, " ").concat(operator, " '").concat(value, "')"));
384
+ return this;
385
+ }
386
+ this.$db.set('WHERE', "".concat(this.$db.get('WHERE'), " ").concat(this.$utils().constants('OR'), " ").concat(column, " ").concat(operator, " '").concat(value, "')"));
358
387
  return this;
359
388
  };
360
389
  Database.prototype.having = function (condition) {
@@ -364,74 +393,76 @@ var Database = /** @class */ (function (_super) {
364
393
  Database.prototype.join = function (pk, fk) {
365
394
  var _a;
366
395
  var table = (_a = fk.split('.')) === null || _a === void 0 ? void 0 : _a.shift();
367
- if (this.$db.get('JOIN'))
368
- this.$db.set('JOIN', this.$db.get('JOIN') + " " + this.$utils().constants('INNER_JOIN') + " " + table + " " + this.$utils().constants('ON') + " " + pk + " = " + fk);
369
- else
370
- this.$db.set('JOIN', this.$utils().constants('INNER_JOIN') + " " + table + " " + this.$utils().constants('ON') + " " + pk + " = " + fk);
396
+ if (this.$db.get('JOIN')) {
397
+ this.$db.set('JOIN', "".concat(this.$db.get('JOIN'), " ").concat(this.$utils().constants('INNER_JOIN'), " ").concat(table, " ").concat(this.$utils().constants('ON'), " ").concat(pk, " = ").concat(fk));
398
+ return this;
399
+ }
400
+ this.$db.set('JOIN', "".concat(this.$utils().constants('INNER_JOIN'), " ").concat(table, " ").concat(this.$utils().constants('ON'), " ").concat(pk, " = ").concat(fk));
371
401
  return this;
372
402
  };
373
403
  Database.prototype.rightJoin = function (pk, fk) {
374
404
  var _a;
375
405
  var table = (_a = fk.split('.')) === null || _a === void 0 ? void 0 : _a.shift();
376
- if (this.$db.get('JOIN'))
377
- this.$db.set('JOIN', this.$db.get('JOIN') + " " + this.$utils().constants('RIGHT_JOIN') + " " + table + " " + this.$utils().constants('ON') + " " + pk + " = " + fk);
378
- else
379
- this.$db.set('JOIN', this.$utils().constants('RIGHT_JOIN') + " " + table + " " + this.$utils().constants('ON') + " " + pk + " = " + fk);
406
+ if (this.$db.get('JOIN')) {
407
+ this.$db.set('JOIN', "".concat(this.$db.get('JOIN'), " ").concat(this.$utils().constants('RIGHT_JOIN'), " ").concat(table, " ").concat(this.$utils().constants('ON'), " ").concat(pk, " = ").concat(fk));
408
+ return this;
409
+ }
410
+ this.$db.set('JOIN', "".concat(this.$utils().constants('RIGHT_JOIN'), " ").concat(table, " ").concat(this.$utils().constants('ON'), " ").concat(pk, " = ").concat(fk));
380
411
  return this;
381
412
  };
382
413
  Database.prototype.leftJoin = function (pk, fk) {
383
414
  var _a;
384
415
  var table = (_a = fk.split('.')) === null || _a === void 0 ? void 0 : _a.shift();
385
416
  if (this.$db.get('JOIN'))
386
- this.$db.set('JOIN', this.$db.get('JOIN') + " " + this.$utils().constants('LEFT_JOIN') + " " + table + " " + this.$utils().constants('ON') + " " + pk + " = " + fk);
417
+ this.$db.set('JOIN', "".concat(this.$db.get('JOIN'), " ").concat(this.$utils().constants('LEFT_JOIN'), " ").concat(table, " ").concat(this.$utils().constants('ON'), " ").concat(pk, " = ").concat(fk));
387
418
  else
388
- this.$db.set('JOIN', this.$utils().constants('LEFT_JOIN') + " " + table + " " + this.$utils().constants('ON') + " " + pk + " = " + fk);
419
+ this.$db.set('JOIN', "".concat(this.$utils().constants('LEFT_JOIN'), " ").concat(table, " ").concat(this.$utils().constants('ON'), " ").concat(pk, " = ").concat(fk));
389
420
  return this;
390
421
  };
391
422
  Database.prototype.crossJoin = function (pk, fk) {
392
423
  var _a;
393
424
  var table = (_a = fk.split('.')) === null || _a === void 0 ? void 0 : _a.shift();
394
425
  if (this.$db.get('JOIN'))
395
- this.$db.set('JOIN', this.$db.get('JOIN') + " " + this.$utils().constants('CROSS_JOIN') + " " + table + " " + this.$utils().constants('ON') + " " + pk + " = " + fk);
426
+ this.$db.set('JOIN', "".concat(this.$db.get('JOIN'), " ").concat(this.$utils().constants('CROSS_JOIN'), " ").concat(table, " ").concat(this.$utils().constants('ON'), " ").concat(pk, " = ").concat(fk));
396
427
  else
397
- this.$db.set('JOIN', this.$utils().constants('CROSS_JOIN') + " " + table + " " + this.$utils().constants('ON') + " " + pk + " = " + fk);
428
+ this.$db.set('JOIN', "".concat(this.$utils().constants('CROSS_JOIN'), " ").concat(table, " ").concat(this.$utils().constants('ON'), " ").concat(pk, " = ").concat(fk));
398
429
  return this;
399
430
  };
400
431
  Database.prototype.orderBy = function (column, order) {
401
432
  if (order === void 0) { order = this.$utils().constants('ASC'); }
402
- this.$db.set('ORDER_BY', this.$utils().constants('ORDER_BY') + " " + column + " " + order.toUpperCase());
433
+ this.$db.set('ORDER_BY', "".concat(this.$utils().constants('ORDER_BY'), " ").concat(column, " ").concat(order.toUpperCase()));
403
434
  return this;
404
435
  };
405
436
  Database.prototype.latest = function (column) {
406
437
  if (column === void 0) { column = 'id'; }
407
438
  if (this.$db.get('ORDER_BY')) {
408
- this.$db.set('ORDER_BY', this.$db.get('ORDER_BY') + " ," + column + " " + this.$utils().constants('DESC'));
439
+ this.$db.set('ORDER_BY', "".concat(this.$db.get('ORDER_BY'), " ,").concat(column, " ").concat(this.$utils().constants('DESC')));
409
440
  return this;
410
441
  }
411
- this.$db.set('ORDER_BY', this.$utils().constants('ORDER_BY') + " " + column + " " + this.$utils().constants('DESC'));
442
+ this.$db.set('ORDER_BY', "".concat(this.$utils().constants('ORDER_BY'), " ").concat(column, " ").concat(this.$utils().constants('DESC')));
412
443
  return this;
413
444
  };
414
445
  Database.prototype.oldest = function (column) {
415
446
  if (column === void 0) { column = 'id'; }
416
447
  if (this.$db.get('ORDER_BY')) {
417
- this.$db.set('ORDER_BY', this.$db.get('ORDER_BY') + " ," + column + " " + this.$utils().constants('ASC'));
448
+ this.$db.set('ORDER_BY', "".concat(this.$db.get('ORDER_BY'), " ,").concat(column, " ").concat(this.$utils().constants('ASC')));
418
449
  return this;
419
450
  }
420
- this.$db.set('ORDER_BY', this.$utils().constants('ORDER_BY') + " " + column + " " + this.$utils().constants('ASC'));
451
+ this.$db.set('ORDER_BY', "".concat(this.$utils().constants('ORDER_BY'), " ").concat(column, " ").concat(this.$utils().constants('ASC')));
421
452
  return this;
422
453
  };
423
454
  Database.prototype.groupBy = function (column) {
424
- this.$db.set('GROUP_BY', this.$utils().constants('GROUP_BY') + " " + column);
455
+ this.$db.set('GROUP_BY', "".concat(this.$utils().constants('GROUP_BY'), " ").concat(column));
425
456
  return this;
426
457
  };
427
458
  Database.prototype.limit = function (number) {
428
459
  if (number === void 0) { number = 1; }
429
- this.$db.set('LIMIT', this.$utils().constants('LIMIT') + " " + number);
460
+ this.$db.set('LIMIT', "".concat(this.$utils().constants('LIMIT'), " ").concat(number));
430
461
  return this;
431
462
  };
432
463
  Database.prototype.offset = function (number) {
433
464
  if (number === void 0) { number = 1; }
434
- this.$db.set('OFFSET', this.$utils().constants('OFFSET') + " " + number);
465
+ this.$db.set('OFFSET', "".concat(this.$utils().constants('OFFSET'), " ").concat(number));
435
466
  return this;
436
467
  };
437
468
  Database.prototype.hidden = function () {
@@ -444,31 +475,31 @@ var Database = /** @class */ (function (_super) {
444
475
  };
445
476
  Database.prototype.update = function (objects) {
446
477
  var query = this._queryUpdate(objects);
447
- this.$db.set('UPDATE', this.$utils().constants('UPDATE') + " " + this.$db.get('TABLE_NAME') + " " + query);
478
+ this.$db.set('UPDATE', "".concat(this.$utils().constants('UPDATE'), " ").concat(this.$db.get('TABLE_NAME'), " ").concat(query));
448
479
  this.$db.set('SAVE', 'UPDATE');
449
480
  return this;
450
481
  };
451
482
  Database.prototype.insert = function (objects) {
452
483
  var query = this._queryInsert(objects);
453
- this.$db.set('INSERT', this.$utils().constants('INSERT') + " " + this.$db.get('TABLE_NAME') + " " + query);
484
+ this.$db.set('INSERT', "".concat(this.$utils().constants('INSERT'), " ").concat(this.$db.get('TABLE_NAME'), " ").concat(query));
454
485
  this.$db.set('SAVE', 'INSERT');
455
486
  return this;
456
487
  };
457
488
  Database.prototype.create = function (objects) {
458
489
  var query = this._queryInsert(objects);
459
- this.$db.set('INSERT', this.$utils().constants('INSERT') + " " + this.$db.get('TABLE_NAME') + " " + query);
490
+ this.$db.set('INSERT', "".concat(this.$utils().constants('INSERT'), " ").concat(this.$db.get('TABLE_NAME'), " ").concat(query));
460
491
  this.$db.set('SAVE', 'INSERT');
461
492
  return this;
462
493
  };
463
494
  Database.prototype.createMultiple = function (data) {
464
495
  var query = this._queryInsertMultiple(data);
465
- this.$db.set('INSERT', this.$utils().constants('INSERT') + " " + this.$db.get('TABLE_NAME') + " " + query);
496
+ this.$db.set('INSERT', "".concat(this.$utils().constants('INSERT'), " ").concat(this.$db.get('TABLE_NAME'), " ").concat(query));
466
497
  this.$db.set('SAVE', 'INSERT_MULTIPLE');
467
498
  return this;
468
499
  };
469
500
  Database.prototype.insertMultiple = function (data) {
470
501
  var query = this._queryInsertMultiple(data);
471
- this.$db.set('INSERT', this.$utils().constants('INSERT') + " " + this.$db.get('TABLE_NAME') + " " + query);
502
+ this.$db.set('INSERT', "".concat(this.$utils().constants('INSERT'), " ").concat(this.$db.get('TABLE_NAME'), " ").concat(query));
472
503
  this.$db.set('SAVE', 'INSERT_MULTIPLE');
473
504
  return this;
474
505
  };
@@ -495,7 +526,7 @@ var Database = /** @class */ (function (_super) {
495
526
  };
496
527
  Database.prototype.createNotExists = function (objects) {
497
528
  var query = this._queryInsert(objects);
498
- this.$db.set('INSERT', this.$utils().constants('INSERT') + " " + this.$db.get('TABLE_NAME') + " " + query);
529
+ this.$db.set('INSERT', "".concat(this.$utils().constants('INSERT'), " ").concat(this.$db.get('TABLE_NAME'), " ").concat(query));
499
530
  this.$db.set('SAVE', 'INSERT_NOT_EXISTS');
500
531
  return this;
501
532
  };
@@ -506,16 +537,16 @@ var Database = /** @class */ (function (_super) {
506
537
  Database.prototype.upsert = function (objects) {
507
538
  var queryUpdate = this._queryUpdate(objects);
508
539
  var queryInsert = this._queryInsert(objects);
509
- this.$db.set('INSERT', this.$utils().constants('INSERT') + " " + this.$db.get('TABLE_NAME') + " " + queryInsert);
510
- this.$db.set('UPDATE', this.$utils().constants('UPDATE') + " " + this.$db.get('TABLE_NAME') + " " + queryUpdate);
540
+ this.$db.set('INSERT', "".concat(this.$utils().constants('INSERT'), " ").concat(this.$db.get('TABLE_NAME'), " ").concat(queryInsert));
541
+ this.$db.set('UPDATE', "".concat(this.$utils().constants('UPDATE'), " ").concat(this.$db.get('TABLE_NAME'), " ").concat(queryUpdate));
511
542
  this.$db.set('SAVE', 'UPDATE_OR_INSERT');
512
543
  return this;
513
544
  };
514
545
  Database.prototype.updateOrCreate = function (objects) {
515
546
  var queryUpdate = this._queryUpdate(objects);
516
547
  var queryInsert = this._queryInsert(objects);
517
- this.$db.set('INSERT', this.$utils().constants('INSERT') + " " + this.$db.get('TABLE_NAME') + " " + queryInsert);
518
- this.$db.set('UPDATE', this.$utils().constants('UPDATE') + " " + this.$db.get('TABLE_NAME') + " " + queryUpdate);
548
+ this.$db.set('INSERT', "".concat(this.$utils().constants('INSERT'), " ").concat(this.$db.get('TABLE_NAME'), " ").concat(queryInsert));
549
+ this.$db.set('UPDATE', "".concat(this.$utils().constants('UPDATE'), " ").concat(this.$db.get('TABLE_NAME'), " ").concat(queryUpdate));
519
550
  this.$db.set('SAVE', 'UPDATE_OR_INSERT');
520
551
  return this;
521
552
  };
@@ -549,8 +580,8 @@ var Database = /** @class */ (function (_super) {
549
580
  return __generator(this, function (_a) {
550
581
  switch (_a.label) {
551
582
  case 0:
552
- query = this.$utils().constants('SET') + " " + column + " = " + column + " + " + value;
553
- this.$db.set('UPDATE', this.$utils().constants('UPDATE') + " " + this.$db.get('TABLE_NAME') + " " + query);
583
+ query = "".concat(this.$utils().constants('SET'), " ").concat(column, " = ").concat(column, " + ").concat(value);
584
+ this.$db.set('UPDATE', "".concat(this.$utils().constants('UPDATE'), " ").concat(this.$db.get('TABLE_NAME'), " ").concat(query));
554
585
  return [4 /*yield*/, this._update(true)];
555
586
  case 1: return [2 /*return*/, _a.sent()];
556
587
  }
@@ -565,8 +596,8 @@ var Database = /** @class */ (function (_super) {
565
596
  return __generator(this, function (_a) {
566
597
  switch (_a.label) {
567
598
  case 0:
568
- query = this.$utils().constants('SET') + " " + column + " = " + column + " - " + value;
569
- this.$db.set('UPDATE', this.$utils().constants('UPDATE') + " " + this.$db.get('TABLE_NAME') + " " + query);
599
+ query = "".concat(this.$utils().constants('SET'), " ").concat(column, " = ").concat(column, " - ").concat(value);
600
+ this.$db.set('UPDATE', "".concat(this.$utils().constants('UPDATE'), " ").concat(this.$db.get('TABLE_NAME'), " ").concat(query));
570
601
  return [4 /*yield*/, this._update(true)];
571
602
  case 1: return [2 /*return*/, _a.sent()];
572
603
  }
@@ -579,7 +610,7 @@ var Database = /** @class */ (function (_super) {
579
610
  return __generator(this, function (_a) {
580
611
  switch (_a.label) {
581
612
  case 0:
582
- sql = this.$utils().constants('SELECT') + " * " + this.$utils().constants('FROM') + " " + this.$db.get('TABLE_NAME');
613
+ sql = "".concat(this.$utils().constants('SELECT'), " * ").concat(this.$utils().constants('FROM'), " ").concat(this.$db.get('TABLE_NAME'));
583
614
  return [4 /*yield*/, this._queryStatement(sql)];
584
615
  case 1: return [2 /*return*/, _a.sent()];
585
616
  }
@@ -592,7 +623,7 @@ var Database = /** @class */ (function (_super) {
592
623
  return __generator(this, function (_a) {
593
624
  switch (_a.label) {
594
625
  case 0:
595
- sql = this.$utils().constants('SELECT') + " * " + this.$utils().constants('FROM') + " " + this.$db.get('TABLE_NAME') + " " + this.$utils().constants('WHERE') + " id = " + id;
626
+ sql = "".concat(this.$utils().constants('SELECT'), " * ").concat(this.$utils().constants('FROM'), " ").concat(this.$db.get('TABLE_NAME'), " ").concat(this.$utils().constants('WHERE'), " id = ").concat(id);
596
627
  return [4 /*yield*/, this._queryStatement(sql)];
597
628
  case 1:
598
629
  result = _a.sent();
@@ -609,16 +640,18 @@ var Database = /** @class */ (function (_super) {
609
640
  return __generator(this, function (_f) {
610
641
  switch (_f.label) {
611
642
  case 0:
643
+ page = +page;
644
+ limit = +limit;
612
645
  currentPage = page;
613
646
  nextPage = currentPage + 1;
614
647
  prevPage = currentPage - 1 === 0 ? 1 : currentPage - 1;
615
648
  offset = (page - 1) * limit;
616
649
  sql = this._getSQL();
617
650
  if (!sql.includes(this.$utils().constants('LIMIT'))) {
618
- sql = sql + " " + this.$utils().constants('LIMIT') + " " + limit + " " + this.$utils().constants('OFFSET') + " " + offset;
651
+ sql = "".concat(sql, " ").concat(this.$utils().constants('LIMIT'), " ").concat(limit, " ").concat(this.$utils().constants('OFFSET'), " ").concat(offset);
619
652
  }
620
653
  else {
621
- sql = sql.replace(this.$db.get('LIMIT'), limit + " " + this.$utils().constants('OFFSET') + " " + offset);
654
+ sql = sql.replace(this.$db.get('LIMIT'), "".concat(limit, " ").concat(this.$utils().constants('OFFSET'), " ").concat(offset));
622
655
  }
623
656
  return [4 /*yield*/, this._queryStatement(sql)];
624
657
  case 1:
@@ -638,7 +671,7 @@ var Database = /** @class */ (function (_super) {
638
671
  },
639
672
  data: []
640
673
  }];
641
- this.$db.set('SELECT', this.$utils().constants('SELECT') + " " + this.$utils().constants('COUNT') + "(*) " + this.$utils().constants('AS') + " total");
674
+ this.$db.set('SELECT', "".concat(this.$utils().constants('SELECT'), " ").concat(this.$utils().constants('COUNT'), "(*) ").concat(this.$utils().constants('AS'), " total"));
642
675
  sql = this._getSQL();
643
676
  return [4 /*yield*/, this._queryStatement(sql)];
644
677
  case 2:
@@ -681,9 +714,9 @@ var Database = /** @class */ (function (_super) {
681
714
  case 0:
682
715
  sql = this._getSQL();
683
716
  if (!sql.includes(this.$utils().constants('LIMIT')))
684
- sql = sql + " " + this.$utils().constants('LIMIT') + " 1";
717
+ sql = "".concat(sql, " ").concat(this.$utils().constants('LIMIT'), " 1");
685
718
  else
686
- sql = sql.replace(this.$db.get('LIMIT'), this.$utils().constants('LIMIT') + " 1");
719
+ sql = sql.replace(this.$db.get('LIMIT'), "".concat(this.$utils().constants('LIMIT'), " 1"));
687
720
  return [4 /*yield*/, this._queryStatement(sql)];
688
721
  case 1:
689
722
  result = _b.sent();
@@ -707,7 +740,8 @@ var Database = /** @class */ (function (_super) {
707
740
  Database.prototype.get = function () {
708
741
  var _a;
709
742
  return __awaiter(this, void 0, void 0, function () {
710
- var sql, result;
743
+ var sql, result, data;
744
+ var _this = this;
711
745
  return __generator(this, function (_b) {
712
746
  switch (_b.label) {
713
747
  case 0:
@@ -717,6 +751,16 @@ var Database = /** @class */ (function (_super) {
717
751
  result = _b.sent();
718
752
  if ((_a = this.$db.get('HIDDEN')) === null || _a === void 0 ? void 0 : _a.length)
719
753
  this._hiddenColumn(result);
754
+ if (this.$db.get('CHUNK')) {
755
+ data = result.reduce(function (resultArray, item, index) {
756
+ var chunkIndex = Math.floor(index / _this.$db.get('CHUNK'));
757
+ if (!resultArray[chunkIndex])
758
+ resultArray[chunkIndex] = [];
759
+ resultArray[chunkIndex].push(item);
760
+ return resultArray;
761
+ }, []);
762
+ return [2 /*return*/, data || []];
763
+ }
720
764
  return [2 /*return*/, result || []];
721
765
  }
722
766
  });
@@ -757,7 +801,7 @@ var Database = /** @class */ (function (_super) {
757
801
  return __generator(this, function (_a) {
758
802
  switch (_a.label) {
759
803
  case 0:
760
- this.$db.set('SELECT', this.$utils().constants('SELECT') + " " + column);
804
+ this.$db.set('SELECT', "".concat(this.$utils().constants('SELECT'), " ").concat(column));
761
805
  sql = this._getSQL();
762
806
  return [4 /*yield*/, this._queryStatement(sql)];
763
807
  case 1:
@@ -775,7 +819,7 @@ var Database = /** @class */ (function (_super) {
775
819
  return __generator(this, function (_a) {
776
820
  switch (_a.label) {
777
821
  case 0:
778
- this.$db.set('SELECT', this.$utils().constants('SELECT') + " " + this.$utils().constants('COUNT') + "(" + column + ") " + this.$utils().constants('AS') + " total");
822
+ this.$db.set('SELECT', "".concat(this.$utils().constants('SELECT'), " ").concat(this.$utils().constants('COUNT'), "(").concat(column, ") ").concat(this.$utils().constants('AS'), " total"));
779
823
  sql = this._getSQL();
780
824
  return [4 /*yield*/, this._queryStatement(sql)];
781
825
  case 1:
@@ -791,7 +835,7 @@ var Database = /** @class */ (function (_super) {
791
835
  return __generator(this, function (_a) {
792
836
  switch (_a.label) {
793
837
  case 0:
794
- sql = this.$utils().constants('SELECT') + " " + this.$utils().constants('EXISTS') + "(" + this.$utils().constants('SELECT') + " * " + this.$db.get('FROM') + " " + this.$db.get('TABLE_NAME') + " " + this.$db.get('WHERE') + " LIMIT 1) as 'exists'";
838
+ sql = "".concat(this.$utils().constants('SELECT'), " ").concat(this.$utils().constants('EXISTS'), "(").concat(this.$utils().constants('SELECT'), " * ").concat(this.$db.get('FROM'), " ").concat(this.$db.get('TABLE_NAME'), " ").concat(this.$db.get('WHERE'), " ").concat(this.$utils().constants('LIMIT'), " 1) as 'exists'");
795
839
  return [4 /*yield*/, this._queryStatement(sql)];
796
840
  case 1:
797
841
  result = _a.sent();
@@ -807,7 +851,7 @@ var Database = /** @class */ (function (_super) {
807
851
  return __generator(this, function (_a) {
808
852
  switch (_a.label) {
809
853
  case 0:
810
- this.$db.set('SELECT', this.$utils().constants('SELECT') + " " + this.$utils().constants('AVG') + "(" + column + ") " + this.$utils().constants('AS') + " avg");
854
+ this.$db.set('SELECT', "".concat(this.$utils().constants('SELECT'), " ").concat(this.$utils().constants('AVG'), "(").concat(column, ") ").concat(this.$utils().constants('AS'), " avg"));
811
855
  sql = this._getSQL();
812
856
  return [4 /*yield*/, this._queryStatement(sql)];
813
857
  case 1:
@@ -824,7 +868,7 @@ var Database = /** @class */ (function (_super) {
824
868
  return __generator(this, function (_a) {
825
869
  switch (_a.label) {
826
870
  case 0:
827
- this.$db.set('SELECT', this.$utils().constants('SELECT') + " " + this.$utils().constants('SUM') + "(" + column + ") " + this.$utils().constants('AS') + " sum");
871
+ this.$db.set('SELECT', "".concat(this.$utils().constants('SELECT'), " ").concat(this.$utils().constants('SUM'), "(").concat(column, ") ").concat(this.$utils().constants('AS'), " sum"));
828
872
  sql = this._getSQL();
829
873
  return [4 /*yield*/, this._queryStatement(sql)];
830
874
  case 1:
@@ -841,7 +885,7 @@ var Database = /** @class */ (function (_super) {
841
885
  return __generator(this, function (_a) {
842
886
  switch (_a.label) {
843
887
  case 0:
844
- this.$db.set('SELECT', this.$utils().constants('SELECT') + " " + this.$utils().constants('MAX') + "(" + column + ") " + this.$utils().constants('AS') + " max");
888
+ this.$db.set('SELECT', "".concat(this.$utils().constants('SELECT'), " ").concat(this.$utils().constants('MAX'), "(").concat(column, ") ").concat(this.$utils().constants('AS'), " max"));
845
889
  sql = this._getSQL();
846
890
  return [4 /*yield*/, this._queryStatement(sql)];
847
891
  case 1:
@@ -858,7 +902,7 @@ var Database = /** @class */ (function (_super) {
858
902
  return __generator(this, function (_a) {
859
903
  switch (_a.label) {
860
904
  case 0:
861
- this.$db.set('SELECT', this.$utils().constants('SELECT') + " " + this.$utils().constants('MIN') + "(" + column + ") " + this.$utils().constants('AS') + " min");
905
+ this.$db.set('SELECT', "".concat(this.$utils().constants('SELECT'), " ").concat(this.$utils().constants('MIN'), "(").concat(column, ") ").concat(this.$utils().constants('AS'), " min"));
862
906
  sql = this._getSQL();
863
907
  return [4 /*yield*/, this._queryStatement(sql)];
864
908
  case 1:
@@ -877,7 +921,25 @@ var Database = /** @class */ (function (_super) {
877
921
  case 0:
878
922
  if (!this.$db.get('WHERE'))
879
923
  throw new Error("Can't delete without where condition");
880
- this.$db.set('DELETE', this.$utils().constants('DELETE') + " " + this.$db.get('FROM') + " " + this.$db.get('TABLE_NAME') + " " + this.$db.get('WHERE'));
924
+ this.$db.set('DELETE', "".concat(this.$utils().constants('DELETE'), " ").concat(this.$db.get('FROM'), " ").concat(this.$db.get('TABLE_NAME'), " ").concat(this.$db.get('WHERE')));
925
+ return [4 /*yield*/, this._actionStatement({ sql: this.$db.get('DELETE') })];
926
+ case 1:
927
+ result = _b.sent();
928
+ if (result)
929
+ return [2 /*return*/, (_a = !!result) !== null && _a !== void 0 ? _a : false];
930
+ return [2 /*return*/, false];
931
+ }
932
+ });
933
+ });
934
+ };
935
+ Database.prototype.forceDelete = function () {
936
+ var _a;
937
+ return __awaiter(this, void 0, void 0, function () {
938
+ var result;
939
+ return __generator(this, function (_b) {
940
+ switch (_b.label) {
941
+ case 0:
942
+ this.$db.set('DELETE', "".concat(this.$utils().constants('DELETE'), " ").concat(this.$db.get('FROM'), " ").concat(this.$db.get('TABLE_NAME'), " ").concat(this.$db.get('WHERE')));
881
943
  return [4 /*yield*/, this._actionStatement({ sql: this.$db.get('DELETE') })];
882
944
  case 1:
883
945
  result = _b.sent();
@@ -894,8 +956,8 @@ var Database = /** @class */ (function (_super) {
894
956
  return __generator(this, function (_a) {
895
957
  switch (_a.label) {
896
958
  case 0:
897
- this.$db.set('GROUP_BY', this.$utils().constants('GROUP_BY') + " " + column);
898
- this.$db.set('SELECT', this.$db.get('SELECT') + (", " + this.$utils().constants('GROUP_CONCAT') + "(id) " + this.$utils().constants('AS') + " data"));
959
+ this.$db.set('GROUP_BY', "".concat(this.$utils().constants('GROUP_BY'), " ").concat(column));
960
+ this.$db.set('SELECT', this.$db.get('SELECT') + ", ".concat(this.$utils().constants('GROUP_CONCAT'), "(id) ").concat(this.$utils().constants('AS'), " data"));
899
961
  sql = this._getSQL();
900
962
  return [4 /*yield*/, this._queryStatement(sql)];
901
963
  case 1:
@@ -906,7 +968,7 @@ var Database = /** @class */ (function (_super) {
906
968
  var splits = (_b = (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.split(',')) !== null && _b !== void 0 ? _b : '0';
907
969
  splits.forEach(function (split) { return data = __spreadArray(__spreadArray([], __read(data), false), [split], false); });
908
970
  });
909
- sqlGroups = this.$utils().constants('SELECT') + " * " + this.$utils().constants('FROM') + " " + this.$db.get('TABLE_NAME') + " " + this.$utils().constants('WHERE') + " id " + this.$utils().constants('IN') + " (" + (data.map(function (a) { return "'" + a + "'"; }).join(',') || ['0']) + ")";
971
+ sqlGroups = "".concat(this.$utils().constants('SELECT'), " * ").concat(this.$utils().constants('FROM'), " ").concat(this.$db.get('TABLE_NAME'), " ").concat(this.$utils().constants('WHERE'), " id ").concat(this.$utils().constants('IN'), " (").concat(data.map(function (a) { return "'".concat(a, "'"); }).join(',') || ['0'], ")");
910
972
  return [4 /*yield*/, this._queryStatement(sqlGroups)];
911
973
  case 2:
912
974
  groups = _a.sent();
@@ -947,12 +1009,12 @@ var Database = /** @class */ (function (_super) {
947
1009
  if ((_a = Object.keys(attributes)) === null || _a === void 0 ? void 0 : _a.length) {
948
1010
  if (this.$db.get('WHERE')) {
949
1011
  query_1 = this._queryUpdate(attributes);
950
- this.$db.set('UPDATE', this.$utils().constants('UPDATE') + " " + this.$db.get('TABLE_NAME') + " " + query_1);
1012
+ this.$db.set('UPDATE', "".concat(this.$utils().constants('UPDATE'), " ").concat(this.$db.get('TABLE_NAME'), " ").concat(query_1));
951
1013
  this.$db.set('SAVE', 'UPDATE');
952
1014
  return [2 /*return*/];
953
1015
  }
954
1016
  query = this._queryInsert(attributes);
955
- this.$db.set('INSERT', this.$utils().constants('INSERT') + " " + this.$db.get('TABLE_NAME') + " " + query);
1017
+ this.$db.set('INSERT', "".concat(this.$utils().constants('INSERT'), " ").concat(this.$db.get('TABLE_NAME'), " ").concat(query));
956
1018
  this.$db.set('SAVE', 'INSERT');
957
1019
  }
958
1020
  _b = this.$db.get('SAVE');
@@ -994,7 +1056,7 @@ var Database = /** @class */ (function (_super) {
994
1056
  if (!(round < rounds)) return [3 /*break*/, 4];
995
1057
  if (this.$db.get('TABLE_NAME') === '' || this.$db.get('TABLE_NAME') == null)
996
1058
  throw new Error("unknow table");
997
- sql = this.$utils().constants('SHOW') + " " + this.$utils().constants('FIELDS') + " " + this.$utils().constants('FROM') + " " + this.$db.get('TABLE_NAME');
1059
+ sql = "".concat(this.$utils().constants('SHOW'), " ").concat(this.$utils().constants('FIELDS'), " ").concat(this.$utils().constants('FROM'), " ").concat(this.$db.get('TABLE_NAME'));
998
1060
  return [4 /*yield*/, this._queryStatement(sql)];
999
1061
  case 2:
1000
1062
  fields = _d.sent();
@@ -1023,7 +1085,7 @@ var Database = /** @class */ (function (_super) {
1023
1085
  return [3 /*break*/, 1];
1024
1086
  case 4:
1025
1087
  query = this._queryInsertMultiple(data);
1026
- this.$db.set('INSERT', this.$utils().constants('INSERT') + " " + this.$db.get('TABLE_NAME') + " " + query);
1088
+ this.$db.set('INSERT', "".concat(this.$utils().constants('INSERT'), " ").concat(this.$db.get('TABLE_NAME'), " ").concat(query));
1027
1089
  this.$db.set('SAVE', 'INSERT_MULTIPLE');
1028
1090
  return [2 /*return*/, this.save()];
1029
1091
  }
@@ -1036,7 +1098,7 @@ var Database = /** @class */ (function (_super) {
1036
1098
  return __generator(this, function (_a) {
1037
1099
  switch (_a.label) {
1038
1100
  case 0:
1039
- sql = "TRUNCATE TABLE " + this.$db.get('TABLE_NAME');
1101
+ sql = "TRUNCATE TABLE ".concat(this.$db.get('TABLE_NAME'));
1040
1102
  return [4 /*yield*/, this._queryStatement(sql)];
1041
1103
  case 1:
1042
1104
  _a.sent();
@@ -1051,7 +1113,7 @@ var Database = /** @class */ (function (_super) {
1051
1113
  return __generator(this, function (_a) {
1052
1114
  switch (_a.label) {
1053
1115
  case 0:
1054
- sql = "DROP TABLE " + this.$db.get('TABLE_NAME');
1116
+ sql = "DROP TABLE ".concat(this.$db.get('TABLE_NAME'));
1055
1117
  return [4 /*yield*/, this._queryStatement(sql)];
1056
1118
  case 1:
1057
1119
  _a.sent();
@@ -1071,7 +1133,7 @@ var Database = /** @class */ (function (_super) {
1071
1133
  throw new Error("Can't insert not exists without where condition");
1072
1134
  sql = '';
1073
1135
  check = false;
1074
- sql = this.$utils().constants('SELECT') + " " + this.$utils().constants('EXISTS') + "(" + this.$utils().constants('SELECT') + " * " + this.$db.get('FROM') + " " + this.$db.get('TABLE_NAME') + " " + this.$db.get('WHERE') + " " + this.$utils().constants('LIMIT') + " 1) " + this.$utils().constants('AS') + " 'exists'";
1136
+ sql = "".concat(this.$utils().constants('SELECT'), " ").concat(this.$utils().constants('EXISTS'), "(").concat(this.$utils().constants('SELECT'), " * ").concat(this.$db.get('FROM'), " ").concat(this.$db.get('TABLE_NAME'), " ").concat(this.$db.get('WHERE'), " ").concat(this.$utils().constants('LIMIT'), " 1) ").concat(this.$utils().constants('AS'), " 'exists'");
1075
1137
  return [4 /*yield*/, this._queryStatement(sql)];
1076
1138
  case 1:
1077
1139
  _b = __read.apply(void 0, [_e.sent(), 1]), result = _b[0].exists;
@@ -1092,7 +1154,7 @@ var Database = /** @class */ (function (_super) {
1092
1154
  });
1093
1155
  }
1094
1156
  if (!result_1) return [3 /*break*/, 5];
1095
- sql_1 = this.$db.get('SELECT') + " " + this.$db.get('FROM') + " " + this.$db.get('TABLE_NAME') + " " + this.$utils().constants('WHERE') + " id = " + id;
1157
+ sql_1 = "".concat(this.$db.get('SELECT'), " ").concat(this.$db.get('FROM'), " ").concat(this.$db.get('TABLE_NAME'), " ").concat(this.$utils().constants('WHERE'), " id = ").concat(id);
1096
1158
  return [4 /*yield*/, this._queryStatement(sql_1)];
1097
1159
  case 4:
1098
1160
  data = _e.sent();
@@ -1182,7 +1244,7 @@ var Database = /** @class */ (function (_super) {
1182
1244
  });
1183
1245
  }
1184
1246
  if (!result) return [3 /*break*/, 3];
1185
- sql = this.$db.get('SELECT') + " " + this.$db.get('FROM') + " " + this.$db.get('TABLE_NAME') + " " + this.$utils().constants('WHERE') + " id = " + id;
1247
+ sql = "".concat(this.$db.get('SELECT'), " ").concat(this.$db.get('FROM'), " ").concat(this.$db.get('TABLE_NAME'), " ").concat(this.$utils().constants('WHERE'), " id = ").concat(id);
1186
1248
  return [4 /*yield*/, this._queryStatement(sql)];
1187
1249
  case 2:
1188
1250
  data = _b.sent();
@@ -1223,7 +1285,7 @@ var Database = /** @class */ (function (_super) {
1223
1285
  }
1224
1286
  finally { if (e_2) throw e_2.error; }
1225
1287
  }
1226
- sql = this.$db.get('SELECT') + " " + this.$db.get('FROM') + " " + this.$db.get('TABLE_NAME') + " " + this.$utils().constants('WHERE') + " id " + this.$utils().constants('IN') + " (" + arrayId + ")";
1288
+ sql = "".concat(this.$db.get('SELECT'), " ").concat(this.$db.get('FROM'), " ").concat(this.$db.get('TABLE_NAME'), " ").concat(this.$utils().constants('WHERE'), " id ").concat(this.$utils().constants('IN'), " (").concat(arrayId, ")");
1227
1289
  return [4 /*yield*/, this._queryStatement(sql)];
1228
1290
  case 2:
1229
1291
  data = _c.sent();
@@ -1246,7 +1308,7 @@ var Database = /** @class */ (function (_super) {
1246
1308
  throw new Error("Can't update or insert without where condition");
1247
1309
  sql = '';
1248
1310
  check = false;
1249
- sql = this.$utils().constants('SELECT') + " " + this.$utils().constants('EXISTS') + "(" + this.$utils().constants('SELECT') + " * " + this.$db.get('FROM') + " " + this.$db.get('TABLE_NAME') + " " + this.$db.get('WHERE') + " " + this.$utils().constants('LIMIT') + " 1) " + this.$utils().constants('AS') + " 'exists'";
1311
+ sql = "".concat(this.$utils().constants('SELECT'), " ").concat(this.$utils().constants('EXISTS'), "(").concat(this.$utils().constants('SELECT'), " * ").concat(this.$db.get('FROM'), " ").concat(this.$db.get('TABLE_NAME'), " ").concat(this.$db.get('WHERE'), " ").concat(this.$utils().constants('LIMIT'), " 1) ").concat(this.$utils().constants('AS'), " 'exists'");
1250
1312
  return [4 /*yield*/, this._queryStatement(sql)];
1251
1313
  case 1:
1252
1314
  _a = __read.apply(void 0, [_e.sent(), 1]), result = _a[0].exists;
@@ -1267,7 +1329,7 @@ var Database = /** @class */ (function (_super) {
1267
1329
  });
1268
1330
  }
1269
1331
  if (!result_4) return [3 /*break*/, 5];
1270
- sql_2 = this.$db.get('SELECT') + " " + this.$db.get('FROM') + " " + this.$db.get('TABLE_NAME') + " " + this.$utils().constants('WHERE') + " id = " + id;
1332
+ sql_2 = "".concat(this.$db.get('SELECT'), " ").concat(this.$db.get('FROM'), " ").concat(this.$db.get('TABLE_NAME'), " ").concat(this.$utils().constants('WHERE'), " id = ").concat(id);
1271
1333
  return [4 /*yield*/, this._queryStatement(sql_2)];
1272
1334
  case 4:
1273
1335
  data = _e.sent();
@@ -1275,11 +1337,11 @@ var Database = /** @class */ (function (_super) {
1275
1337
  this.$db.set('RESULT', resultData);
1276
1338
  return [2 /*return*/, resultData];
1277
1339
  case 5: return [2 /*return*/, null];
1278
- case 6: return [4 /*yield*/, this._actionStatement({ sql: this.$db.get('UPDATE') + " " + this.$db.get('WHERE') })];
1340
+ case 6: return [4 /*yield*/, this._actionStatement({ sql: "".concat(this.$db.get('UPDATE'), " ").concat(this.$db.get('WHERE')) })];
1279
1341
  case 7:
1280
1342
  result_5 = _e.sent();
1281
1343
  if (!result_5) return [3 /*break*/, 9];
1282
- return [4 /*yield*/, this._queryStatement(this.$db.get('SELECT') + " " + this.$db.get('FROM') + " " + this.$db.get('TABLE_NAME') + " " + this.$db.get('WHERE'))];
1344
+ return [4 /*yield*/, this._queryStatement("".concat(this.$db.get('SELECT'), " ").concat(this.$db.get('FROM'), " ").concat(this.$db.get('TABLE_NAME'), " ").concat(this.$db.get('WHERE')))];
1283
1345
  case 8:
1284
1346
  data = _e.sent();
1285
1347
  if ((data === null || data === void 0 ? void 0 : data.length) > 1) {
@@ -1319,11 +1381,11 @@ var Database = /** @class */ (function (_super) {
1319
1381
  case 0:
1320
1382
  if (!this.$db.get('WHERE') && !ignoreWhere)
1321
1383
  throw new Error("Can't update without where condition");
1322
- return [4 /*yield*/, this._actionStatement({ sql: this.$db.get('UPDATE') + " " + this.$db.get('WHERE') })];
1384
+ return [4 /*yield*/, this._actionStatement({ sql: "".concat(this.$db.get('UPDATE'), " ").concat(this.$db.get('WHERE')) })];
1323
1385
  case 1:
1324
1386
  result = _a.sent();
1325
1387
  if (!result) return [3 /*break*/, 3];
1326
- return [4 /*yield*/, this._queryStatement(this.$db.get('SELECT') + " " + this.$db.get('FROM') + " " + this.$db.get('TABLE_NAME') + " " + this.$db.get('WHERE'))];
1388
+ return [4 /*yield*/, this._queryStatement("".concat(this.$db.get('SELECT'), " ").concat(this.$db.get('FROM'), " ").concat(this.$db.get('TABLE_NAME'), " ").concat(this.$db.get('WHERE')))];
1327
1389
  case 2:
1328
1390
  data = _a.sent();
1329
1391
  if ((data === null || data === void 0 ? void 0 : data.length) > 1)
@@ -1352,21 +1414,21 @@ var Database = /** @class */ (function (_super) {
1352
1414
  var _this = this;
1353
1415
  var keyValue = Object.entries(data).map(function (_a) {
1354
1416
  var _b = __read(_a, 2), column = _b[0], value = _b[1];
1355
- return column + " = " + (value == null || value === 'NULL' ?
1417
+ return "".concat(column, " = ").concat(value == null || value === 'NULL' ?
1356
1418
  'NULL' :
1357
- "'" + _this.$utils().covertBooleanToNumber(value) + "'");
1419
+ "'".concat(_this.$utils().covertBooleanToNumber(value), "'"));
1358
1420
  });
1359
- return this.$utils().constants('SET') + " " + keyValue;
1421
+ return "".concat(this.$utils().constants('SET'), " ").concat(keyValue);
1360
1422
  };
1361
1423
  Database.prototype._queryInsert = function (data) {
1362
1424
  var _this = this;
1363
- var columns = Object.keys(data).map(function (column) { return "" + column; });
1425
+ var columns = Object.keys(data).map(function (column) { return "".concat(column); });
1364
1426
  var values = Object.values(data).map(function (value) {
1365
- return "" + (value == null || value === 'NULL' ?
1427
+ return "".concat(value == null || value === 'NULL' ?
1366
1428
  'NULL' :
1367
- "'" + _this.$utils().covertBooleanToNumber(value) + "'");
1429
+ "'".concat(_this.$utils().covertBooleanToNumber(value), "'"));
1368
1430
  });
1369
- return "(" + columns + ") " + this.$utils().constants('VALUES') + " (" + values + ")";
1431
+ return "(".concat(columns, ") ").concat(this.$utils().constants('VALUES'), " (").concat(values, ")");
1370
1432
  };
1371
1433
  Database.prototype._queryInsertMultiple = function (data) {
1372
1434
  var e_4, _a;
@@ -1377,11 +1439,11 @@ var Database = /** @class */ (function (_super) {
1377
1439
  for (var data_2 = __values(data), data_2_1 = data_2.next(); !data_2_1.done; data_2_1 = data_2.next()) {
1378
1440
  var objects = data_2_1.value;
1379
1441
  var vals = Object.values(objects).map(function (value) {
1380
- return "" + (value == null || value === 'NULL' ?
1442
+ return "".concat(value == null || value === 'NULL' ?
1381
1443
  'NULL' :
1382
- "'" + _this.$utils().covertBooleanToNumber(value) + "'");
1444
+ "'".concat(_this.$utils().covertBooleanToNumber(value), "'"));
1383
1445
  });
1384
- values.push("(" + vals.join(',') + ")");
1446
+ values.push("(".concat(vals.join(','), ")"));
1385
1447
  }
1386
1448
  }
1387
1449
  catch (e_4_1) { e_4 = { error: e_4_1 }; }
@@ -1391,14 +1453,16 @@ var Database = /** @class */ (function (_super) {
1391
1453
  }
1392
1454
  finally { if (e_4) throw e_4.error; }
1393
1455
  }
1394
- var columns = Object.keys((_b = data[0]) !== null && _b !== void 0 ? _b : []).map(function (column) { return "" + column; });
1395
- return "(" + columns + ") " + this.$utils().constants('VALUES') + " " + values.join(',');
1456
+ var columns = Object.keys((_b = data[0]) !== null && _b !== void 0 ? _b : []).map(function (column) { return "".concat(column); });
1457
+ return "(".concat(columns, ") ").concat(this.$utils().constants('VALUES'), " ").concat(values.join(','));
1396
1458
  };
1397
1459
  Database.prototype._valueAndOperator = function (value, operator, useDefault) {
1398
1460
  if (useDefault === void 0) { useDefault = false; }
1399
1461
  if (useDefault)
1400
1462
  return [operator, '='];
1401
- if (operator === this.$utils().constants('LIKE'))
1463
+ if (operator == null)
1464
+ throw new Error('bad arguments');
1465
+ if (operator.toUpperCase() === this.$utils().constants('LIKE'))
1402
1466
  operator = operator.toUpperCase();
1403
1467
  return [value, operator];
1404
1468
  };