@oino-ts/db 0.10.0 → 0.10.2

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.
@@ -246,7 +246,7 @@ class OINODbApi {
246
246
  }
247
247
  catch (e) {
248
248
  result.setError(500, "Unhandled exception in doGet: " + e.message, "DoGet");
249
- common_1.OINOLog.exception("@oino-ts/db", "OINODbApi", "_doGet", "Exception", { message: e.message, stack: e.stack });
249
+ common_1.OINOLog.exception("@oino-ts/db", "OINODbApi", "_doGet", "exception in get request", { message: e.message, stack: e.stack });
250
250
  if (this._debugOnError) {
251
251
  result.addDebug("OINO GET SQL [" + sql + "]", "DoGet");
252
252
  }
@@ -282,7 +282,7 @@ class OINODbApi {
282
282
  }
283
283
  catch (e) {
284
284
  result.setError(500, "Unhandled exception in doPost: " + e.message, "DoPost");
285
- common_1.OINOLog.exception("@oino-ts/db", "OINODbApi", "_doGet", "Exception", { message: e.message, stack: e.stack });
285
+ common_1.OINOLog.exception("@oino-ts/db", "OINODbApi", "_doPost", "exception in post request", { message: e.message, stack: e.stack });
286
286
  if (this._debugOnError) {
287
287
  result.addDebug("OINO POST SQL [" + sql + "]", "DoPost");
288
288
  }
@@ -319,7 +319,7 @@ class OINODbApi {
319
319
  }
320
320
  catch (e) {
321
321
  result.setError(500, "Unhandled exception: " + e.message, "DoPut");
322
- common_1.OINOLog.exception("@oino-ts/db", "OINODbApi", "_doGet", "Exception", { message: e.message, stack: e.stack });
322
+ common_1.OINOLog.exception("@oino-ts/db", "OINODbApi", "_doPut", "exception in put request", { message: e.message, stack: e.stack });
323
323
  if (this._debugOnError) {
324
324
  result.addDebug("OINO POST SQL [" + sql + "]", "DoPut");
325
325
  }
@@ -359,6 +359,7 @@ class OINODbApi {
359
359
  }
360
360
  catch (e) {
361
361
  result.setError(500, "Unhandled exception: " + e.message, "DoDelete");
362
+ common_1.OINOLog.exception("@oino-ts/db", "OINODbApi", "_doDelete", "exception in delete request", { message: e.message, stack: e.stack });
362
363
  if (this._debugOnError) {
363
364
  result.addDebug("OINO DELETE SQL [" + sql + "]", "DoDelete");
364
365
  }
@@ -68,6 +68,11 @@ class OINODbSqlFilter {
68
68
  /**
69
69
  * Constructor for `OINODbSqlFilter` as parser of http parameter.
70
70
  *
71
+ * Supports three types of statements:
72
+ * - comparison: (field)-lt|le|eq|ge|gt|like(value)
73
+ * - negation: -not(filter)
74
+ * - conjunction/disjunction: (filter)-and|or(filter)
75
+ *
71
76
  * @param filterString string representation of filter from HTTP-request
72
77
  *
73
78
  */
@@ -214,7 +219,12 @@ class OINODbSqlOrder {
214
219
  /**
215
220
  * Constructor for `OINODbSqlOrder` as parser of http parameter.
216
221
  *
217
- * @param orderString string representation of ordering from HTTP-request
222
+ * Supports comma separated list of column orders formatted as :
223
+ * - `column` - order by column in ascending order
224
+ * - `column ASC|DESC` - order by single either ascending or descending order
225
+ * - `column+|-` - order by single either ascending or descending order
226
+ *
227
+ * @param orderString string representation of order from HTTP-request
218
228
  *
219
229
  */
220
230
  static parse(orderString) {
@@ -276,7 +286,7 @@ exports.OINODbSqlOrder = OINODbSqlOrder;
276
286
  *
277
287
  */
278
288
  class OINODbSqlLimit {
279
- static _limitRegex = /^(\d+)(\spage\s)?(\d+)?$/i;
289
+ static _limitRegex = /^(\d+)(\spage\s|\.)?(\d+)?$/i;
280
290
  _limit;
281
291
  _page;
282
292
  /**
@@ -293,6 +303,11 @@ class OINODbSqlLimit {
293
303
  /**
294
304
  * Constructor for `OINODbSqlLimit` as parser of http parameter.
295
305
  *
306
+ * Supports limit and page formatted as:
307
+ * - `limit` - limit number of items to return
308
+ * - `limit page n` - limit number of items to return and return page n (starting from 1)
309
+ * - `limit.n` - limit number of items to return and return page n (starting from 1)
310
+ *
296
311
  * @param limitString string representation of limit from HTTP-request
297
312
  *
298
313
  */
@@ -368,6 +383,11 @@ class OINODbSqlAggregate {
368
383
  /**
369
384
  * Constructor for `OINODbSqlAggregate` as parser of http parameter.
370
385
  *
386
+ * Supports comma separated list of aggregates formatted as:
387
+ * - `function(field)`
388
+ *
389
+ * Supported functions are count, sum, avg, min, max.
390
+ *
371
391
  * @param aggregatorString string representation of limit from HTTP-request
372
392
  *
373
393
  */
@@ -468,7 +488,7 @@ class OINODbSqlSelect {
468
488
  /**
469
489
  * Constructor for `OINODbSqlSelect` as parser of http parameter.
470
490
  *
471
- * @param columns comma separatef string selected columns from HTTP-request
491
+ * @param columns comma separated string selected columns from HTTP-request
472
492
  *
473
493
  */
474
494
  static parse(columns) {
@@ -241,7 +241,7 @@ export class OINODbApi {
241
241
  }
242
242
  catch (e) {
243
243
  result.setError(500, "Unhandled exception in doGet: " + e.message, "DoGet");
244
- OINOLog.exception("@oino-ts/db", "OINODbApi", "_doGet", "Exception", { message: e.message, stack: e.stack });
244
+ OINOLog.exception("@oino-ts/db", "OINODbApi", "_doGet", "exception in get request", { message: e.message, stack: e.stack });
245
245
  if (this._debugOnError) {
246
246
  result.addDebug("OINO GET SQL [" + sql + "]", "DoGet");
247
247
  }
@@ -277,7 +277,7 @@ export class OINODbApi {
277
277
  }
278
278
  catch (e) {
279
279
  result.setError(500, "Unhandled exception in doPost: " + e.message, "DoPost");
280
- OINOLog.exception("@oino-ts/db", "OINODbApi", "_doGet", "Exception", { message: e.message, stack: e.stack });
280
+ OINOLog.exception("@oino-ts/db", "OINODbApi", "_doPost", "exception in post request", { message: e.message, stack: e.stack });
281
281
  if (this._debugOnError) {
282
282
  result.addDebug("OINO POST SQL [" + sql + "]", "DoPost");
283
283
  }
@@ -314,7 +314,7 @@ export class OINODbApi {
314
314
  }
315
315
  catch (e) {
316
316
  result.setError(500, "Unhandled exception: " + e.message, "DoPut");
317
- OINOLog.exception("@oino-ts/db", "OINODbApi", "_doGet", "Exception", { message: e.message, stack: e.stack });
317
+ OINOLog.exception("@oino-ts/db", "OINODbApi", "_doPut", "exception in put request", { message: e.message, stack: e.stack });
318
318
  if (this._debugOnError) {
319
319
  result.addDebug("OINO POST SQL [" + sql + "]", "DoPut");
320
320
  }
@@ -354,6 +354,7 @@ export class OINODbApi {
354
354
  }
355
355
  catch (e) {
356
356
  result.setError(500, "Unhandled exception: " + e.message, "DoDelete");
357
+ OINOLog.exception("@oino-ts/db", "OINODbApi", "_doDelete", "exception in delete request", { message: e.message, stack: e.stack });
357
358
  if (this._debugOnError) {
358
359
  result.addDebug("OINO DELETE SQL [" + sql + "]", "DoDelete");
359
360
  }
@@ -65,6 +65,11 @@ export class OINODbSqlFilter {
65
65
  /**
66
66
  * Constructor for `OINODbSqlFilter` as parser of http parameter.
67
67
  *
68
+ * Supports three types of statements:
69
+ * - comparison: (field)-lt|le|eq|ge|gt|like(value)
70
+ * - negation: -not(filter)
71
+ * - conjunction/disjunction: (filter)-and|or(filter)
72
+ *
68
73
  * @param filterString string representation of filter from HTTP-request
69
74
  *
70
75
  */
@@ -210,7 +215,12 @@ export class OINODbSqlOrder {
210
215
  /**
211
216
  * Constructor for `OINODbSqlOrder` as parser of http parameter.
212
217
  *
213
- * @param orderString string representation of ordering from HTTP-request
218
+ * Supports comma separated list of column orders formatted as :
219
+ * - `column` - order by column in ascending order
220
+ * - `column ASC|DESC` - order by single either ascending or descending order
221
+ * - `column+|-` - order by single either ascending or descending order
222
+ *
223
+ * @param orderString string representation of order from HTTP-request
214
224
  *
215
225
  */
216
226
  static parse(orderString) {
@@ -271,7 +281,7 @@ export class OINODbSqlOrder {
271
281
  *
272
282
  */
273
283
  export class OINODbSqlLimit {
274
- static _limitRegex = /^(\d+)(\spage\s)?(\d+)?$/i;
284
+ static _limitRegex = /^(\d+)(\spage\s|\.)?(\d+)?$/i;
275
285
  _limit;
276
286
  _page;
277
287
  /**
@@ -288,6 +298,11 @@ export class OINODbSqlLimit {
288
298
  /**
289
299
  * Constructor for `OINODbSqlLimit` as parser of http parameter.
290
300
  *
301
+ * Supports limit and page formatted as:
302
+ * - `limit` - limit number of items to return
303
+ * - `limit page n` - limit number of items to return and return page n (starting from 1)
304
+ * - `limit.n` - limit number of items to return and return page n (starting from 1)
305
+ *
291
306
  * @param limitString string representation of limit from HTTP-request
292
307
  *
293
308
  */
@@ -362,6 +377,11 @@ export class OINODbSqlAggregate {
362
377
  /**
363
378
  * Constructor for `OINODbSqlAggregate` as parser of http parameter.
364
379
  *
380
+ * Supports comma separated list of aggregates formatted as:
381
+ * - `function(field)`
382
+ *
383
+ * Supported functions are count, sum, avg, min, max.
384
+ *
365
385
  * @param aggregatorString string representation of limit from HTTP-request
366
386
  *
367
387
  */
@@ -461,7 +481,7 @@ export class OINODbSqlSelect {
461
481
  /**
462
482
  * Constructor for `OINODbSqlSelect` as parser of http parameter.
463
483
  *
464
- * @param columns comma separatef string selected columns from HTTP-request
484
+ * @param columns comma separated string selected columns from HTTP-request
465
485
  *
466
486
  */
467
487
  static parse(columns) {
@@ -46,6 +46,11 @@ export declare class OINODbSqlFilter {
46
46
  /**
47
47
  * Constructor for `OINODbSqlFilter` as parser of http parameter.
48
48
  *
49
+ * Supports three types of statements:
50
+ * - comparison: (field)-lt|le|eq|ge|gt|like(value)
51
+ * - negation: -not(filter)
52
+ * - conjunction/disjunction: (filter)-and|or(filter)
53
+ *
49
54
  * @param filterString string representation of filter from HTTP-request
50
55
  *
51
56
  */
@@ -92,7 +97,12 @@ export declare class OINODbSqlOrder {
92
97
  /**
93
98
  * Constructor for `OINODbSqlOrder` as parser of http parameter.
94
99
  *
95
- * @param orderString string representation of ordering from HTTP-request
100
+ * Supports comma separated list of column orders formatted as :
101
+ * - `column` - order by column in ascending order
102
+ * - `column ASC|DESC` - order by single either ascending or descending order
103
+ * - `column+|-` - order by single either ascending or descending order
104
+ *
105
+ * @param orderString string representation of order from HTTP-request
96
106
  *
97
107
  */
98
108
  static parse(orderString: string): OINODbSqlOrder;
@@ -128,6 +138,11 @@ export declare class OINODbSqlLimit {
128
138
  /**
129
139
  * Constructor for `OINODbSqlLimit` as parser of http parameter.
130
140
  *
141
+ * Supports limit and page formatted as:
142
+ * - `limit` - limit number of items to return
143
+ * - `limit page n` - limit number of items to return and return page n (starting from 1)
144
+ * - `limit.n` - limit number of items to return and return page n (starting from 1)
145
+ *
131
146
  * @param limitString string representation of limit from HTTP-request
132
147
  *
133
148
  */
@@ -175,6 +190,11 @@ export declare class OINODbSqlAggregate {
175
190
  /**
176
191
  * Constructor for `OINODbSqlAggregate` as parser of http parameter.
177
192
  *
193
+ * Supports comma separated list of aggregates formatted as:
194
+ * - `function(field)`
195
+ *
196
+ * Supported functions are count, sum, avg, min, max.
197
+ *
178
198
  * @param aggregatorString string representation of limit from HTTP-request
179
199
  *
180
200
  */
@@ -223,7 +243,7 @@ export declare class OINODbSqlSelect {
223
243
  /**
224
244
  * Constructor for `OINODbSqlSelect` as parser of http parameter.
225
245
  *
226
- * @param columns comma separatef string selected columns from HTTP-request
246
+ * @param columns comma separated string selected columns from HTTP-request
227
247
  *
228
248
  */
229
249
  static parse(columns: string): OINODbSqlSelect;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oino-ts/db",
3
- "version": "0.10.0",
3
+ "version": "0.10.2",
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,12 +19,12 @@
19
19
  "module": "./dist/esm/index.js",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "dependencies": {
22
- "@oino-ts/common": "0.10.0"
22
+ "@oino-ts/common": "0.10.2"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/node": "^20.14.10",
26
26
  "@types/bun": "^1.1.14",
27
- "@oino-ts/types": "0.10.0",
27
+ "@oino-ts/types": "0.10.2",
28
28
  "typedoc": "^0.25.13"
29
29
  },
30
30
  "files": [
package/src/OINODbApi.ts CHANGED
@@ -254,7 +254,7 @@ export class OINODbApi {
254
254
  }
255
255
  } catch (e:any) {
256
256
  result.setError(500, "Unhandled exception in doGet: " + e.message, "DoGet")
257
- OINOLog.exception("@oino-ts/db", "OINODbApi", "_doGet", "Exception", {message:e.message, stack:e.stack})
257
+ OINOLog.exception("@oino-ts/db", "OINODbApi", "_doGet", "exception in get request", {message:e.message, stack:e.stack})
258
258
  if (this._debugOnError) {
259
259
  result.addDebug("OINO GET SQL [" + sql + "]", "DoGet")
260
260
  }
@@ -290,7 +290,7 @@ export class OINODbApi {
290
290
  }
291
291
  } catch (e:any) {
292
292
  result.setError(500, "Unhandled exception in doPost: " + e.message, "DoPost")
293
- OINOLog.exception("@oino-ts/db", "OINODbApi", "_doGet", "Exception", {message:e.message, stack:e.stack})
293
+ OINOLog.exception("@oino-ts/db", "OINODbApi", "_doPost", "exception in post request", {message:e.message, stack:e.stack})
294
294
  if (this._debugOnError) {
295
295
  result.addDebug("OINO POST SQL [" + sql + "]", "DoPost")
296
296
  }
@@ -327,7 +327,7 @@ export class OINODbApi {
327
327
  }
328
328
  } catch (e:any) {
329
329
  result.setError(500, "Unhandled exception: " + e.message, "DoPut")
330
- OINOLog.exception("@oino-ts/db", "OINODbApi", "_doGet", "Exception", {message:e.message, stack:e.stack})
330
+ OINOLog.exception("@oino-ts/db", "OINODbApi", "_doPut", "exception in put request", {message:e.message, stack:e.stack})
331
331
  if (this._debugOnError) {
332
332
  result.addDebug("OINO POST SQL [" + sql + "]", "DoPut")
333
333
  }
@@ -366,6 +366,7 @@ export class OINODbApi {
366
366
  }
367
367
  } catch (e:any) {
368
368
  result.setError(500, "Unhandled exception: " + e.message, "DoDelete")
369
+ OINOLog.exception("@oino-ts/db", "OINODbApi", "_doDelete", "exception in delete request", {message:e.message, stack:e.stack})
369
370
  if (this._debugOnError) {
370
371
  result.addDebug("OINO DELETE SQL [" + sql + "]", "DoDelete")
371
372
  }
@@ -62,6 +62,11 @@ export class OINODbSqlFilter {
62
62
  /**
63
63
  * Constructor for `OINODbSqlFilter` as parser of http parameter.
64
64
  *
65
+ * Supports three types of statements:
66
+ * - comparison: (field)-lt|le|eq|ge|gt|like(value)
67
+ * - negation: -not(filter)
68
+ * - conjunction/disjunction: (filter)-and|or(filter)
69
+ *
65
70
  * @param filterString string representation of filter from HTTP-request
66
71
  *
67
72
  */
@@ -210,7 +215,12 @@ export class OINODbSqlOrder {
210
215
  /**
211
216
  * Constructor for `OINODbSqlOrder` as parser of http parameter.
212
217
  *
213
- * @param orderString string representation of ordering from HTTP-request
218
+ * Supports comma separated list of column orders formatted as :
219
+ * - `column` - order by column in ascending order
220
+ * - `column ASC|DESC` - order by single either ascending or descending order
221
+ * - `column+|-` - order by single either ascending or descending order
222
+ *
223
+ * @param orderString string representation of order from HTTP-request
214
224
  *
215
225
  */
216
226
  static parse(orderString: string):OINODbSqlOrder {
@@ -275,7 +285,7 @@ export class OINODbSqlOrder {
275
285
  *
276
286
  */
277
287
  export class OINODbSqlLimit {
278
- private static _limitRegex = /^(\d+)(\spage\s)?(\d+)?$/i
288
+ private static _limitRegex = /^(\d+)(\spage\s|\.)?(\d+)?$/i
279
289
 
280
290
  private _limit: number
281
291
  private _page: number
@@ -294,6 +304,11 @@ export class OINODbSqlLimit {
294
304
  /**
295
305
  * Constructor for `OINODbSqlLimit` as parser of http parameter.
296
306
  *
307
+ * Supports limit and page formatted as:
308
+ * - `limit` - limit number of items to return
309
+ * - `limit page n` - limit number of items to return and return page n (starting from 1)
310
+ * - `limit.n` - limit number of items to return and return page n (starting from 1)
311
+ *
297
312
  * @param limitString string representation of limit from HTTP-request
298
313
  *
299
314
  */
@@ -365,6 +380,11 @@ export class OINODbSqlAggregate {
365
380
  /**
366
381
  * Constructor for `OINODbSqlAggregate` as parser of http parameter.
367
382
  *
383
+ * Supports comma separated list of aggregates formatted as:
384
+ * - `function(field)`
385
+ *
386
+ * Supported functions are count, sum, avg, min, max.
387
+ *
368
388
  * @param aggregatorString string representation of limit from HTTP-request
369
389
  *
370
390
  */
@@ -471,7 +491,7 @@ export class OINODbSqlSelect {
471
491
  /**
472
492
  * Constructor for `OINODbSqlSelect` as parser of http parameter.
473
493
  *
474
- * @param columns comma separatef string selected columns from HTTP-request
494
+ * @param columns comma separated string selected columns from HTTP-request
475
495
  *
476
496
  */
477
497
  static parse(columns: string):OINODbSqlSelect {