leoric 2.13.4 → 2.13.6

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 (129) hide show
  1. package/dist/adapters/sequelize.d.ts +5 -1
  2. package/dist/adapters/sequelize.js +108 -108
  3. package/dist/adapters/sequelize.js.map +1 -1
  4. package/dist/bone.js +49 -44
  5. package/dist/bone.js.map +1 -1
  6. package/dist/collection.d.ts +1 -1
  7. package/dist/collection.js +2 -2
  8. package/dist/collection.js.map +1 -1
  9. package/dist/constants.d.ts +14 -14
  10. package/dist/data_types.d.ts +1 -3
  11. package/dist/data_types.js +1 -1
  12. package/dist/data_types.js.map +1 -1
  13. package/dist/decorators.js.map +1 -1
  14. package/dist/drivers/abstract/attribute.js.map +1 -1
  15. package/dist/drivers/abstract/index.js +8 -8
  16. package/dist/drivers/abstract/index.js.map +1 -1
  17. package/dist/drivers/abstract/logger.js.map +1 -1
  18. package/dist/drivers/abstract/spellbook.d.ts +2 -2
  19. package/dist/drivers/abstract/spellbook.js.map +1 -1
  20. package/dist/drivers/index.js.map +1 -1
  21. package/dist/drivers/mysql/attribute.js.map +1 -1
  22. package/dist/drivers/mysql/data_types.d.ts +1 -1
  23. package/dist/drivers/mysql/data_types.js.map +1 -1
  24. package/dist/drivers/mysql/index.js +8 -6
  25. package/dist/drivers/mysql/index.js.map +1 -1
  26. package/dist/drivers/mysql/spellbook.js.map +1 -1
  27. package/dist/drivers/postgres/attribute.d.ts +1 -1
  28. package/dist/drivers/postgres/attribute.js.map +1 -1
  29. package/dist/drivers/postgres/data_types.d.ts +16 -16
  30. package/dist/drivers/postgres/data_types.js.map +1 -1
  31. package/dist/drivers/postgres/index.d.ts +1 -1
  32. package/dist/drivers/postgres/index.js +8 -8
  33. package/dist/drivers/postgres/index.js.map +1 -1
  34. package/dist/drivers/postgres/spellbook.js.map +1 -1
  35. package/dist/drivers/postgres/sqlstring.js.map +1 -1
  36. package/dist/drivers/sqlite/attribute.js.map +1 -1
  37. package/dist/drivers/sqlite/connection.js +2 -2
  38. package/dist/drivers/sqlite/connection.js.map +1 -1
  39. package/dist/drivers/sqlite/data_types.d.ts +24 -24
  40. package/dist/drivers/sqlite/data_types.js.map +1 -1
  41. package/dist/drivers/sqlite/index.js +8 -8
  42. package/dist/drivers/sqlite/index.js.map +1 -1
  43. package/dist/drivers/sqlite/pool.js +2 -2
  44. package/dist/drivers/sqlite/pool.js.map +1 -1
  45. package/dist/drivers/sqlite/spellbook.js.map +1 -1
  46. package/dist/drivers/sqlite/sqlstring.js +2 -2
  47. package/dist/drivers/sqlite/sqlstring.js.map +1 -1
  48. package/dist/drivers/sqljs/index.js.map +1 -1
  49. package/dist/drivers/sqljs/interface.d.ts +0 -2
  50. package/dist/drivers/sqljs/sqljs-connection.js +1 -1
  51. package/dist/drivers/sqljs/sqljs-connection.js.map +1 -1
  52. package/dist/expr.js +2 -2
  53. package/dist/expr.js.map +1 -1
  54. package/dist/expr_formatter.d.ts +1 -1
  55. package/dist/expr_formatter.js.map +1 -1
  56. package/dist/hint.js.map +1 -1
  57. package/dist/index.js +2 -2
  58. package/dist/migrations.js +8 -8
  59. package/dist/migrations.js.map +1 -1
  60. package/dist/query_object.js.map +1 -1
  61. package/dist/raw.js.map +1 -1
  62. package/dist/realm/base.js +5 -5
  63. package/dist/realm/base.js.map +1 -1
  64. package/dist/realm/index.js +2 -2
  65. package/dist/realm/index.js.map +1 -1
  66. package/dist/setup_hooks.js +13 -11
  67. package/dist/setup_hooks.js.map +1 -1
  68. package/dist/spell.js +8 -7
  69. package/dist/spell.js.map +1 -1
  70. package/dist/utils/index.js.map +1 -1
  71. package/dist/validator.js.map +1 -1
  72. package/lib/adapters/sequelize.d.ts +5 -1
  73. package/lib/adapters/sequelize.js.map +1 -1
  74. package/lib/bone.js +7 -2
  75. package/lib/bone.js.map +1 -1
  76. package/lib/browser.js.map +1 -1
  77. package/lib/collection.d.ts +1 -1
  78. package/lib/collection.js.map +1 -1
  79. package/lib/constants.d.ts +14 -14
  80. package/lib/data_types.d.ts +1 -3
  81. package/lib/data_types.js +2 -2
  82. package/lib/data_types.js.map +1 -1
  83. package/lib/decorators.js +4 -5
  84. package/lib/decorators.js.map +1 -1
  85. package/lib/drivers/abstract/attribute.js.map +1 -1
  86. package/lib/drivers/abstract/index.js.map +1 -1
  87. package/lib/drivers/abstract/logger.js.map +1 -1
  88. package/lib/drivers/abstract/spellbook.d.ts +2 -2
  89. package/lib/drivers/abstract/spellbook.js.map +1 -1
  90. package/lib/drivers/index.js.map +1 -1
  91. package/lib/drivers/mysql/attribute.js.map +1 -1
  92. package/lib/drivers/mysql/data_types.d.ts +1 -1
  93. package/lib/drivers/mysql/index.js +3 -1
  94. package/lib/drivers/mysql/index.js.map +1 -1
  95. package/lib/drivers/mysql/spellbook.js.map +1 -1
  96. package/lib/drivers/postgres/attribute.d.ts +1 -1
  97. package/lib/drivers/postgres/attribute.js.map +1 -1
  98. package/lib/drivers/postgres/data_types.d.ts +16 -16
  99. package/lib/drivers/postgres/index.d.ts +1 -1
  100. package/lib/drivers/postgres/index.js.map +1 -1
  101. package/lib/drivers/postgres/sqlstring.js.map +1 -1
  102. package/lib/drivers/sqlite/attribute.js.map +1 -1
  103. package/lib/drivers/sqlite/connection.js.map +1 -1
  104. package/lib/drivers/sqlite/data_types.d.ts +24 -24
  105. package/lib/drivers/sqlite/data_types.js.map +1 -1
  106. package/lib/drivers/sqlite/index.js.map +1 -1
  107. package/lib/drivers/sqlite/pool.js.map +1 -1
  108. package/lib/drivers/sqlite/spellbook.js.map +1 -1
  109. package/lib/drivers/sqlite/sqlstring.js.map +1 -1
  110. package/lib/drivers/sqljs/index.js.map +1 -1
  111. package/lib/drivers/sqljs/interface.d.ts +0 -2
  112. package/lib/drivers/sqljs/sqljs-connection.js +17 -7
  113. package/lib/drivers/sqljs/sqljs-connection.js.map +1 -1
  114. package/lib/expr.js +2 -2
  115. package/lib/expr.js.map +1 -1
  116. package/lib/expr_formatter.d.ts +1 -1
  117. package/lib/expr_formatter.js.map +1 -1
  118. package/lib/hint.js.map +1 -1
  119. package/lib/index.js.map +1 -1
  120. package/lib/migrations.js.map +1 -1
  121. package/lib/query_object.js.map +1 -1
  122. package/lib/raw.js.map +1 -1
  123. package/lib/realm/base.js.map +1 -1
  124. package/lib/realm/index.js.map +1 -1
  125. package/lib/setup_hooks.js.map +1 -1
  126. package/lib/spell.js.map +1 -1
  127. package/lib/utils/index.js.map +1 -1
  128. package/lib/validator.js.map +1 -1
  129. package/package.json +5 -5
