tsondb 0.19.1 → 0.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.
@@ -1,4 +1,6 @@
1
+ import { on } from "@elyukai/utils/function";
1
2
  import { Lazy } from "@elyukai/utils/lazy";
3
+ import { compareNumber, reduceCompare } from "@elyukai/utils/ordering";
2
4
  import { isError } from "@elyukai/utils/result";
3
5
  import Debug from "debug";
4
6
  import { mkdir, writeFile } from "node:fs/promises";
@@ -460,7 +462,8 @@ export class TSONDB {
460
462
  if (entity && isEntityDeclWithParentReference(entity)) {
461
463
  return [];
462
464
  }
463
- return instances.map((instance) => {
465
+ return instances
466
+ .map((instance) => {
464
467
  const { name, localeId } = getDisplayNameFromEntityInstance(
465
468
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
466
469
  entity, instance, this.#schema.getEntity.bind(this.#schema), this.getInstanceContainerOfEntityById.bind(this), this.getAllChildInstanceContainersForParent.bind(this), this.#locales);
@@ -481,10 +484,10 @@ export class TSONDB {
481
484
  }),
482
485
  },
483
486
  ];
484
- });
487
+ })
488
+ .filter(instance => instance[1].relevance > 0);
485
489
  })
486
- .toSorted((a, b) => a[1].relevance - b[1].relevance ||
487
- a[1].displayName.localeCompare(b[1].displayName, a[1].displayNameLocaleId));
490
+ .toSorted(reduceCompare(on(item => item[1].relevance, compareNumber), (a, b) => a[1].displayName.localeCompare(b[1].displayName, a[1].displayNameLocaleId)));
488
491
  }
489
492
  /**
490
493
  * Compresses the entire database into a single JSON file at the specified path.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsondb",
3
- "version": "0.19.1",
3
+ "version": "0.19.2",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "Lukas Obermann",