@graffy/pg 0.15.20 → 0.15.21-alpha.3
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/Readme.md +1 -1
- package/index.cjs +4 -4
- package/index.mjs +4 -4
- package/package.json +2 -2
package/Readme.md
CHANGED
|
@@ -102,7 +102,7 @@ Every tag must be one of *foo*, *bar* or *baz*.
|
|
|
102
102
|
|
|
103
103
|
### Order by
|
|
104
104
|
|
|
105
|
-
The root of the Graffy filter object must be an object. (Use `$or` if required.) The property `$order` specifies the order. Its value must be an array of order specifiers, each of which may be a string property name
|
|
105
|
+
The root of the Graffy filter object must be an object. (Use `$or` if required.) The property `$order` specifies the order. Its value must be an array of order specifiers, each of which may be a string property name. The order is ascending by default; property names may be prefixed with `!` to switch to descending.
|
|
106
106
|
|
|
107
107
|
### Full Text Search
|
|
108
108
|
|
package/index.cjs
CHANGED
|
@@ -359,16 +359,16 @@ function getArgSql(_a, options) {
|
|
|
359
359
|
if (common.isEmpty(rest)) {
|
|
360
360
|
throw Error("pg_arg.pagination_only_unsupported in " + prefix);
|
|
361
361
|
}
|
|
362
|
-
const orderCols = ($order || [idCol]).map(lookup);
|
|
362
|
+
const orderCols = ($order || [idCol]).map((orderItem) => orderItem[0] === "!" ? sql__default["default"]`-(${lookup(orderItem.slice(1))})::float8` : lookup(orderItem));
|
|
363
363
|
Object.entries({ $after, $before, $since, $until }).forEach(([name, value]) => {
|
|
364
364
|
if (value)
|
|
365
365
|
where.push(getBoundCond(orderCols, value, name));
|
|
366
366
|
});
|
|
367
|
-
const
|
|
368
|
-
const
|
|
367
|
+
const orderKey = $order && getJsonBuildTrusted({ $order: sql__default["default"]`${JSON.stringify($order)}::jsonb` });
|
|
368
|
+
const cursorKey = getJsonBuildTrusted({
|
|
369
369
|
$cursor: sql__default["default"]`jsonb_build_array(${sql.join(groupCols || orderCols)})`
|
|
370
370
|
});
|
|
371
|
-
key = sql__default["default"]`(${sql.join([key,
|
|
371
|
+
key = sql__default["default"]`(${sql.join([key, orderKey, cursorKey].filter(Boolean), ` || `)})`;
|
|
372
372
|
return {
|
|
373
373
|
meta: meta(key),
|
|
374
374
|
where,
|
package/index.mjs
CHANGED
|
@@ -351,16 +351,16 @@ function getArgSql(_a, options) {
|
|
|
351
351
|
if (isEmpty(rest)) {
|
|
352
352
|
throw Error("pg_arg.pagination_only_unsupported in " + prefix);
|
|
353
353
|
}
|
|
354
|
-
const orderCols = ($order || [idCol]).map(lookup);
|
|
354
|
+
const orderCols = ($order || [idCol]).map((orderItem) => orderItem[0] === "!" ? sql`-(${lookup(orderItem.slice(1))})::float8` : lookup(orderItem));
|
|
355
355
|
Object.entries({ $after, $before, $since, $until }).forEach(([name, value]) => {
|
|
356
356
|
if (value)
|
|
357
357
|
where.push(getBoundCond(orderCols, value, name));
|
|
358
358
|
});
|
|
359
|
-
const
|
|
360
|
-
const
|
|
359
|
+
const orderKey = $order && getJsonBuildTrusted({ $order: sql`${JSON.stringify($order)}::jsonb` });
|
|
360
|
+
const cursorKey = getJsonBuildTrusted({
|
|
361
361
|
$cursor: sql`jsonb_build_array(${join(groupCols || orderCols)})`
|
|
362
362
|
});
|
|
363
|
-
key = sql`(${join([key,
|
|
363
|
+
key = sql`(${join([key, orderKey, cursorKey].filter(Boolean), ` || `)})`;
|
|
364
364
|
return {
|
|
365
365
|
meta: meta(key),
|
|
366
366
|
where,
|
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.15.
|
|
5
|
+
"version": "0.15.21-alpha.3",
|
|
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.15.
|
|
19
|
+
"@graffy/common": "0.15.21-alpha.3",
|
|
20
20
|
"sql-template-tag": "^4.1.0",
|
|
21
21
|
"debug": "^4.3.3"
|
|
22
22
|
},
|