tspace-mysql 1.9.3 → 1.9.4

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 (63) hide show
  1. package/README.md +134 -17
  2. package/dist/lib/constants/index.d.ts +1 -1
  3. package/dist/lib/constants/index.js +8 -1
  4. package/dist/lib/constants/index.js.map +1 -1
  5. package/dist/lib/core/Abstracts/AbstractBuilder.d.ts +1 -1
  6. package/dist/lib/core/Abstracts/AbstractBuilder.js +1 -0
  7. package/dist/lib/core/Abstracts/AbstractBuilder.js.map +1 -1
  8. package/dist/lib/core/Blueprint.d.ts +43 -10
  9. package/dist/lib/core/Blueprint.js +43 -2
  10. package/dist/lib/core/Blueprint.js.map +1 -1
  11. package/dist/lib/core/Builder.d.ts +6 -6
  12. package/dist/lib/core/Builder.js +25 -28
  13. package/dist/lib/core/Builder.js.map +1 -1
  14. package/dist/lib/core/Contracts/Audit.d.ts +2 -2
  15. package/dist/lib/core/Contracts/Logger.d.ts +2 -2
  16. package/dist/lib/core/DB.d.ts +137 -6
  17. package/dist/lib/core/DB.js +153 -30
  18. package/dist/lib/core/DB.js.map +1 -1
  19. package/dist/lib/core/Driver/index.d.ts +1 -0
  20. package/dist/lib/core/Driver/index.js +11 -0
  21. package/dist/lib/core/Driver/index.js.map +1 -1
  22. package/dist/lib/core/Driver/mariadb/MariadbDriver.d.ts +3 -0
  23. package/dist/lib/core/Driver/mariadb/MariadbDriver.js +17 -2
  24. package/dist/lib/core/Driver/mariadb/MariadbDriver.js.map +1 -1
  25. package/dist/lib/core/Driver/mongodb/MongodbDriver.d.ts +3 -0
  26. package/dist/lib/core/Driver/mongodb/MongodbDriver.js +4 -1
  27. package/dist/lib/core/Driver/mongodb/MongodbDriver.js.map +1 -1
  28. package/dist/lib/core/Driver/mysql/MysqlDriver.d.ts +3 -0
  29. package/dist/lib/core/Driver/mysql/MysqlDriver.js +32 -2
  30. package/dist/lib/core/Driver/mysql/MysqlDriver.js.map +1 -1
  31. package/dist/lib/core/Driver/postgres/PostgresDriver.d.ts +3 -0
  32. package/dist/lib/core/Driver/postgres/PostgresDriver.js +21 -4
  33. package/dist/lib/core/Driver/postgres/PostgresDriver.js.map +1 -1
  34. package/dist/lib/core/Driver/sqlite/SqliteDriver.d.ts +3 -0
  35. package/dist/lib/core/Driver/sqlite/SqliteDriver.js +10 -1
  36. package/dist/lib/core/Driver/sqlite/SqliteDriver.js.map +1 -1
  37. package/dist/lib/core/Model.d.ts +331 -29
  38. package/dist/lib/core/Model.js +329 -19
  39. package/dist/lib/core/Model.js.map +1 -1
  40. package/dist/lib/core/Pool.js +6 -0
  41. package/dist/lib/core/Pool.js.map +1 -1
  42. package/dist/lib/core/{Queue.d.ts → Queue/index.d.ts} +115 -111
  43. package/dist/lib/core/Queue/index.js +283 -0
  44. package/dist/lib/core/Queue/index.js.map +1 -0
  45. package/dist/lib/core/Queue/types.d.ts +40 -0
  46. package/dist/lib/core/Queue/types.js +3 -0
  47. package/dist/lib/core/Queue/types.js.map +1 -0
  48. package/dist/lib/core/Queue/worker.d.ts +103 -0
  49. package/dist/lib/core/{Queue.js → Queue/worker.js} +251 -310
  50. package/dist/lib/core/Queue/worker.js.map +1 -0
  51. package/dist/lib/core/Repository.d.ts +40 -20
  52. package/dist/lib/core/Repository.js +35 -14
  53. package/dist/lib/core/Repository.js.map +1 -1
  54. package/dist/lib/core/UtilityTypes.d.ts +7 -3
  55. package/dist/lib/core/UtilityTypes.js.map +1 -1
  56. package/dist/lib/types/decorator/index.d.ts +3 -0
  57. package/dist/lib/types/index.d.ts +17 -16
  58. package/dist/lib/types/repository/index.d.ts +3 -3
  59. package/dist/lib/utils/index.d.ts +10 -5
  60. package/dist/lib/utils/index.js +42 -9
  61. package/dist/lib/utils/index.js.map +1 -1
  62. package/package.json +3 -5
  63. package/dist/lib/core/Queue.js.map +0 -1
