pg-mvc-service 2.0.2 → 2.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.
@@ -339,7 +339,7 @@ class TableModel {
339
339
  }
340
340
  throw new Exception_1.UnprocessableException(code, message);
341
341
  }
342
- validateOptions(options, isInsert) {
342
+ validateOptions(options, isInsert, pkOrId) {
343
343
  return __awaiter(this, void 0, void 0, function* () {
344
344
  if (Object.keys(options).length === 0) {
345
345
  throw new Error('At least one key-value pair is required in options.');
@@ -432,7 +432,7 @@ class TableModel {
432
432
  update(pkOrId, options) {
433
433
  return __awaiter(this, void 0, void 0, function* () {
434
434
  var _a;
435
- yield this.validateOptions(options, false);
435
+ yield this.validateOptions(options, false, pkOrId);
436
436
  const updateSetQuery = UpdateExpression_1.default.createUpdateSet(this, options);
437
437
  let whereQuery;
438
438
  if (typeof pkOrId === 'string' || typeof pkOrId === 'number' || typeof pkOrId === 'boolean') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pg-mvc-service",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "",
5
5
  "homepage": "https://github.com/n-daira/npm-pack_mvc-service#readme",
6
6
  "bugs": {
@@ -400,7 +400,7 @@ export class TableModel {
400
400
  throw new UnprocessableException(code, message);
401
401
  }
402
402
 
403
- protected async validateOptions(options: {[key: string]: any}, isInsert: boolean): Promise<void> {
403
+ protected async validateOptions(options: {[key: string]: any}, isInsert: boolean, pkOrId?: string | number | boolean | {[key: string]: any}): Promise<void> {
404
404
  if (Object.keys(options).length === 0) {
405
405
  throw new Error('At least one key-value pair is required in options.');
406
406
  }
@@ -502,7 +502,7 @@ export class TableModel {
502
502
  }
503
503
 
504
504
  public async update(pkOrId: string | number | boolean | {[key: string]: any}, options: {[key: string]: any}) : Promise<void> {
505
- await this.validateOptions(options, false);
505
+ await this.validateOptions(options, false, pkOrId);
506
506
 
507
507
  const updateSetQuery = UpdateExpression.createUpdateSet(this, options);
508
508
  let whereQuery: TQuery;