@sqb/connect 4.18.0 → 4.19.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.
@@ -62,7 +62,7 @@ async function prepareFilter(entityDef, filter, trgOp, tableAlias = 'T') {
62
62
  else
63
63
  srcOp.add(filter);
64
64
  }
65
- const associationPathCache = {};
65
+ // const associationPathCache: Record<string, any> = {};
66
66
  for (const item of srcOp._items) {
67
67
  if ((0, builder_1.isLogicalOperator)(item)) {
68
68
  const ctor = Object.getPrototypeOf(item).constructor;
@@ -83,18 +83,18 @@ async function prepareFilter(entityDef, filter, trgOp, tableAlias = 'T') {
83
83
  let subSelect;
84
84
  let currentOp = trgOp;
85
85
  let i = 0;
86
- const parentPath = itemPath
87
- .slice(0, l - 2)
88
- .join('.')
89
- .toLowerCase();
90
- const cached = associationPathCache[parentPath];
91
- if (cached) {
92
- /** Jump to last item */
93
- i = l - 1;
94
- _curEntity = cached._curEntity;
95
- _curAlias = cached._curAlias;
96
- currentOp = cached.currentOp;
97
- }
86
+ // const parentPath = itemPath
87
+ // .slice(0, l - 2)
88
+ // .join('.')
89
+ // .toLowerCase();
90
+ // const cached = associationPathCache[parentPath];
91
+ // if (cached) {
92
+ // /** Jump to last item */
93
+ // i = l - 1;
94
+ // _curEntity = cached._curEntity;
95
+ // _curAlias = cached._curAlias;
96
+ // currentOp = cached.currentOp;
97
+ // }
98
98
  for (i; i < l; i++) {
99
99
  pt = itemPath[i];
100
100
  const col = entity_metadata_js_1.EntityMetadata.getField(_curEntity, pt);
@@ -151,14 +151,14 @@ async function prepareFilter(entityDef, filter, trgOp, tableAlias = 'T') {
151
151
  _curAlias = joinAlias;
152
152
  node = node.next;
153
153
  }
154
- /** If next path is the last one */
155
- if (i === l - 2) {
156
- associationPathCache[parentPath] = {
157
- _curEntity,
158
- _curAlias,
159
- currentOp,
160
- };
161
- }
154
+ // /** If next path is the last one */
155
+ // if (i === l - 2) {
156
+ // associationPathCache[parentPath] = {
157
+ // _curEntity,
158
+ // _curAlias,
159
+ // currentOp,
160
+ // };
161
+ // }
162
162
  }
163
163
  }
164
164
  continue;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Column = Column;
4
+ const builder_1 = require("@sqb/builder");
4
5
  const entity_metadata_js_1 = require("../model/entity-metadata.js");
5
6
  const orm_const_js_1 = require("../orm.const.js");
6
7
  function Column(arg0) {
@@ -21,6 +22,9 @@ Column[orm_const_js_1.DECORATOR_FACTORY] = function (arg0) {
21
22
  else
22
23
  options.type = typ;
23
24
  }
25
+ if (!options.dataType && typeof options.type === 'function' && entity_metadata_js_1.EntityMetadata.get(options.type)) {
26
+ options.dataType = builder_1.DataType.JSON;
27
+ }
24
28
  entity_metadata_js_1.EntityMetadata.defineColumnField(entity, propertyKey, options);
25
29
  };
26
30
  };
@@ -56,7 +56,7 @@ export async function prepareFilter(entityDef, filter, trgOp, tableAlias = 'T')
56
56
  else
57
57
  srcOp.add(filter);
58
58
  }
59
- const associationPathCache = {};
59
+ // const associationPathCache: Record<string, any> = {};
60
60
  for (const item of srcOp._items) {
61
61
  if (isLogicalOperator(item)) {
62
62
  const ctor = Object.getPrototypeOf(item).constructor;
@@ -77,18 +77,18 @@ export async function prepareFilter(entityDef, filter, trgOp, tableAlias = 'T')
77
77
  let subSelect;
78
78
  let currentOp = trgOp;
79
79
  let i = 0;
80
- const parentPath = itemPath
81
- .slice(0, l - 2)
82
- .join('.')
83
- .toLowerCase();
84
- const cached = associationPathCache[parentPath];
85
- if (cached) {
86
- /** Jump to last item */
87
- i = l - 1;
88
- _curEntity = cached._curEntity;
89
- _curAlias = cached._curAlias;
90
- currentOp = cached.currentOp;
91
- }
80
+ // const parentPath = itemPath
81
+ // .slice(0, l - 2)
82
+ // .join('.')
83
+ // .toLowerCase();
84
+ // const cached = associationPathCache[parentPath];
85
+ // if (cached) {
86
+ // /** Jump to last item */
87
+ // i = l - 1;
88
+ // _curEntity = cached._curEntity;
89
+ // _curAlias = cached._curAlias;
90
+ // currentOp = cached.currentOp;
91
+ // }
92
92
  for (i; i < l; i++) {
93
93
  pt = itemPath[i];
94
94
  const col = EntityMetadata.getField(_curEntity, pt);
@@ -145,14 +145,14 @@ export async function prepareFilter(entityDef, filter, trgOp, tableAlias = 'T')
145
145
  _curAlias = joinAlias;
146
146
  node = node.next;
147
147
  }
148
- /** If next path is the last one */
149
- if (i === l - 2) {
150
- associationPathCache[parentPath] = {
151
- _curEntity,
152
- _curAlias,
153
- currentOp,
154
- };
155
- }
148
+ // /** If next path is the last one */
149
+ // if (i === l - 2) {
150
+ // associationPathCache[parentPath] = {
151
+ // _curEntity,
152
+ // _curAlias,
153
+ // currentOp,
154
+ // };
155
+ // }
156
156
  }
157
157
  }
158
158
  continue;
@@ -1,3 +1,4 @@
1
+ import { DataType } from '@sqb/builder';
1
2
  import { EntityMetadata } from '../model/entity-metadata.js';
2
3
  import { DECORATOR_FACTORY } from '../orm.const.js';
3
4
  export function Column(arg0) {
@@ -18,6 +19,9 @@ Column[DECORATOR_FACTORY] = function (arg0) {
18
19
  else
19
20
  options.type = typ;
20
21
  }
22
+ if (!options.dataType && typeof options.type === 'function' && EntityMetadata.get(options.type)) {
23
+ options.dataType = DataType.JSON;
24
+ }
21
25
  EntityMetadata.defineColumnField(entity, propertyKey, options);
22
26
  };
23
27
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sqb/connect",
3
3
  "description": "Multi-dialect database connection framework written with TypeScript",
4
- "version": "4.18.0",
4
+ "version": "4.19.1",
5
5
  "author": "Panates",
6
6
  "license": "Apache-2.0",
7
7
  "dependencies": {
@@ -16,11 +16,11 @@
16
16
  "putil-promisify": "^1.10.1",
17
17
  "putil-varhelpers": "^1.6.5",
18
18
  "strict-typed-events": "^2.8.0",
19
- "ts-gems": "^3.5.0",
19
+ "ts-gems": "^3.5.1",
20
20
  "tslib": "^2.7.0"
21
21
  },
22
22
  "peerDependencies": {
23
- "@sqb/builder": "^4.18.0",
23
+ "@sqb/builder": "^4.19.1",
24
24
  "reflect-metadata": "^0.2.2"
25
25
  },
26
26
  "type": "module",