@graffy/pg 0.16.4 → 0.16.5
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.
- package/index.cjs +10 -24
- package/index.mjs +10 -24
- package/package.json +2 -2
package/index.cjs
CHANGED
|
@@ -491,32 +491,18 @@ function getArgSql({ $first, $last, $after, $before, $since, $until, $all, $curs
|
|
|
491
491
|
};
|
|
492
492
|
}
|
|
493
493
|
function getBoundCond(orderCols, bound, kind) {
|
|
494
|
-
if (!Array.isArray(bound)) {
|
|
494
|
+
if (!Array.isArray(bound) || orderCols.length === 0 || bound.length === 0) {
|
|
495
495
|
throw Error(`pg_arg.bad_query bound : ${JSON.stringify(bound)}`);
|
|
496
496
|
}
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
case "$until":
|
|
507
|
-
return sql`${lhs} < ${rhs} OR ${lhs} = ${rhs} AND (${subCond})`;
|
|
508
|
-
}
|
|
509
|
-
} else {
|
|
510
|
-
switch (kind) {
|
|
511
|
-
case "$after":
|
|
512
|
-
return sql`${lhs} > ${rhs}`;
|
|
513
|
-
case "$since":
|
|
514
|
-
return sql`${lhs} >= ${rhs}`;
|
|
515
|
-
case "$before":
|
|
516
|
-
return sql`${lhs} < ${rhs}`;
|
|
517
|
-
case "$until":
|
|
518
|
-
return sql`${lhs} <= ${rhs}`;
|
|
519
|
-
}
|
|
497
|
+
switch (kind) {
|
|
498
|
+
case "$after":
|
|
499
|
+
return sql`(${join(orderCols, ",")}) > (${join(bound, ",")}})`;
|
|
500
|
+
case "$since":
|
|
501
|
+
return sql`(${join(orderCols, ",")}) >= (${join(bound, ",")})`;
|
|
502
|
+
case "$before":
|
|
503
|
+
return sql`(${join(orderCols, ",")}) < (${join(bound, ",")})`;
|
|
504
|
+
case "$until":
|
|
505
|
+
return sql`(${join(orderCols, ",")}) <= (${join(bound, ",")})`;
|
|
520
506
|
}
|
|
521
507
|
}
|
|
522
508
|
const MAX_LIMIT = 4096;
|
package/index.mjs
CHANGED
|
@@ -489,32 +489,18 @@ function getArgSql({ $first, $last, $after, $before, $since, $until, $all, $curs
|
|
|
489
489
|
};
|
|
490
490
|
}
|
|
491
491
|
function getBoundCond(orderCols, bound, kind) {
|
|
492
|
-
if (!Array.isArray(bound)) {
|
|
492
|
+
if (!Array.isArray(bound) || orderCols.length === 0 || bound.length === 0) {
|
|
493
493
|
throw Error(`pg_arg.bad_query bound : ${JSON.stringify(bound)}`);
|
|
494
494
|
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
case "$until":
|
|
505
|
-
return sql`${lhs} < ${rhs} OR ${lhs} = ${rhs} AND (${subCond})`;
|
|
506
|
-
}
|
|
507
|
-
} else {
|
|
508
|
-
switch (kind) {
|
|
509
|
-
case "$after":
|
|
510
|
-
return sql`${lhs} > ${rhs}`;
|
|
511
|
-
case "$since":
|
|
512
|
-
return sql`${lhs} >= ${rhs}`;
|
|
513
|
-
case "$before":
|
|
514
|
-
return sql`${lhs} < ${rhs}`;
|
|
515
|
-
case "$until":
|
|
516
|
-
return sql`${lhs} <= ${rhs}`;
|
|
517
|
-
}
|
|
495
|
+
switch (kind) {
|
|
496
|
+
case "$after":
|
|
497
|
+
return sql`(${join(orderCols, ",")}) > (${join(bound, ",")}})`;
|
|
498
|
+
case "$since":
|
|
499
|
+
return sql`(${join(orderCols, ",")}) >= (${join(bound, ",")})`;
|
|
500
|
+
case "$before":
|
|
501
|
+
return sql`(${join(orderCols, ",")}) < (${join(bound, ",")})`;
|
|
502
|
+
case "$until":
|
|
503
|
+
return sql`(${join(orderCols, ",")}) <= (${join(bound, ",")})`;
|
|
518
504
|
}
|
|
519
505
|
}
|
|
520
506
|
const MAX_LIMIT = 4096;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graffy/pg",
|
|
3
3
|
"description": "The standard Postgres module for Graffy. Each instance this module mounts a Postgres table as a Graffy subtree.",
|
|
4
4
|
"author": "aravind (https://github.com/aravindet)",
|
|
5
|
-
"version": "0.16.
|
|
5
|
+
"version": "0.16.5",
|
|
6
6
|
"main": "./index.cjs",
|
|
7
7
|
"exports": {
|
|
8
8
|
"import": "./index.mjs",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"license": "Apache-2.0",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@graffy/common": "0.16.
|
|
19
|
+
"@graffy/common": "0.16.5",
|
|
20
20
|
"debug": "^4.3.3"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|