@sqb/builder 4.11.3 → 4.12.1

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 (65) hide show
  1. package/README.md +9 -24
  2. package/cjs/helpers.js +1 -1
  3. package/cjs/op.initializers.js +1 -1
  4. package/cjs/query/delete-query.js +2 -3
  5. package/cjs/query/insert-query.js +3 -5
  6. package/cjs/query/query.js +1 -1
  7. package/cjs/query/returning-query.js +4 -3
  8. package/cjs/query/select-query.js +4 -8
  9. package/cjs/query/union-query.js +1 -1
  10. package/cjs/query/update-query.js +3 -4
  11. package/cjs/serialize-context.js +60 -18
  12. package/cjs/sql-objects/case-statement.js +3 -4
  13. package/cjs/sql-objects/coalesce-statement.js +1 -2
  14. package/cjs/sql-objects/count-statement.js +3 -1
  15. package/cjs/sql-objects/field-expression.js +4 -5
  16. package/cjs/sql-objects/group-column.js +3 -3
  17. package/cjs/sql-objects/join-statement.js +4 -6
  18. package/cjs/sql-objects/lower-statement.js +1 -2
  19. package/cjs/sql-objects/max-statement.js +1 -2
  20. package/cjs/sql-objects/min-statement.js +1 -2
  21. package/cjs/sql-objects/operators/comp-operator.js +4 -6
  22. package/cjs/sql-objects/operators/logical-operator.js +1 -1
  23. package/cjs/sql-objects/operators/op-between.js +3 -7
  24. package/cjs/sql-objects/operators/op-exists.js +1 -1
  25. package/cjs/sql-objects/order-column.js +4 -4
  26. package/cjs/sql-objects/param-expression.js +1 -2
  27. package/cjs/sql-objects/returning-column.js +2 -3
  28. package/cjs/sql-objects/sequence-getter-statement.js +2 -3
  29. package/cjs/sql-objects/string-agg-statement.js +9 -5
  30. package/cjs/sql-objects/table-name.js +2 -3
  31. package/cjs/sql-objects/upper-statement.js +1 -2
  32. package/cjs/sqlobject.initializers.js +1 -1
  33. package/esm/helpers.js +1 -1
  34. package/esm/op.initializers.js +2 -2
  35. package/esm/query/delete-query.js +2 -3
  36. package/esm/query/insert-query.js +3 -5
  37. package/esm/query/query.js +1 -1
  38. package/esm/query/returning-query.js +4 -3
  39. package/esm/query/select-query.js +4 -8
  40. package/esm/query/union-query.js +1 -1
  41. package/esm/query/update-query.js +3 -4
  42. package/esm/serialize-context.js +60 -18
  43. package/esm/sql-objects/case-statement.js +3 -4
  44. package/esm/sql-objects/coalesce-statement.js +1 -2
  45. package/esm/sql-objects/count-statement.js +3 -1
  46. package/esm/sql-objects/field-expression.js +4 -5
  47. package/esm/sql-objects/group-column.js +3 -3
  48. package/esm/sql-objects/join-statement.js +4 -6
  49. package/esm/sql-objects/lower-statement.js +1 -2
  50. package/esm/sql-objects/max-statement.js +1 -2
  51. package/esm/sql-objects/min-statement.js +1 -2
  52. package/esm/sql-objects/operators/comp-operator.js +4 -6
  53. package/esm/sql-objects/operators/logical-operator.js +1 -1
  54. package/esm/sql-objects/operators/op-between.js +3 -7
  55. package/esm/sql-objects/operators/op-exists.js +1 -1
  56. package/esm/sql-objects/order-column.js +4 -4
  57. package/esm/sql-objects/param-expression.js +1 -2
  58. package/esm/sql-objects/returning-column.js +2 -3
  59. package/esm/sql-objects/sequence-getter-statement.js +2 -3
  60. package/esm/sql-objects/string-agg-statement.js +9 -5
  61. package/esm/sql-objects/table-name.js +2 -3
  62. package/esm/sql-objects/upper-statement.js +1 -2
  63. package/esm/sqlobject.initializers.js +1 -1
  64. package/package.json +4 -2
  65. package/types/op.initializers.d.ts +1 -1
@@ -47,7 +47,7 @@ export class StringAGGStatement extends Serializable {
47
47
  field: ctx.anyToSQL(this._field),
48
48
  delimiter: this._delimiter,
49
49
  orderBy: this.__serializeOrderColumns(ctx),
50
- alias: this._alias
50
+ alias: this._alias,
51
51
  };
52
52
  return ctx.serialize(this._type, q, () => this.__defaultSerialize(ctx, q));
