@koolbase/core 12.32.0 → 12.33.0

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,3 +1,4 @@
1
+ import type { KbWhereNode } from './query-builder.js';
1
2
  import { KoolbaseAggregateRequest, KoolbaseAggregateResult } from './aggregate.js';
2
3
  import { KoolbaseConflict } from './conflict.js';
3
4
  import { PendingWrite } from './pending-write.js';
@@ -376,6 +377,11 @@ export declare class KoolbaseDatabase {
376
377
  where?: Record<string, unknown>;
377
378
  mode?: SearchMode;
378
379
  minSimilarity?: number;
380
+ /** The typed filter (#165, #173): the tree list queries take, applied
381
+ * inside the collection's read rule in every mode. Not with `where`. */
382
+ filter?: KbWhereNode;
383
+ /** The IANA zone the filter's days are read in; the device's if unset. */
384
+ timezone?: string;
379
385
  }): Promise<SemanticSearchResult>;
380
386
  syncPendingWrites(): Promise<void>;
381
387
  }
@@ -1061,6 +1061,9 @@ class KoolbaseDatabase {
1061
1061
  * server on lexical mode.
1062
1062
  */
1063
1063
  async searchSemantic(opts) {
1064
+ if (opts.filter && opts.where && Object.keys(opts.where).length > 0) {
1065
+ throw new TypeError('searchSemantic: provide filter or where, not both.');
1066
+ }
1064
1067
  const hasVector = Array.isArray(opts.queryVector) && opts.queryVector.length > 0;
1065
1068
  const hasText = typeof opts.queryText === 'string' && opts.queryText.trim().length > 0;
1066
1069
  if (!hasVector && !hasText) {
@@ -1093,6 +1096,12 @@ class KoolbaseDatabase {
1093
1096
  if (opts.minSimilarity !== undefined) {
1094
1097
  body.min_similarity = opts.minSimilarity;
1095
1098
  }
1099
+ if (opts.filter) {
1100
+ body.filter = opts.filter;
1101
+ const zone = opts.timezone ?? (0, query_builder_js_1.deviceZone)();
1102
+ if (zone)
1103
+ body.timezone = zone;
1104
+ }
1096
1105
  const raw = await this.request('POST', '/v1/sdk/db/search-semantic', body);
1097
1106
  // A hit carries the complete public record, not a projection, so these are
1098
1107
  // safe to cache as baselines. A trimmed record would be worse than none: an
@@ -1,3 +1,4 @@
1
+ import type { KbWhereNode } from './query-builder.js';
1
2
  import { KoolbaseAggregateRequest, KoolbaseAggregateResult } from './aggregate.js';
2
3
  import { KoolbaseConflict } from './conflict.js';
3
4
  import { PendingWrite } from './pending-write.js';
@@ -376,6 +377,11 @@ export declare class KoolbaseDatabase {
376
377
  where?: Record<string, unknown>;
377
378
  mode?: SearchMode;
378
379
  minSimilarity?: number;
380
+ /** The typed filter (#165, #173): the tree list queries take, applied
381
+ * inside the collection's read rule in every mode. Not with `where`. */
382
+ filter?: KbWhereNode;
383
+ /** The IANA zone the filter's days are read in; the device's if unset. */
384
+ timezone?: string;
379
385
  }): Promise<SemanticSearchResult>;
380
386
  syncPendingWrites(): Promise<void>;
381
387
  }
@@ -1058,6 +1058,9 @@ export class KoolbaseDatabase {
1058
1058
  * server on lexical mode.
1059
1059
  */
1060
1060
  async searchSemantic(opts) {
1061
+ if (opts.filter && opts.where && Object.keys(opts.where).length > 0) {
1062
+ throw new TypeError('searchSemantic: provide filter or where, not both.');
1063
+ }
1061
1064
  const hasVector = Array.isArray(opts.queryVector) && opts.queryVector.length > 0;
1062
1065
  const hasText = typeof opts.queryText === 'string' && opts.queryText.trim().length > 0;
1063
1066
  if (!hasVector && !hasText) {
@@ -1090,6 +1093,12 @@ export class KoolbaseDatabase {
1090
1093
  if (opts.minSimilarity !== undefined) {
1091
1094
  body.min_similarity = opts.minSimilarity;
1092
1095
  }
1096
+ if (opts.filter) {
1097
+ body.filter = opts.filter;
1098
+ const zone = opts.timezone ?? deviceZone();
1099
+ if (zone)
1100
+ body.timezone = zone;
1101
+ }
1093
1102
  const raw = await this.request('POST', '/v1/sdk/db/search-semantic', body);
1094
1103
  // A hit carries the complete public record, not a projection, so these are
1095
1104
  // safe to cache as baselines. A trimmed record would be worse than none: an
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koolbase/core",
3
- "version": "12.32.0",
3
+ "version": "12.33.0",
4
4
  "description": "Koolbase SDK core \u2014 shared behaviour behind @koolbase/react-native and @koolbase/js. Install one of those, not this.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "types": "./dist/esm/index.d.ts",