@tstdl/base 0.93.26 → 0.93.27

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.
@@ -173,8 +173,10 @@ let EntityRepository = class EntityRepository extends Transactional {
173
173
  .exhaustive()
174
174
  : isSimilar(query, searchExpression);
175
175
  const distanceColumn = distance(query, searchExpression).as(searchDistanceColumn);
176
+ const score = sql `1 - ${distance(query, searchExpression)}`.as(searchScoreColumn);
176
177
  const selection = fromEntries(this.#columnDefinitions.map((column) => [column.name, this.resolveTargetColumn(column)]));
177
178
  selection[searchDistanceColumn] = distanceColumn;
179
+ selection[searchScoreColumn] = score;
178
180
  const whereClause = isDefined(filter)
179
181
  ? and(this.convertQuery(filter), trigramClause)
180
182
  : trigramClause;
@@ -190,7 +192,6 @@ let EntityRepository = class EntityRepository extends Transactional {
190
192
  dbQuery = dbQuery.limit(options.limit);
191
193
  }
192
194
  const orderByExpressions = [];
193
- const score = sql `1 - ${distanceColumn}`;
194
195
  if (isDefined(options.order)) {
195
196
  const order = isFunction(options.order) ? options.order({ score }) : options.order;
196
197
  orderByExpressions.push(...this.convertOrderBy(order));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tstdl/base",
3
- "version": "0.93.26",
3
+ "version": "0.93.27",
4
4
  "author": "Patrick Hein",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,5 +1,5 @@
1
1
  {
2
- "id": "e703ecc5-9f40-4ecb-848d-c1f3663d484c",
2
+ "id": "cfbaaee3-4960-412e-83b7-0f58ea61969d",
3
3
  "prevId": "00000000-0000-0000-0000-000000000000",
4
4
  "version": "7",
5
5
  "dialect": "postgresql",
@@ -5,8 +5,8 @@
5
5
  {
6
6
  "idx": 0,
7
7
  "version": "7",
8
- "when": 1761843226770,
9
- "tag": "0000_nervous_iron_monger",
8
+ "when": 1761929933695,
9
+ "tag": "0000_sturdy_patch",
10
10
  "breakpoints": true
11
11
  }
12
12
  ]
package/test1.js CHANGED
@@ -1,9 +1,8 @@
1
1
  import './polyfills.js';
2
2
  import { Application, provideInitializer, provideModule, provideSignalHandler } from './application/index.js';
3
3
  import { migrateAuditSchema } from './audit/index.js';
4
- import { AuthenticationService } from './authentication/server/authentication.service.js';
5
4
  import { configureAuthenticationServer } from './authentication/server/module.js';
6
- import { inject, injectAsync, Injector, runInInjectionContext } from './injector/index.js';
5
+ import { inject, Injector, runInInjectionContext } from './injector/index.js';
7
6
  import { configurePostgresKeyValueStore, migratePostgresKeyValueStoreSchema } from './key-value-store/postgres/module.js';
8
7
  import { configurePostgresLock, migratePostgresLockSchema } from './lock/postgres/index.js';
9
8
  import { PrettyPrintLogFormatter, provideConsoleLogTransport } from './logger/index.js';
@@ -51,16 +50,19 @@ async function bootstrap() {
51
50
  }
52
51
  async function main(_cancellationSignal) {
53
52
  const repository = injectRepository(Test);
54
- const authService = await injectAsync(AuthenticationService);
55
53
  if (await repository.count() == 0) {
56
54
  await repository.insertMany(testData);
57
55
  }
58
56
  const result = await repository.search({
59
57
  query: {
60
- $parade: {
61
- all: null,
58
+ $trigram: {
59
+ fields: ['title'],
60
+ query: 'lorem ipsum dolor sit amet',
62
61
  },
63
62
  },
63
+ distinct: ['title'],
64
+ order: (x) => ['title', x.score],
65
+ limit: 10,
64
66
  });
65
67
  console.log(result);
66
68
  }