53
53
  }
@@ -66,9 +66,13 @@ export class StringAGGStatement extends Serializable {
66
66
  });
67
67
  }
68
68
  __defaultSerialize(ctx, o) {
69
- return 'string_agg(' + o.field +
70
- ',\'' + o.delimiter + '\'' +
71
- (o.orderBy ? ' ' + o.orderBy : '') + ')' +
72
- (o.alias ? ' ' + o.alias : '');
69
+ return ('string_agg(' +
70
+ o.field +
71
+ ",'" +
72
+ o.delimiter +
73
+ "'" +
74
+ (o.orderBy ? ' ' + o.orderBy : '') +
75
+ ')' +
76
+ (o.alias ? ' ' + o.alias : ''));
73
77
  }
74
78
  }
@@ -20,8 +20,7 @@ export class TableName extends Serializable {
20
20
  return ctx.serialize(this._type, {
21
21
  schema: this.schema,
22
22
  table: this.table,
23
- alias: this.alias
24
- }, () => (this.schema ? this.schema + '.' : '') + this.table +
25
- (this.alias ? ' ' + this.alias : ''));
23
+ alias: this.alias,
24
+ }, () => (this.schema ? this.schema + '.' : '') + this.table + (this.alias ? ' ' + this.alias : ''));
26
25
  }
27
26
  }
@@ -29,7 +29,6 @@ export class UpperStatement extends Serializable {
29
29
  return ctx.serialize(this._type, q, () => this.__defaultSerialize(ctx, q));
30
30
  }
31
31
  __defaultSerialize(ctx, o) {
32
- return 'upper(' + o + ')' +
33
- (this._alias ? ' ' + this._alias : '');
32
+ return 'upper(' + o + ')' + (this._alias ? ' ' + this._alias : '');
34
33
  }
35
34
  }
@@ -101,7 +101,7 @@ export function Param(arg0, arg1, arg2) {
101
101
  return new ParamExpression({
102
102
  name: arg0,
103
103
  dataType: arg1,
104
- isArray: arg2
104
+ isArray: arg2,
105
105
  });
106
106
  }
107
107
  export function Field(arg0, arg1, arg2) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sqb/builder",
3
3
  "description": "Extensible multi-dialect SQL query builder written with TypeScript",
4
- "version": "4.11.3",
4
+ "version": "4.12.1",
5
5
  "author": "Panates",
6
6
  "private": false,
7
7
  "contributors": [
@@ -26,6 +26,8 @@
26
26
  "build:esm": "tsc -b tsconfig-build-esm.json",
27
27
  "postbuild": "cp README.md package.json ../../LICENSE ../../build/builder && cp ../../package.cjs.json ../../build/builder/cjs/package.json",
28
28
  "lint": "eslint . --max-warnings=0",
29
+ "lint:fix": "eslint . --max-warnings=0 --fix",
30
+ "format": "prettier . --write --log-level=warn",
29
31
  "test": "jest --runInBand",
30
32
  "cover": "jest --collect-coverage",
31
33
  "clean": "npm run clean:src | npm run clean:dist | npm run clean:cover",
@@ -34,7 +36,7 @@
34
36
  "clean:cover": "rimraf ../../coverage/builder"
35
37
  },
36
38
  "dependencies": {
37
- "debug": "^4.3.4",
39
+ "debug": "^4.3.5",
38
40
  "putil-flattentext": "^2.1.1",
39
41
  "putil-isplainobject": "^1.1.5",
40
42
  "putil-merge": "^3.12.1",
@@ -86,4 +86,4 @@ declare const op: {
86
86
  '!exists': typeof NotExists;
87
87
  };
88
88
  export { op };
89
- export { And, Or, Eq, Eq as Equal, Ne, Ne as NotEqual, Gt, Gt as GreaterThan, Gte, Gte as GreaterAnEqualTo, Lt, Lt as LowerThan, Lte, Lte as LowerAndEqualTo, Between, NotBetween, In, NotIn, NotIn as Nin, Like, NotLike, NotLike as NLike, Ilike, NotILike, NotILike as Nilike, Is, IsNot, Exists, NotExists, Not };
89
+ export { And, Or, Eq, Eq as Equal, Ne, Ne as NotEqual, Gt, Gt as GreaterThan, Gte, Gte as GreaterAnEqualTo, Lt, Lt as LowerThan, Lte, Lte as LowerAndEqualTo, Between, NotBetween, In, NotIn, NotIn as Nin, Like, NotLike, NotLike as NLike, Ilike, NotILike, NotILike as Nilike, Is, IsNot, Exists, NotExists, Not, };