@opra/sqb 1.0.0-alpha.37 → 1.0.0-alpha.38

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.
@@ -473,13 +473,14 @@ class SqbEntityService extends core_1.ServiceBase {
473
473
  if (!(proto instanceof SqbEntityService))
474
474
  break;
475
475
  }
476
+ /** Call before[X] hooks */
476
477
  if (command.crud === 'create')
477
478
  await this._beforeCreate(command);
478
479
  else if (command.crud === 'update' && command.byId) {
479
480
  await this._beforeUpdate(command);
480
481
  }
481
482
  else if (command.crud === 'update' && !command.byId) {
482
- await this._beforeUpdate(command);
483
+ await this._beforeUpdateMany(command);
483
484
  }
484
485
  else if (command.crud === 'delete' && command.byId) {
485
486
  await this._beforeDelete(command);
@@ -487,14 +488,19 @@ class SqbEntityService extends core_1.ServiceBase {
487
488
  else if (command.crud === 'delete' && !command.byId) {
488
489
  await this._beforeDeleteMany(command);
489
490
  }
490
- const result = await commandFn();
491
+ /** Call command function */
492
+ return commandFn();
493
+ };
494
+ try {
495
+ const result = await next();
496
+ /** Call after[X] hooks */
491
497
  if (command.crud === 'create')
492
498
  await this._afterCreate(command, result);
493
499
  else if (command.crud === 'update' && command.byId) {
494
500
  await this._afterUpdate(command, result);
495
501
  }
496
502
  else if (command.crud === 'update' && !command.byId) {
497
- await this._afterUpdate(command, result);
503
+ await this._afterUpdateMany(command, result);
498
504
  }
499
505
  else if (command.crud === 'delete' && command.byId) {
500
506
  await this._afterDelete(command, result);
@@ -503,9 +509,6 @@ class SqbEntityService extends core_1.ServiceBase {
503
509
  await this._afterDeleteMany(command, result);
504
510
  }
505
511
  return result;
506
- };
507
- try {
508
- return await next();
509
512
  }
510
513
  catch (e) {
511
514
  Error.captureStackTrace(e, this._executeCommand);
@@ -470,13 +470,14 @@ export class SqbEntityService extends ServiceBase {
470
470
  if (!(proto instanceof SqbEntityService))
471
471
  break;
472
472
  }
473
+ /** Call before[X] hooks */
473
474
  if (command.crud === 'create')
474
475
  await this._beforeCreate(command);
475
476
  else if (command.crud === 'update' && command.byId) {
476
477
  await this._beforeUpdate(command);
477
478
  }
478
479
  else if (command.crud === 'update' && !command.byId) {
479
- await this._beforeUpdate(command);
480
+ await this._beforeUpdateMany(command);
480
481
  }
481
482
  else if (command.crud === 'delete' && command.byId) {
482
483
  await this._beforeDelete(command);
@@ -484,14 +485,19 @@ export class SqbEntityService extends ServiceBase {
484
485
  else if (command.crud === 'delete' && !command.byId) {
485
486
  await this._beforeDeleteMany(command);
486
487
  }
487
- const result = await commandFn();
488
+ /** Call command function */
489
+ return commandFn();
490
+ };
491
+ try {
492
+ const result = await next();
493
+ /** Call after[X] hooks */
488
494
  if (command.crud === 'create')
489
495
  await this._afterCreate(command, result);
490
496
  else if (command.crud === 'update' && command.byId) {
491
497
  await this._afterUpdate(command, result);
492
498
  }
493
499
  else if (command.crud === 'update' && !command.byId) {
494
- await this._afterUpdate(command, result);
500
+ await this._afterUpdateMany(command, result);
495
501
  }
496
502
  else if (command.crud === 'delete' && command.byId) {
497
503
  await this._afterDelete(command, result);
@@ -500,9 +506,6 @@ export class SqbEntityService extends ServiceBase {
500
506
  await this._afterDeleteMany(command, result);
501
507
  }
502
508
  return result;
503
- };
504
- try {
505
- return await next();
506
509
  }
507
510
  catch (e) {
508
511
  Error.captureStackTrace(e, this._executeCommand);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opra/sqb",
3
- "version": "1.0.0-alpha.37",
3
+ "version": "1.0.0-alpha.38",
4
4
  "description": "Opra SQB adapter package",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -10,7 +10,7 @@
10
10
  "valgen": "^5.9.0"
11
11
  },
12
12
  "peerDependencies": {
13
- "@opra/core": "^1.0.0-alpha.37",
13
+ "@opra/core": "^1.0.0-alpha.38",
14
14
  "@sqb/connect": ">= 4.10.6"
15
15
  },
16
16
  "type": "module",