@kubun/db 0.3.3 → 0.3.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.
@@ -199,6 +199,10 @@ export function applyDocumentOrderBy(queryBuilder, orderBy = [], isReverse = fal
199
199
  paths
200
200
  ];
201
201
  }
202
+ const KNOWN_FIELDS = {
203
+ _createdAt: 'created_at',
204
+ _owner: 'owner'
205
+ };
202
206
  function applyOrderByField(query, orderBy, isReverse, path = []) {
203
207
  const entries = Object.entries(orderBy);
204
208
  if (entries.length !== 1) {
@@ -209,6 +213,13 @@ function applyOrderByField(query, orderBy, isReverse, path = []) {
209
213
  ...path,
210
214
  key
211
215
  ];
216
+ const knowField = KNOWN_FIELDS[key];
217
+ if (knowField != null) {
218
+ return [
219
+ query.orderBy(knowField, orderByDirection(value, isReverse)),
220
+ keys
221
+ ];
222
+ }
212
223
  return typeof value === 'string' ? [
213
224
  query.orderBy((eb)=>getKeyPath(eb, keys), orderByDirection(value, isReverse)),
214
225
  keys
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubun/db",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "license": "see LICENSE.md",
5
5
  "keywords": [],
6
6
  "type": "module",
@@ -16,13 +16,13 @@
16
16
  "sideEffects": false,
17
17
  "dependencies": {
18
18
  "@enkaku/codec": "^0.12.0",
19
- "@enkaku/event": "^0.12.0",
20
- "kysely": "^0.28.2"
19
+ "@enkaku/event": "^0.12.1",
20
+ "kysely": "^0.28.5"
21
21
  },
22
22
  "devDependencies": {
23
- "@kubun/id": "^0.3.0",
24
- "@kubun/protocol": "^0.3.4",
25
- "@kubun/db-adapter": "^0.3.2"
23
+ "@kubun/db-adapter": "^0.3.2",
24
+ "@kubun/id": "^0.3.1",
25
+ "@kubun/protocol": "^0.3.6"
26
26
  },
27
27
  "scripts": {
28
28
  "build:clean": "del lib",