@@ -28,6 +28,10 @@ interface SequelizeInstanceUpdateOptions<T extends SequelizeBone> extends QueryO
28
28
  fields?: Array<[keyof Extract<CommonValues<T>, Literal>] | string | Raw> | [keyof Extract<CommonValues<T>, Literal>];
29
29
  }
30
30
 
31
+ interface CountSequelizeOptions<T extends typeof SequelizeBone> extends BaseSequelizeConditions<T> {
32
+ col?: BoneColumns<T> | Raw | '*';
33
+ }
34
+
31
35
  interface SequelizeConditions<T extends typeof SequelizeBone> extends BaseSequelizeConditions<T> {
32
36
  group?: BoneColumns<T> | BoneColumns<T>[] | Raw | string;
33
37
  having?: WhereConditions<T> | string | { [key:string]: Literal | Literal[] } | Raw;
@@ -117,7 +121,7 @@ export class SequelizeBone extends AbstractBone {
117
121
  */
118
122
  static bulkBuild<T extends typeof SequelizeBone>(this:T, valueSets: Array<BoneCreateValues<T>>, options?: BoneOptions): Array<InstanceType<T>>;
119
123
 
120
- static count<T extends typeof SequelizeBone>(this: T, conditions?: SequelizeConditions<T>): Spell<T, ResultSet<T> | number>;
124
+ static count<T extends typeof SequelizeBone>(this: T, conditions?: CountSequelizeOptions<T>): Spell<T, ResultSet<T> | number>;
121
125
  static count<T extends typeof SequelizeBone>(this: T, name?: BoneColumns<T>): Spell<T, ResultSet<T> | number>;
122
126
  static count<T extends typeof SequelizeBone>(this: T, name?: Raw | '*'): Spell<T, ResultSet<T> | number>;
123
127
 
@@ -35,8 +35,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
35
35
  });
