@oino-ts/db 0.20.1 → 0.21.0

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.
@@ -582,7 +582,7 @@ class OINODbApi {
582
582
  else {
583
583
  result.setError(405, "Unsupported HTTP method '" + request.method + "' for REST request", "DoRequest");
584
584
  }
585
- common_1.OINOBenchmark.endMetric("OINODbApi", "doRequest." + request.method);
585
+ common_1.OINOBenchmark.endMetric("OINODbApi", "doRequest." + request.method, result.status != 500);
586
586
  return Promise.resolve(result);
587
587
  }
588
588
  /**
@@ -627,7 +627,7 @@ class OINODbApi {
627
627
  result.setError(500, "Unhandled exception in HTTP DELETE doRequest: " + e.message, "DoBatchUpdate");
628
628
  }
629
629
  }
630
- common_1.OINOBenchmark.endMetric("OINODbApi", "doBatchUpdate." + request.method);
630
+ common_1.OINOBenchmark.endMetric("OINODbApi", "doBatchUpdate." + request.method, result.status != 500);
631
631
  return Promise.resolve(result);
632
632
  }
633
633
  /**
@@ -81,6 +81,9 @@ class OINODbDataModel {
81
81
  result += f.printSqlColumnName() + "=" + f.printCellAsSqlValue(val);
82
82
  }
83
83
  }
84
+ if (result == "") {
85
+ throw new Error(common_1.OINO_ERROR_PREFIX + ": no valid updatable fields provided for row!");
86
+ }
84
87
  return result;
85
88
  }
86
89
  _printSqlPrimaryKeyCondition(id_value) {
@@ -576,7 +576,7 @@ export class OINODbApi {
576
576
  else {
577
577
  result.setError(405, "Unsupported HTTP method '" + request.method + "' for REST request", "DoRequest");
578
578
  }
579
- OINOBenchmark.endMetric("OINODbApi", "doRequest." + request.method);
579
+ OINOBenchmark.endMetric("OINODbApi", "doRequest." + request.method, result.status != 500);
580
580
  return Promise.resolve(result);
581
581
  }
582
582
  /**
@@ -621,7 +621,7 @@ export class OINODbApi {
621
621
  result.setError(500, "Unhandled exception in HTTP DELETE doRequest: " + e.message, "DoBatchUpdate");
622
622
  }
623
623
  }
624
- OINOBenchmark.endMetric("OINODbApi", "doBatchUpdate." + request.method);
624
+ OINOBenchmark.endMetric("OINODbApi", "doBatchUpdate." + request.method, result.status != 500);
625
625
  return Promise.resolve(result);
626
626
  }
627
627
  /**
@@ -78,6 +78,9 @@ export class OINODbDataModel {
78
78
  result += f.printSqlColumnName() + "=" + f.printCellAsSqlValue(val);
79
79
  }
80
80
  }
81
+ if (result == "") {
82
+ throw new Error(OINO_ERROR_PREFIX + ": no valid updatable fields provided for row!");
83
+ }
81
84
  return result;
82
85
  }
83
86
  _printSqlPrimaryKeyCondition(id_value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oino-ts/db",
3
- "version": "0.20.1",
3
+ "version": "0.21.0",
4
4
  "description": "OINO TS library package for publishing an SQL database tables as a REST API.",
5
5
  "author": "Matias Kiviniemi (pragmatta)",
6
6
  "license": "MPL-2.0",
@@ -19,13 +19,13 @@
19
19
  "module": "./dist/esm/index.js",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "dependencies": {
22
- "@oino-ts/common": "0.20.1",
22
+ "@oino-ts/common": "0.21.0",
23
23
  "oino-ts": "file:.."
24
24
  },
25
25
  "devDependencies": {
26
- "@oino-ts/types": "0.20.1",
26
+ "@oino-ts/types": "0.21.0",
27
27
  "@types/bun": "^1.1.14",
28
- "@types/node": "^20.20.10",
28
+ "@types/node": "^20.21.00",
29
29
  "typescript": "~5.9.0"
30
30
  },
31
31
  "files": [
package/src/OINODbApi.ts CHANGED
@@ -598,7 +598,7 @@ export class OINODbApi {
598
598
  } else {
599
599
  result.setError(405, "Unsupported HTTP method '" + request.method + "' for REST request", "DoRequest")
600
600
  }
601
- OINOBenchmark.endMetric("OINODbApi", "doRequest." + request.method)
601
+ OINOBenchmark.endMetric("OINODbApi", "doRequest." + request.method, result.status != 500)
602
602
  return Promise.resolve(result)
603
603
  }
604
604
 
@@ -645,7 +645,7 @@ export class OINODbApi {
645
645
  result.setError(500, "Unhandled exception in HTTP DELETE doRequest: " + e.message, "DoBatchUpdate")
646
646
  }
647
647
  }
648
- OINOBenchmark.endMetric("OINODbApi", "doBatchUpdate." + request.method)
648
+ OINOBenchmark.endMetric("OINODbApi", "doBatchUpdate." + request.method, result.status != 500)
649
649
  return Promise.resolve(result)
650
650
  }
651
651
 
@@ -85,6 +85,9 @@ export class OINODbDataModel {
85
85
  result += f.printSqlColumnName() + "=" + f.printCellAsSqlValue(val);
86
86
  }
87
87
  }
88
+ if (result == "") {
89
+ throw new Error(OINO_ERROR_PREFIX + ": no valid updatable fields provided for row!")
90
+ }
88
91
  return result;
89
92
  }
90
93