@@ -136,6 +136,7 @@ class Model extends AbstractModel_1.AbstractModel {
136
136
  }
137
137
  /**
138
138
  * The 'formatPattern' method is used to change the format of the pattern.
139
+ * @static
139
140
  * @param {object} data { data , pattern }
140
141
  * @property {Record | string} data
141
142
  * @property {string} parttern
@@ -159,6 +160,7 @@ class Model extends AbstractModel_1.AbstractModel {
159
160
  }
160
161
  /**
161
162
  * The 'instance' method is used get instance.
163
+ * @static
162
164
  * @override
163
165
  * @static
164
166
  * @returns {Model} instance of the Model
@@ -181,6 +183,7 @@ class Model extends AbstractModel_1.AbstractModel {
181
183
  * The 'find' method is used to retrieve a single record from a database table by its primary key.
182
184
  *
183
185
  * It allows you to retrieve a single record from a database table that meets the specified criteria.
186
+ * @static
184
187
  * @type {?object} options
185
188
  * @property {?object} options.select
186
189
  * @property {?object} options.except
@@ -221,6 +224,7 @@ class Model extends AbstractModel_1.AbstractModel {
221
224
  * The 'findOne' method is used to retrieve the get record that matches the query conditions.
222
225
  *
223
226
  * It allows you to retrieve a single record from a database table that meets the specified criteria.
227
+ * @static
224
228
  * @type {?object} options
225
229
  * @property {?object} options.select
226
230
  * @property {?object} options.except
@@ -261,6 +265,7 @@ class Model extends AbstractModel_1.AbstractModel {
261
265
  * The 'findMany' method is used to retrieve the get record that matches the query conditions.
262
266
  *
263
267
  * It allows you to retrieve a single record from a database table that meets the specified criteria.
268
+ * @static
264
269
  * @type {?object} options
265
270
  * @property {?object} options.select
266
271
  * @property {?object} options.except
@@ -302,6 +307,7 @@ class Model extends AbstractModel_1.AbstractModel {
302
307
  *
303
308
  * It allows you to split a large set of query results into smaller, more manageable pages,
304
309
  * making it easier to display data in a web application and improve user experience.
310
+ * @static
305
311
  * @type {?object} options
306
312
  * @property {?object} options.select
307
313
  * @property {?object} options.except
@@ -343,6 +349,7 @@ class Model extends AbstractModel_1.AbstractModel {
343
349
  * The 'exists' method is used to determine if any records exist in the database table that match the query conditions.
344
350
  *
345
351
  * It returns a boolean value indicating whether there are any matching records.
352
+ * @static
346
353
  * @type {?object} options
347
354
  * @property {?object} options.select
348
355
  * @property {?object} options.except
@@ -378,6 +385,7 @@ class Model extends AbstractModel_1.AbstractModel {
378
385
  * The 'toQuery' method is used to retrieve the raw SQL query that would be executed by a query builder instance without actually executing it.
379
386
  *
380
387
  * This method is particularly useful for debugging and understanding the SQL queries generated by your application.
388
+ * @static
381
389
  * @type {?object} options
382
390
  * @property {?object} options.select
383
391
  * @property {?object} options.except
@@ -409,10 +417,261 @@ class Model extends AbstractModel_1.AbstractModel {
409
417
  static toQuery(options) {
410
418
  return (0, Repository_1.Repository)(this).toString(options);
411
419
  }
420
+ /**
421
+ * The 'toArray' method is used to retrieve the raw SQL query that would be executed by a query builder instance without actually executing it.
422
+ *
423
+ * This method is particularly useful for debugging and understanding the SQL queries generated by your application.
424
+ * @static
425
+ * @type {?object} options
426
+ * @property {?object} options.select
427
+ * @property {?object} options.except
428
+ * @property {?object[]} options.orderBy
429
+ * @property {?string[]} options.groupBy
430
+ * @property {?string} options.having
431
+ * @property {?number} options.limit
432
+ * @property {?number} options.offset
433
+ * @property {?object} options.where
434
+ * @property {?string[]} options.whereRaw
435
+ * @property {?object} options.whereQuery
436
+ * @property {?{condition,callback}} options.when
437
+ * @property {?{localKey , referenceKey}[]} options.join
438
+ * @property {?{localKey , referenceKey}[]} options.rightJoin
439
+ * @property {?{localKey , referenceKey}[]} options.leftJoin
440
+ * @property {?boolean} options.debug
441
+ * @property {?number} options.page
442
+ *
443
+ * @example
444
+ * import { User } from '../Models/User'
445
+ *
446
+ * const users = await User.toArray('id',{
447
+ * where : {
448
+ * id: 1
449
+ * }
450
+ * })
451
+ *
452
+ * // [1]
453
+ *
454
+ */
455
+ static toArray(column, options = {}) {
456
+ return (0, Repository_1.Repository)(this).toArray(column, options);
457
+ }
458
+ /**
459
+ *
460
+ * The 'toAsyncIterable' method is used to execute a database query and return the result set as an asynchronous iterable.
461
+ *
462
+ * It retrieves multiple records from a database table based on the criteria specified in the query.
463
+ * The optional callback function can be used to modify the generated SQL query before execution.
464
+ * @static
465
+ * @type {?object} options
466
+ * @property {?object} options.select
467
+ * @property {?object} options.except
468
+ * @property {?object[]} options.orderBy
469
+ * @property {?string[]} options.groupBy
470
+ * @property {?string} options.having
471
+ * @property {?number} options.limit
472
+ * @property {?number} options.offset
473
+ * @property {?object} options.where
474
+ * @property {?string[]} options.whereRaw
475
+ * @property {?object} options.whereQuery
476
+ * @property {?{condition,callback}} options.when
477
+ * @property {?{localKey , referenceKey}[]} options.join
478
+ * @property {?{localKey , referenceKey}[]} options.rightJoin
479
+ * @property {?{localKey , referenceKey}[]} options.leftJoin
480
+ * @property {?string[]} options.relations
481
+ * @property {string[]} options.relationExists
482
+ * @property {?{condition,callback}} options.relationQuery
483
+ * @property {?boolean} options.debug
484
+ * @returns {promise<object>[]}
485
+ *
486
+ * @example
487
+ * import { User } from '../Models/User'
488
+ *
489
+ * const users = await User.findMany({
490
+ * select : { id: true, name: true },
491
+ * where : {
492
+ * id: 1
493
+ * }
494
+ * })
495
+ *
496
+ */
497
+ static async *toAsyncIterable(options = {}) {
498
+ return yield* (0, Repository_1.Repository)(this).toAsyncIterable(options);
499
+ }
500
+ /**
501
+ * The 'count' method is used to retrieve the total number of records that match the specified query conditions.
502
+ *
503
+ * It returns an integer representing the count of records.
504
+ * @static
505
+ * @type {?object} options
506
+ * @property {?object} options.select
507
+ * @property {?object} options.except
508
+ * @property {?object[]} options.orderBy
509
+ * @property {?string[]} options.groupBy
510
+ * @property {?string} options.having
511
+ * @property {?number} options.limit
512
+ * @property {?number} options.offset
513
+ * @property {?object} options.where
514
+ * @property {?string[]} options.whereRaw
515
+ * @property {?object} options.whereQuery
516
+ * @property {?{condition,callback}} options.when
517
+ * @property {?{localKey , referenceKey}[]} options.join
518
+ * @property {?{localKey , referenceKey}[]} options.rightJoin
519
+ * @property {?{localKey , referenceKey}[]} options.leftJoin
520
+ * @property {?boolean} options.debug
521
+ * @property {?number} options.page
522
+ *
523
+ * @example
524
+ * import { User } from '../Models/User'
525
+ *
526
+ * const count = await User.count('id',{
527
+ * where : {
528
+ * id: 1
529
+ * }
530
+ * })
531
+ *
532
+ * // 1
533
+ *
534
+ */
535
+ static count(column, options = {}) {
536
+ return (0, Repository_1.Repository)(this).count(column, options);
537
+ }
538
+ /**
539
+ * The 'sum' method is used to retrieve the total number of records that match the specified query conditions.
540
+ *
541
+ * It returns an integer representing the sum of records.
542
+ * @static
543
+ * @type {?object} options
544
+ * @property {?object} options.select
545
+ * @property {?object} options.except
546
+ * @property {?object[]} options.orderBy
547
+ * @property {?string[]} options.groupBy
548
+ * @property {?string} options.having
549
+ * @property {?number} options.limit
550
+ * @property {?number} options.offset
551
+ * @property {?object} options.where
552
+ * @property {?string[]} options.whereRaw
553
+ * @property {?object} options.whereQuery
554
+ * @property {?{condition,callback}} options.when
555
+ * @property {?{localKey , referenceKey}[]} options.join
556
+ * @property {?{localKey , referenceKey}[]} options.rightJoin
557
+ * @property {?{localKey , referenceKey}[]} options.leftJoin
558
+ * @property {?boolean} options.debug
559
+ * @property {?number} options.page
560
+ *
561
+ * @example
562
+ * import { User } from '../Models/User'
563
+ *
564
+ * const sum = await User.sum('id')
565
+ *
566
+ *
567
+ */
568
+ static sum(column, options = {}) {
569
+ return (0, Repository_1.Repository)(this).sum(column, options);
570
+ }
571
+ /**
572
+ * The 'avg' method is used to retrieve the total number of records that match the specified query conditions.
573
+ *
574
+ * It returns an integer representing the avg of records.
575
+ * @static
576
+ * @type {?object} options
577
+ * @property {?object} options.select
578
+ * @property {?object} options.except
579
+ * @property {?object[]} options.orderBy
580
+ * @property {?string[]} options.groupBy
581
+ * @property {?string} options.having
582
+ * @property {?number} options.limit
583
+ * @property {?number} options.offset
584
+ * @property {?object} options.where
585
+ * @property {?string[]} options.whereRaw
586
+ * @property {?object} options.whereQuery
587
+ * @property {?{condition,callback}} options.when
588
+ * @property {?{localKey , referenceKey}[]} options.join
589
+ * @property {?{localKey , referenceKey}[]} options.rightJoin
590
+ * @property {?{localKey , referenceKey}[]} options.leftJoin
591
+ * @property {?boolean} options.debug
592
+ * @property {?number} options.page
593
+ *
594
+ * @example
595
+ * import { User } from '../Models/User'
596
+ *
597
+ * const avg = await User.avg('id')
598
+ *
599
+ *
600
+ */
601
+ static avg(column, options = {}) {
602
+ return (0, Repository_1.Repository)(this).avg(column, options);
603
+ }
604
+ /**
605
+ * The 'max' method is used to retrieve the total number of records that match the specified query conditions.
606
+ *
607
+ * It returns an integer representing the max of records.
608
+ * @static
609
+ * @type {?object} options
610
+ * @property {?object} options.select
611
+ * @property {?object} options.except
612
+ * @property {?object[]} options.orderBy
613
+ * @property {?string[]} options.groupBy
614
+ * @property {?string} options.having
615
+ * @property {?number} options.limit
616
+ * @property {?number} options.offset
617
+ * @property {?object} options.where
618
+ * @property {?string[]} options.whereRaw
619
+ * @property {?object} options.whereQuery
620
+ * @property {?{condition,callback}} options.when
621
+ * @property {?{localKey , referenceKey}[]} options.join
622
+ * @property {?{localKey , referenceKey}[]} options.rightJoin
623
+ * @property {?{localKey , referenceKey}[]} options.leftJoin
624
+ * @property {?boolean} options.debug
625
+ * @property {?number} options.page
626
+ *
627
+ * @example
628
+ * import { User } from '../Models/User'
629
+ *
630
+ * const max = await User.max('id')
631
+ *
632
+ *
633
+ */
634
+ static max(column, options = {}) {
635
+ return (0, Repository_1.Repository)(this).max(column, options);
636
+ }
637
+ /**
638
+ * The 'min' method is used to retrieve the total number of records that match the specified query conditions.
639
+ *
640
+ * It returns an integer representing the min of records.
641
+ * @static
642
+ * @type {?object} options
643
+ * @property {?object} options.select
644
+ * @property {?object} options.except
645
+ * @property {?object[]} options.orderBy
646
+ * @property {?string[]} options.groupBy
647
+ * @property {?string} options.having
648
+ * @property {?number} options.limit
649
+ * @property {?number} options.offset
650
+ * @property {?object} options.where
651
+ * @property {?string[]} options.whereRaw
652
+ * @property {?object} options.whereQuery
653
+ * @property {?{condition,callback}} options.when
654
+ * @property {?{localKey , referenceKey}[]} options.join
655
+ * @property {?{localKey , referenceKey}[]} options.rightJoin
656
+ * @property {?{localKey , referenceKey}[]} options.leftJoin
657
+ * @property {?boolean} options.debug
658
+ * @property {?number} options.page
659
+ *
660
+ * @example
661
+ * import { User } from '../Models/User'
662
+ *
663
+ * const min = await User.min('id')
664
+ *
665
+ *
666
+ */
667
+ static min(column, options = {}) {
668
+ return (0, Repository_1.Repository)(this).min(column, options);
669
+ }
412
670
  /**
413
671
  * The 'create' method is used to insert a new record into a database table associated.
414
672
  *
415
673
  * It simplifies the process of creating and inserting records.
674
+ * @static
416
675
  * @type {object} options
417
676
  * @property {object} options.data
418
677
  * @property {?boolean} options.debug
@@ -426,6 +685,7 @@ class Model extends AbstractModel_1.AbstractModel {
426
685
  * The 'createMany' method is used to insert a new records into a database table associated.
427
686
  *
428
687
  * It simplifies the process of creating and inserting records with an array.
688
+ * @static
429
689
  * @type {object} options
430
690
  * @property {object[]} options.data
431
691
  * @property {?boolean} options.debug
@@ -441,6 +701,7 @@ class Model extends AbstractModel_1.AbstractModel {
441
701
  *
442
702
  * This method is particularly useful when you want to update a record based on certain conditions and,
443
703
  * if the record matching those conditions doesn't exist, create a new one with the provided data.
704
+ * @static
444
705
  * @type {object} options
445
706
  * @property {object} options.data
446
707
  * @property {object} options.where
@@ -456,7 +717,7 @@ class Model extends AbstractModel_1.AbstractModel {
456
717
  *
457
718
  * This method is particularly useful when you want to insert records into a table and ensure that duplicates are not inserted,
458
719
  * but without raising an error or exception if duplicates are encountered.
459
- *
720
+ * @static
460
721
  * @type {object} options
461
722
  * @property {object} options.data
462
723
  * @property {object} options.where
@@ -473,6 +734,7 @@ class Model extends AbstractModel_1.AbstractModel {
473
734
  *
474
735
  * This method is particularly useful when you want to insert records into a table and ensure that duplicates are not inserted,
475
736
  * but if exists should be returns a result.
737
+ * @static
476
738
  * @type {object} options
477
739
  * @property {object} options.data
478
740
  * @property {object} options.where
@@ -488,6 +750,7 @@ class Model extends AbstractModel_1.AbstractModel {
488
750
  * It simplifies the process of updating records by allowing you to specify the values to be updated using a single call.
489
751
  *
490
752
  * It allows you to remove one record that match certain criteria.
753
+ * @static
491
754
  * @type {object} options
492
755
  * @property {object} options.data
493
756
  * @property {object} options.where
@@ -504,6 +767,7 @@ class Model extends AbstractModel_1.AbstractModel {
504
767
  * It simplifies the process of updating records by allowing you to specify the values to be updated using a single call.
505
768
  *
506
769
  * It allows you to remove more records that match certain criteria.
770
+ * @static
507
771
  * @type {object} options
508
772
  * @property {object} options.data
509
773
  * @property {object} options.where
@@ -515,8 +779,52 @@ class Model extends AbstractModel_1.AbstractModel {
515
779
  return (0, Repository_1.Repository)(this).updateMany(options);
516
780
  }
517
781
  /**
518
- * The 'cache' method is used get the functions from the Cache
519
- * @returns {TCacheModel} cache
782
+ * The 'cache' method is used to access to cache operations for the current model.
783
+ *
784
+ * The cache API exposes methods for retrieving the configured cache provider,
785
+ * selecting a cache driver, managing cache entries, and optionally generating
786
+ * model-scoped cache keys.
787
+ *
788
+ * When the `namespace` option is enabled, cache keys are automatically prefixed
789
+ * with the current database and table name in the following format:
790
+ *
791
+ * `database:table:key`
792
+ *
793
+ * This helps prevent cache key collisions between different models or tables.
794
+ * @static
795
+ * @returns {TCacheModel} An object containing cache provider, driver, and cache management methods.
796
+ *
797
+ * @example
798
+ * // Get the configured cache provider.
799
+ * const provider = User.cache.provider(); // "db" | "memory" | "redis"
800
+ *
801
+ * @example
802
+ * // Store a value using a model-scoped cache key.
803
+ * await User.cache.set("users", users, 60_000, {
804
+ * namespace: true
805
+ * });
806
+ *
807
+ * @example
808
+ * // Retrieve a model-scoped cache value.
809
+ * const users = await User.cache.get("users", {
810
+ * namespace: true
811
+ * });
812
+ *
813
+ * @example
814
+ * // Check whether a cache entry exists.
815
+ * const exists = await User.cache.exists("users", {
816
+ * namespace: true
817
+ * });
818
+ *
819
+ * @example
820
+ * // Delete a cache entry.
821
+ * await User.cache.delete("users", {
822
+ * namespace: true
823
+ * });
824
+ *
825
+ * @example
826
+ * // Clear all cache entries.
827
+ * await User.cache.clear();
520
828
  */
