@sqb/postgres-dialect 4.19.0 → 4.19.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.
@@ -37,13 +37,18 @@ class PostgresSerializer {
37
37
  if ((o.right.expression && o.right?.expression === 'null') ||
38
38
  (o.right.value == null && (!o.right.expression || o.right.expression.startsWith('$')))) {
39
39
  if (o.right.expression?.startsWith('$')) {
40
- const s = o.right.expression.substring(1);
41
- if (ctx.params)
42
- delete ctx.params[s];
43
- if (ctx.preparedParams)
44
- delete ctx.preparedParams[s];
45
- if (ctx.paramOptions)
46
- delete ctx.paramOptions[s];
40
+ const i = parseInt(o.right.expression.substring(1), 10);
41
+ if (i > 0) {
42
+ const _ctx = ctx;
43
+ _ctx.removedParams = _ctx.removedParams || [];
44
+ if (!_ctx.removedParams.includes(i)) {
45
+ _ctx.removedParams.push(i);
46
+ if (Array.isArray(ctx.preparedParams))
47
+ ctx.preparedParams.splice(i - 1, 1);
48
+ if (Array.isArray(ctx.paramOptions))
49
+ ctx.paramOptions.splice(i - 1, 1);
50
+ }
51
+ }
47
52
  o.right.expression = 'null';
48
53
  o.right.isParam = false;
49
54
  }
@@ -34,13 +34,18 @@ export class PostgresSerializer {
34
34
  if ((o.right.expression && o.right?.expression === 'null') ||
35
35
  (o.right.value == null && (!o.right.expression || o.right.expression.startsWith('$')))) {
36
36
  if (o.right.expression?.startsWith('$')) {
37
- const s = o.right.expression.substring(1);
38
- if (ctx.params)
39
- delete ctx.params[s];
40
- if (ctx.preparedParams)
41
- delete ctx.preparedParams[s];
42
- if (ctx.paramOptions)
43
- delete ctx.paramOptions[s];
37
+ const i = parseInt(o.right.expression.substring(1), 10);
38
+ if (i > 0) {
39
+ const _ctx = ctx;
40
+ _ctx.removedParams = _ctx.removedParams || [];
41
+ if (!_ctx.removedParams.includes(i)) {
42
+ _ctx.removedParams.push(i);
43
+ if (Array.isArray(ctx.preparedParams))
44
+ ctx.preparedParams.splice(i - 1, 1);
45
+ if (Array.isArray(ctx.paramOptions))
46
+ ctx.paramOptions.splice(i - 1, 1);
47
+ }
48
+ }
44
49
  o.right.expression = 'null';
45
50
  o.right.isParam = false;
46
51
  }
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@sqb/postgres-dialect",
3
3
  "description": "SQB serialization extension for PostgreSQL database",
4
- "version": "4.19.0",
4
+ "version": "4.19.2",
5
5
  "author": "Panates",
6
6
  "license": "Apache-2.0",
7
7
  "dependencies": {
8
8
  "tslib": "^2.7.0"
9
9
  },
10
10
  "peerDependencies": {
11
- "@sqb/builder": "^4.19.0"
11
+ "@sqb/builder": "^4.19.2"
12
12
  },
13
13
  "type": "module",
14
14
  "exports": {