36
36
  };
37
37
  var __generator = (this && this.__generator) || function (thisArg, body) {
38
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
39
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
38
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
39
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
40
40
  function verb(n) { return function (v) { return step([n, v]); }; }
41
41
  function step(op) {
42
42
  if (f) throw new TypeError("Generator is already executing.");
@@ -359,14 +359,14 @@ module.exports = function sequelize(Bone) {
359
359
  * @param {function|object|array} name
360
360
  */
361
361
  Spine.setScope = function (name) {
362
- var _a;
362
+ var _b;
363
363
  var args = [];
364
364
  for (var _i = 1; _i < arguments.length; _i++) {
365
365
  args[_i - 1] = arguments[_i];
366
366
  }
367
367
  if (name && this._scopes[name]) {
368
368
  if (this._scopes[name].__isFunc) {
369
- this._scope = parseScope((_a = this._scopes[name]).call.apply(_a, __spreadArray([this], __read(args), false)));
369
+ this._scope = parseScope((_b = this._scopes[name]).call.apply(_b, __spreadArray([this], __read(args), false)));
370
370
  }
371
371
  else {
372
372
  this._scope = this._scopes[name];
@@ -385,7 +385,7 @@ module.exports = function sequelize(Bone) {
385
385
  if (descriptors === void 0) { descriptors = {}; }
386
386
  _super.init.call(this, attributes, opts, descriptors);
387
387
  // sequelize opts.getterMethods | setterMethods
388
- var _a = opts.getterMethods, getterMethods = _a === void 0 ? {} : _a, _b = opts.setterMethods, setterMethods = _b === void 0 ? {} : _b, defaultScope = opts.defaultScope, scopes = opts.scopes;
388
+ var _b = opts.getterMethods, getterMethods = _b === void 0 ? {} : _b, _c = opts.setterMethods, setterMethods = _c === void 0 ? {} : _c, defaultScope = opts.defaultScope, scopes = opts.scopes;
389
389
  var setProp = function (obj, type) { return function (result) {
390
390
  Object.keys(obj).map(function (key) {
391
391
  if (!result[key]) {
@@ -478,7 +478,7 @@ module.exports = function sequelize(Bone) {
478
478
  // EXISTS
479
479
  // static async create(props) {}
480
480
  Spine.decrement = function (fields, options) {
481
- var e_4, _a;
481
+ var e_4, _b;
482
482
  var where = options.where, paranoid = options.paranoid;
483
483
  var spell = _super.update.call(this, where, {}, options);
484
484
  if (Array.isArray(fields)) {
@@ -491,7 +491,7 @@ module.exports = function sequelize(Bone) {
491
491
  catch (e_4_1) { e_4 = { error: e_4_1 }; }
492
492
  finally {
493
493
  try {
494
- if (fields_1_1 && !fields_1_1.done && (_a = fields_1.return)) _a.call(fields_1);
494
+ if (fields_1_1 && !fields_1_1.done && (_b = fields_1.return)) _b.call(fields_1);
495
495
  }
496
496
  finally { if (e_4) throw e_4.error; }
497
497
  }
@@ -512,12 +512,12 @@ module.exports = function sequelize(Bone) {
512
512
  };
513
513
  // EXISTS
514
514
  // static async describe() {}
515
- Spine.destroy = function (options) {
516
- if (options === void 0) { options = {}; }
517
- return __awaiter(this, void 0, void 0, function () {
515
+ Spine.destroy = function () {
516
+ return __awaiter(this, arguments, void 0, function (options) {
518
517
  var where, individualHooks, paranoid, findSpell, instances;
519
- return __generator(this, function (_a) {
520
- switch (_a.label) {
518
+ if (options === void 0) { options = {}; }
519
+ return __generator(this, function (_b) {
520
+ switch (_b.label) {
521
521
  case 0:
522
522
  where = options.where, individualHooks = options.individualHooks, paranoid = options.paranoid;
523
523
  if (!individualHooks) return [3 /*break*/, 4];
@@ -526,13 +526,13 @@ module.exports = function sequelize(Bone) {
526
526
  findSpell = findSpell.unparanoid;
527
527
  return [4 /*yield*/, findSpell];
528
528
  case 1:
529
- instances = _a.sent();
529
+ instances = _b.sent();
530
530
  if (!instances.length) return [3 /*break*/, 3];
531
531
  return [4 /*yield*/, Promise.all(instances.map(function (instance) { return instance.destroy(options); }))];
532
- case 2: return [2 /*return*/, _a.sent()];
532
+ case 2: return [2 /*return*/, _b.sent()];
533
533
  case 3: return [3 /*break*/, 6];
534
534
  case 4: return [4 /*yield*/, this.bulkDestroy(options)];
535
- case 5: return [2 /*return*/, _a.sent()];
535
+ case 5: return [2 /*return*/, _b.sent()];
536
536
  case 6: return [2 /*return*/];
537
537
  }
538
538
  });
@@ -562,12 +562,12 @@ module.exports = function sequelize(Bone) {
562
562
  if (options === void 0) { options = {}; }
563
563
  return this.findOne(options);
564
564
  };
565
- Spine.findAndCountAll = function (options) {
566
- if (options === void 0) { options = {}; }
567
- return __awaiter(this, void 0, void 0, function () {
568
- var spell, spellCount, _a, rows, count;
569
- return __generator(this, function (_b) {
570
- switch (_b.label) {
565
+ Spine.findAndCountAll = function () {
566
+ return __awaiter(this, arguments, void 0, function (options) {
567
+ var spell, spellCount, _b, rows, count;
568
+ if (options === void 0) { options = {}; }
569
+ return __generator(this, function (_c) {
570
+ switch (_c.label) {
571
571
  case 0:
572
572
  spell = this._find({}, filterOptions(options));
573
573
  translateOptions(spell, options);
@@ -582,45 +582,45 @@ module.exports = function sequelize(Bone) {
582
582
  }
583
583
  return [4 /*yield*/, Promise.all([spell, spellCount.count()])];
584
584
  case 1:
585
- _a = __read.apply(void 0, [_b.sent(), 2]), rows = _a[0], count = _a[1];
585
+ _b = __read.apply(void 0, [_c.sent(), 2]), rows = _b[0], count = _b[1];
586
586
  return [2 /*return*/, { rows: rows, count: count }];
587
587
  }
588
588
  });
589
589
  });
590
590
  };
591
591
  Spine.findByPk = function (value, options) {
592
- var _a;
592
+ var _b;
593
593
  if (options === void 0) { options = {}; }
594
- var spell = _super.findOne.call(this, (_a = {}, _a[this.primaryKey] = value, _a), options);
594
+ var spell = _super.findOne.call(this, (_b = {}, _b[this.primaryKey] = value, _b), options);
595
595
  translateOptions(spell, options);
596
596
  if (options.paranoid === false)
597
597
  spell = spell.unparanoid;
598
598
  return spell;
599
599
  };
600
- Spine.findCreateFind = function (options) {
601
- if (options === void 0) { options = {}; }
602
- return __awaiter(this, void 0, void 0, function () {
600
+ Spine.findCreateFind = function () {
601
+ return __awaiter(this, arguments, void 0, function (options) {
603
602
  var where, defaults, instance, err_1;
604
- return __generator(this, function (_a) {
605
- switch (_a.label) {
603
+ if (options === void 0) { options = {}; }
604
+ return __generator(this, function (_b) {
605
+ switch (_b.label) {
606
606
  case 0:
607
607
  where = options.where, defaults = options.defaults;
608
608
  return [4 /*yield*/, this.findOne(options)];
609
609
  case 1:
610
- instance = _a.sent();
610
+ instance = _b.sent();
611
611
  if (!!instance) return [3 /*break*/, 6];
612
- _a.label = 2;
612
+ _b.label = 2;
613
613
  case 2:
614
- _a.trys.push([2, 4, , 6]);
614
+ _b.trys.push([2, 4, , 6]);
615
615
  return [4 /*yield*/, this.create(__assign(__assign({}, defaults), where), options)];
616
616
  case 3:
617
- instance = _a.sent();
617
+ instance = _b.sent();
618
618
  return [3 /*break*/, 6];
619
619
  case 4:
620
- err_1 = _a.sent();
620
+ err_1 = _b.sent();
621
621
  return [4 /*yield*/, this.findOne(options)];
622
622
  case 5:
623
- instance = _a.sent();
623
+ instance = _b.sent();
624
624
  return [3 /*break*/, 6];
625
625
  case 6: return [2 /*return*/, instance];
626
626
  }
@@ -648,17 +648,17 @@ module.exports = function sequelize(Bone) {
648
648
  return spell.unparanoid;
649
649
  return spell;
650
650
  };
651
- Spine.findOrBuild = function (options) {
652
- if (options === void 0) { options = {}; }
653
- return __awaiter(this, void 0, void 0, function () {
651
+ Spine.findOrBuild = function () {
652
+ return __awaiter(this, arguments, void 0, function (options) {
654
653
  var where, defaults, validate, instance, result;
655
- return __generator(this, function (_a) {
656
- switch (_a.label) {
654
+ if (options === void 0) { options = {}; }
655
+ return __generator(this, function (_b) {
656
+ switch (_b.label) {
657
657
  case 0:
658
658
  where = options.where, defaults = options.defaults, validate = options.validate;
659
659
  return [4 /*yield*/, this.findOne(options)];
660
660
  case 1:
661
- instance = _a.sent();
661
+ instance = _b.sent();
662
662
  result = instance || this.build(__assign(__assign({}, defaults), where), { validate: validate });
663
663
  return [2 /*return*/, [result, !instance]];
664
664
  }
@@ -667,17 +667,17 @@ module.exports = function sequelize(Bone) {
667
667
  };
668
668
  Spine.findOrCreate = function (options) {
669
669
  return __awaiter(this, void 0, void 0, function () {
670
- var _a, result, built;
671
- return __generator(this, function (_b) {
672
- switch (_b.label) {
670
+ var _b, result, built;
671
+ return __generator(this, function (_c) {
672
+ switch (_c.label) {
673
673
  case 0: return [4 /*yield*/, this.findOrBuild(options)];
674
674
  case 1:
675
- _a = __read.apply(void 0, [_b.sent(), 2]), result = _a[0], built = _a[1];
675
+ _b = __read.apply(void 0, [_c.sent(), 2]), result = _b[0], built = _b[1];
676
676
  if (!built) return [3 /*break*/, 3];
677
677
  return [4 /*yield*/, result.save()];
678
678
  case 2:
679
- _b.sent();
680
- _b.label = 3;
679
+ _c.sent();
680
+ _c.label = 3;
681
681
  case 3: return [2 /*return*/, [result, built]];
682
682
  }
683
683
  });
@@ -691,7 +691,7 @@ module.exports = function sequelize(Bone) {
691
691
  // BREAKING
692
692
  // static hasOne() {}
693
693
  Spine.increment = function (fields, options) {
694
- var e_5, _a;
694
+ var e_5, _b;
695
695
  if (options === void 0) { options = {}; }
696
696
  var where = options.where, paranoid = options.paranoid;
697
697
  // pass options to update
@@ -706,7 +706,7 @@ module.exports = function sequelize(Bone) {
706
706
  catch (e_5_1) { e_5 = { error: e_5_1 }; }
707
707
  finally {
708
708
  try {
709
- if (fields_2_1 && !fields_2_1.done && (_a = fields_2.return)) _a.call(fields_2);
709
+ if (fields_2_1 && !fields_2_1.done && (_b = fields_2.return)) _b.call(fields_2);
710
710
  }
711
711
  finally { if (e_5) throw e_5.error; }
712
712
  }
@@ -725,40 +725,40 @@ module.exports = function sequelize(Bone) {
725
725
  return spell.unparanoid;
726
726
  return spell;
727
727
  };
728
- Spine.max = function (attribute, options) {
729
- if (options === void 0) { options = {}; }
730
- return __awaiter(this, void 0, void 0, function () {
728
+ Spine.max = function (attribute_1) {
729
+ return __awaiter(this, arguments, void 0, function (attribute, options) {
731
730
  var spell;
732
- return __generator(this, function (_a) {
733
- switch (_a.label) {
731
+ if (options === void 0) { options = {}; }
732
+ return __generator(this, function (_b) {
733
+ switch (_b.label) {
734
734
  case 0:
735
735
  spell = _super._find.call(this, options.where, filterOptions(options)).$maximum(attribute);
736
736
  if (options.paranoid === false)
737
737
  spell = spell.unparanoid;
738
738
  return [4 /*yield*/, spell];
739
- case 1: return [2 /*return*/, _a.sent()];
739
+ case 1: return [2 /*return*/, _b.sent()];
740
740
  }
741
741
  });
742
742
  });
743
743
  };
744
- Spine.min = function (attribute, options) {
745
- if (options === void 0) { options = {}; }
746
- return __awaiter(this, void 0, void 0, function () {
744
+ Spine.min = function (attribute_1) {
745
+ return __awaiter(this, arguments, void 0, function (attribute, options) {
747
746
  var spell;
748
- return __generator(this, function (_a) {
749
- switch (_a.label) {
747
+ if (options === void 0) { options = {}; }
748
+ return __generator(this, function (_b) {
749
+ switch (_b.label) {
750
750
  case 0:
751
751
  spell = _super._find.call(this, options.where, filterOptions(options)).$minimum(attribute);
752
752
  if (options.paranoid === false)
753
753
  spell = spell.unparanoid;
754
754
  return [4 /*yield*/, spell];
755
- case 1: return [2 /*return*/, _a.sent()];
755
+ case 1: return [2 /*return*/, _b.sent()];
756
756
  }
757
757
  });
758
758
  });
759
759
  };
760
760
  Spine.removeAttribute = function (name) {
761
- var _a = this, attributes = _a.attributes, attributeMap = _a.attributeMap;
761
+ var _b = this, attributes = _b.attributes, attributeMap = _b.attributeMap;
762
762
  var columnInfo = attributes[name];
763
763
  delete attributes[name];
764
764
  delete attributeMap[columnInfo.columnName];
@@ -770,18 +770,18 @@ module.exports = function sequelize(Bone) {
770
770
  Spine.schema = function () {
771
771
  throw new Error('unimplemented');
772
772
  };
773
- Spine.sum = function (attribute, options) {
774
- if (options === void 0) { options = {}; }
775
- return __awaiter(this, void 0, void 0, function () {
773
+ Spine.sum = function (attribute_1) {
774
+ return __awaiter(this, arguments, void 0, function (attribute, options) {
776
775
  var spell;
777
- return __generator(this, function (_a) {
778
- switch (_a.label) {
776
+ if (options === void 0) { options = {}; }
777
+ return __generator(this, function (_b) {
778
+ switch (_b.label) {
779
779
  case 0:
780
780
  spell = _super.find.call(this, options.where, filterOptions(options)).$sum(attribute);
781
781
  if (options.paranoid === false)
782
782
  spell = spell.unparanoid;
783
783
  return [4 /*yield*/, spell];
784
- case 1: return [2 /*return*/, _a.sent()];
784
+ case 1: return [2 /*return*/, _b.sent()];
785
785
  }
786
786
  });
787
787
  });
@@ -790,12 +790,12 @@ module.exports = function sequelize(Bone) {
790
790
  // static async sync() {}
791
791
  // EXISTS
792
792
  // static async truncate() {}
793
- Spine.update = function (values, options) {
794
- if (options === void 0) { options = {}; }
795
- return __awaiter(this, void 0, void 0, function () {
793
+ Spine.update = function (values_1) {
794
+ return __awaiter(this, arguments, void 0, function (values, options) {
796
795
  var where, paranoid, individualHooks, findSpell, instances;
797
- return __generator(this, function (_a) {
798
- switch (_a.label) {
796
+ if (options === void 0) { options = {}; }
797
+ return __generator(this, function (_b) {
798
+ switch (_b.label) {
799
799
  case 0:
800
800
  where = options.where, paranoid = options.paranoid, individualHooks = options.individualHooks;
801
801
  if (!individualHooks) return [3 /*break*/, 4];
@@ -805,10 +805,10 @@ module.exports = function sequelize(Bone) {
805
805
  findSpell = findSpell.unparanoid;
806
806
  return [4 /*yield*/, findSpell];
807
807
  case 1:
808
- instances = _a.sent();
808
+ instances = _b.sent();
809
809
  if (!instances.length) return [3 /*break*/, 3];
810
810
  return [4 /*yield*/, Promise.all(instances.map(function (instance) { return instance.update(values, options); }))];
811
- case 2: return [2 /*return*/, _a.sent()];
811
+ case 2: return [2 /*return*/, _b.sent()];
812
812
  case 3: return [3 /*break*/, 5];
813
813
  case 4: return [2 /*return*/, this.bulkUpdate(values, options)];
814
814
  case 5: return [2 /*return*/];
@@ -819,7 +819,7 @@ module.exports = function sequelize(Bone) {
819
819
  // proxy to class.update({ individualHooks=false }) see https://github.com/sequelize/sequelize/blob/4063c2ab627ad57919d5b45cc7755f077a69fa5e/lib/model.js#L3083 before(after)BulkUpdate
820
820
  Spine.bulkUpdate = function (values, options) {
821
821
  if (options === void 0) { options = {}; }
822
- var where = options.where, _a = options.paranoid, paranoid = _a === void 0 ? false : _a, validate = options.validate;
822
+ var where = options.where, _b = options.paranoid, paranoid = _b === void 0 ? false : _b, validate = options.validate;
823
823
  var whereConditions = where || {};
824
824
  var spell = _super.update.call(this, whereConditions, values, __assign({ validate: validate, hooks: false }, options));
825
825
  var transOptions = __assign({}, options);
@@ -833,17 +833,17 @@ module.exports = function sequelize(Bone) {
833
833
  // static upsert(values, options)
834
834
  // EXISTS
835
835
  // get isNewRecord() {}
836
- Spine.prototype.update = function (values, options) {
837
- if (values === void 0) { values = {}; }
838
- if (options === void 0) { options = {}; }
839
- return __awaiter(this, void 0, void 0, function () {
840
- var _a, fields, changeValues, originalValues, name, changedKeys, changedKeys_1, changedKeys_1_1, name, changes, res, err_2;
841
- var e_6, _b;
836
+ Spine.prototype.update = function () {
837
+ return __awaiter(this, arguments, void 0, function (values, options) {
838
+ var _b, fields, changeValues, originalValues, name, changedKeys, changedKeys_1, changedKeys_1_1, name, changes, res, err_2;
839
+ var e_6, _c;
842
840
  var _this = this;
843
- return __generator(this, function (_c) {
844
- switch (_c.label) {
841
+ if (values === void 0) { values = {}; }
842
+ if (options === void 0) { options = {}; }
843
+ return __generator(this, function (_d) {
844
+ switch (_d.label) {
845
845
  case 0:
846
- _a = options.fields, fields = _a === void 0 ? [] : _a;
846
+ _b = options.fields, fields = _b === void 0 ? [] : _b;
847
847
  changeValues = {};
848
848
  originalValues = Object.assign({}, this.getRaw());
849
849
  for (name in values) {
@@ -866,7 +866,7 @@ module.exports = function sequelize(Bone) {
866
866
  catch (e_6_1) { e_6 = { error: e_6_1 }; }
867
867
  finally {
868
868
  try {
869
- if (changedKeys_1_1 && !changedKeys_1_1.done && (_b = changedKeys_1.return)) _b.call(changedKeys_1);
869
+ if (changedKeys_1_1 && !changedKeys_1_1.done && (_c = changedKeys_1.return)) _c.call(changedKeys_1);
870
870
  }
871
871
  finally { if (e_6) throw e_6.error; }
872
872
  }
@@ -887,15 +887,15 @@ module.exports = function sequelize(Bone) {
887
887
  }
888
888
  // instance update don't need to be paranoid
889
889
  options.paranoid = false;
890
- _c.label = 1;
890
+ _d.label = 1;
891
891
  case 1:
892
- _c.trys.push([1, 3, , 4]);
892
+ _d.trys.push([1, 3, , 4]);
893
893
  return [4 /*yield*/, _super.prototype._update.call(this, changes, options)];
894
894
  case 2:
895
- res = _c.sent();
895
+ res = _d.sent();
896
896
  return [2 /*return*/, res];
897
897
  case 3:
898
- err_2 = _c.sent();
898
+ err_2 = _d.sent();
899
899
  // revert value in case update failed
900
900
  this._setRaw(originalValues);
901
901
  throw err_2;
@@ -907,7 +907,7 @@ module.exports = function sequelize(Bone) {
907
907
  // EXISTS
908
908
  // get isNewRecord() {}
909
909
  Spine.prototype.decrement = function (fields, options) {
910
- var e_7, _a, _b;
910
+ var e_7, _b, _c;
911
911
  if (options === void 0) { options = {}; }
912
912
  var Model = this.constructor;
913
913
  var primaryKey = Model.primaryKey;
@@ -929,7 +929,7 @@ module.exports = function sequelize(Bone) {
929
929
  catch (e_7_1) { e_7 = { error: e_7_1 }; }
930
930
  finally {
931
931
  try {
932
- if (fields_3_1 && !fields_3_1.done && (_a = fields_3.return)) _a.call(fields_3);
932
+ if (fields_3_1 && !fields_3_1.done && (_b = fields_3.return)) _b.call(fields_3);
933
933
  }
934
934
  finally { if (e_7) throw e_7.error; }
935
935
  }
@@ -951,7 +951,7 @@ module.exports = function sequelize(Bone) {
951
951
  }
952
952
  this._validateAttributes(updateValues);
953
953
  }
954
- return Model.decrement(fields, __assign(__assign({}, options), { where: (_b = {}, _b[primaryKey] = this[primaryKey], _b) }));
954
+ return Model.decrement(fields, __assign(__assign({}, options), { where: (_c = {}, _c[primaryKey] = this[primaryKey], _c) }));
955
955
  };
956
956
  /**
957
957
  *
@@ -959,15 +959,15 @@ module.exports = function sequelize(Bone) {
959
959
  * @param {*} [options={}]
960
960
  * @returns
961
961
  */
962
- Spine.prototype.destroy = function (options) {
963
- if (options === void 0) { options = {}; }
964
- return __awaiter(this, void 0, void 0, function () {
962
+ Spine.prototype.destroy = function () {
963
+ return __awaiter(this, arguments, void 0, function (options) {
965
964
  var removeResult;
966
- return __generator(this, function (_a) {
967
- switch (_a.label) {
965
+ if (options === void 0) { options = {}; }
966
+ return __generator(this, function (_b) {
967
+ switch (_b.label) {
968
968
  case 0: return [4 /*yield*/, this._remove(options.force, __assign({}, options))];
969
969
  case 1:
970
- removeResult = _a.sent();
970
+ removeResult = _b.sent();
971
971
  if (options.force)
972
972
  return [2 /*return*/, removeResult];
973
973
  return [2 /*return*/, this];
@@ -998,7 +998,7 @@ module.exports = function sequelize(Bone) {
998
998
  configurable: true
999
999
  });
1000
1000
  Spine.prototype.increment = function (fields, options) {
1001
- var e_8, _a, _b;
1001
+ var e_8, _b, _c;
1002
1002
  if (options === void 0) { options = {}; }
1003
1003
  var Model = this.constructor;
1004
1004
  var primaryKey = Model.primaryKey;
@@ -1020,7 +1020,7 @@ module.exports = function sequelize(Bone) {
1020
1020
  catch (e_8_1) { e_8 = { error: e_8_1 }; }
1021
1021
  finally {
1022
1022
  try {
1023
- if (fields_4_1 && !fields_4_1.done && (_a = fields_4.return)) _a.call(fields_4);
1023
+ if (fields_4_1 && !fields_4_1.done && (_b = fields_4.return)) _b.call(fields_4);
1024
1024
  }
1025
1025
  finally { if (e_8) throw e_8.error; }
1026
1026
  }
@@ -1042,20 +1042,20 @@ module.exports = function sequelize(Bone) {
1042
1042
  }
1043
1043
  this._validateAttributes(updateValues);
1044
1044
  }
1045
- return Model.increment(fields, __assign(__assign({}, options), { where: (_b = {}, _b[primaryKey] = this[primaryKey], _b) }));
1045
+ return Model.increment(fields, __assign(__assign({}, options), { where: (_c = {}, _c[primaryKey] = this[primaryKey], _c) }));
1046
1046
  };
1047
1047
  Spine.prototype.isSoftDeleted = function () {
1048
1048
  var deletedAt = this.constructor.timestamps.deletedAt;
1049
1049
  return this[deletedAt] != null;
1050
1050
  };
1051
1051
  Spine.prototype.previous = function (key) {
1052
- var e_9, _a;
1052
+ var e_9, _b;
1053
1053
  if (key != null)
1054
1054
  return this.getRawPrevious(key);
1055
1055
  var result = {};
1056
1056
  try {
1057
- for (var _b = __values(Object.keys(this.constructor.attributes)), _c = _b.next(); !_c.done; _c = _b.next()) {
1058
- var attrKey = _c.value;
1057
+ for (var _c = __values(Object.keys(this.constructor.attributes)), _d = _c.next(); !_d.done; _d = _c.next()) {
1058
+ var attrKey = _d.value;
1059
1059
  var prevValue = this.getRawPrevious(attrKey);
1060
1060
  if (prevValue !== undefined)
1061
1061
  result[attrKey] = prevValue;
@@ -1064,7 +1064,7 @@ module.exports = function sequelize(Bone) {
1064
1064
  catch (e_9_1) { e_9 = { error: e_9_1 }; }
1065
1065
  finally {
1066
1066
  try {
1067
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1067
+ if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
1068
1068
  }
1069
1069
  finally { if (e_9) throw e_9.error; }
1070
1070
  }
@@ -1090,9 +1090,9 @@ module.exports = function sequelize(Bone) {
1090
1090
  // EXISTS
1091
1091
  // validate() {}
1092
1092
  Spine.prototype.where = function () {
1093
- var _a;
1093
+ var _b;
1094
1094
  var primaryKey = this.constructor.primaryKey;
1095
- return _a = {}, _a[primaryKey] = this[primaryKey], _a;
1095
+ return _b = {}, _b[primaryKey] = this[primaryKey], _b;
1096
1096
  };
1097
1097
  Object.defineProperty(Spine.prototype, "Model", {
1098
1098
  /**