@byline/db-mysql 6.0.1 → 6.0.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.
@@ -1406,10 +1406,18 @@ export class DocumentQueries {
1406
1406
  // `ASC` sorts NULL first by default (the opposite of pg's `NULLS
1407
1407
  // LAST`), so the `(col IS NULL) ASC, col ASC` emulation idiom is
1408
1408
  // required — same idiom as `buildDocumentOrderClause`.
1409
+ //
1410
+ // The trailing tiebreaker follows the sort direction, matching pg (see
1411
+ // the same clause in `db-postgres`). Sort values tie constantly in real
1412
+ // content — every empty row ties with every other, and a checkbox or
1413
+ // select column has only a handful of distinct values — and tied rows
1414
+ // with no secondary key come back in whatever order the plan yields.
1415
+ // Without it, flipping asc/desc returns identical rows for any sparse
1416
+ // or low-cardinality column, and pagination is non-deterministic.
1409
1417
  orderClause =
1410
1418
  sort.direction === 'desc'
1411
- ? sql `_sort._sort_value DESC`
1412
- : sql `(_sort._sort_value IS NULL) ASC, _sort._sort_value ASC`;
1419
+ ? sql `_sort._sort_value DESC, d.created_at DESC, d.document_id DESC`
1420
+ : sql `(_sort._sort_value IS NULL) ASC, _sort._sort_value ASC, d.created_at ASC, d.document_id ASC`;
1413
1421
  }
1414
1422
  else {
1415
1423
  // Unrecognised store type — fall back to document-level sort
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@byline/db-mysql",
3
3
  "private": false,
4
4
  "license": "MPL-2.0",
5
- "version": "6.0.1",
5
+ "version": "6.0.3",
6
6
  "engines": {
7
7
  "node": ">=20.9.0"
8
8
  },
@@ -50,8 +50,8 @@
50
50
  "drizzle-orm": "^0.45.2",
51
51
  "mysql2": "^3.24.4",
52
52
  "uuid": "^14.0.2",
53
- "@byline/admin": "6.0.1",
54
- "@byline/core": "6.0.1"
53
+ "@byline/admin": "6.0.3",
54
+ "@byline/core": "6.0.3"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@biomejs/biome": "2.5.13",
@@ -64,8 +64,8 @@
64
64
  "tsc-alias": "^1.9.4",
65
65
  "typescript": "^7.0.2",
66
66
  "vitest": "^5.0.0",
67
- "@byline/auth": "6.0.1",
68
- "@byline/client": "6.0.1",
67
+ "@byline/auth": "6.0.3",
68
+ "@byline/client": "6.0.3",
69
69
  "@byline/db-conformance": "0.0.10"
70
70
  },
71
71
  "publishConfig": {