521
829
  static get cache() {
522
830
  const getCacheKey = (key) => {
@@ -573,6 +881,7 @@ class Model extends AbstractModel_1.AbstractModel {
573
881
  * - DELETE: waits
574
882
  *
575
883
  * The lock is released automatically after the callback completes.
884
+ * @static
576
885
  *
577
886
  * @Note
578
887
  * This approach is not recommended in clustered or load-balance environments,
@@ -4338,6 +4647,18 @@ class Model extends AbstractModel_1.AbstractModel {
4338
4647
  toSQL({ latest = false, oldest = false, } = {}) {
4339
4648
  return this.toString({ latest, oldest });
4340
4649
  }
4650
+ /**
4651
+ *
4652
+ * @override
4653
+ * @param {Function?} cb callback function return query sql
4654
+ * @returns {AsyncIterable<T.Result<this, K>>}
4655
+ */
4656
+ async *toAsyncIterable(cb) {
4657
+ if (this.$state.get("VOID"))
4658
+ return yield* [];
4659
+ const results = await this.get(cb);
4660
+ return yield* results;
4661
+ }
4341
4662
  /**
4342
4663
  * @override
4343
4664
  * @param {string=} column [column=id]
@@ -4764,10 +5085,7 @@ class Model extends AbstractModel_1.AbstractModel {
4764
5085
  columns[key] = `( ${updateColumns[key].join(" ")} )`;
4765
5086
  }
4766
5087
  const keyValue = Object.entries(columns).map(([column, value]) => {
4767
- if (typeof value === "string" &&
4768
- !value.includes(this.$constants("RAW"))) {
4769
- value = this.$utils.escapeActions(value);
4770
- }
5088
+ value = this.$utils.escapePayload(value);
4771
5089
  return `${this.bindColumn(column)} = ${value == null || value === this.$constants("NULL")
4772
5090
  ? this.$constants("NULL")
4773
5091
  : this.$utils.transfromValueHasRaw(value)}`;
@@ -5013,6 +5331,7 @@ class Model extends AbstractModel_1.AbstractModel {
5013
5331
  throw this._assertError("Unknow table.");
5014
5332
  }
5015
5333
  const schemaModel = this.getSchemaModel();
5334
+ await this.sync({ force: true, index: true, foreign: true }).catch(() => null);
5016
5335
  const fields = schemaModel == null
5017
5336
  ? await this.getSchema()
5018
5337
  : Object.entries(schemaModel)
@@ -5969,10 +6288,7 @@ class Model extends AbstractModel_1.AbstractModel {
5969
6288
  });
5970
6289
  }
5971
6290
  const keyValue = Object.entries(objects).map(([column, value]) => {
5972
- if (typeof value === "string" &&
5973
- !value.includes(this.$constants("RAW"))) {
5974
- value = this.$utils.escapeActions(value);
5975
- }
6291
+ value = this.$utils.escapePayload(value);
5976
6292
  return `${this.bindColumn(column)} = ${value == null || value === this.$constants("NULL")
5977
6293
  ? this.$constants("NULL")
5978
6294
  : this.$utils.transfromValueHasRaw(value)}`;
@@ -6015,10 +6331,7 @@ class Model extends AbstractModel_1.AbstractModel {
6015
6331
  }
6016
6332
  const columns = Object.keys(data).map((c) => `\`${this._valuePattern(c).replace(/\`/g, "")}\``);
6017
6333
  const values = Object.values(data).map((value) => {
6018
- if (typeof value === "string" &&
6019
- !value.includes(this.$constants("RAW"))) {
6020
- value = this.$utils.escapeActions(value);
6021
- }
6334
+ value = this.$utils.escapePayload(value);
6022
6335
  if (this.$utils.typeOf(value) === "object" ||
6023
6336
  this.$utils.typeOf(value) === "array") {
6024
6337
  value = JSON.stringify(value);
@@ -6073,10 +6386,7 @@ class Model extends AbstractModel_1.AbstractModel {
6073
6386
  columns = [`\`${uuidFormat}\``, ...columns];
6074
6387
  }
6075
6388
  const v = Object.values(objects).map((value) => {
6076
- if (typeof value === "string" &&
6077
- !value.includes(this.$constants("RAW"))) {
6078
- value = this.$utils.escapeActions(value);
6079
- }
6389
+ value = this.$utils.escapePayload(value);
6080
6390
  if (this.$utils.typeOf(value) === "object" ||
6081
6391
  this.$utils.typeOf(value) === "array") {
6082
6392
  value = JSON.stringify(value);