@mastra/libsql 1.24.0-alpha.1 → 1.24.0-alpha.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.
@@ -3,7 +3,7 @@ name: mastra-libsql
3
3
  description: Documentation for @mastra/libsql. Use when working with @mastra/libsql APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/libsql"
6
- version: "1.24.0-alpha.1"
6
+ version: "1.24.0-alpha.2"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.24.0-alpha.1",
2
+ "version": "1.24.0-alpha.2",
3
3
  "package": "@mastra/libsql",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -120,12 +120,14 @@ The function can be asynchronous. For decisions that depend on the tool name and
120
120
 
121
121
  ```typescript
122
122
  import { Classifier } from '@mastra/core/classifier'
123
- import { model } from '../models/evaluation-model'
123
+ import { createTypeSafeAi } from '@ai-sdk/typesafe-ai'
124
124
  import { agent } from './agent'
125
125
 
126
126
  const approvalClassifier = new Classifier({
127
127
  id: 'tool-approval-classifier',
128
- model,
128
+ model: createTypeSafeAi({ apiKey: process.env.TYPESAFE_AI_API_KEY }).evaluationModel(
129
+ 'jev-latest',
130
+ ),
129
131
  questions: {
130
132
  requiresApproval: {
131
133
  type: 'boolean',
package/dist/index.cjs CHANGED
@@ -424,9 +424,14 @@ function handleLogicalOperator(key, value, parentPath) {
424
424
  }
425
425
  const values = [];
426
426
  const joinOperator = key === "$or" || key === "$nor" ? "OR" : "AND";
427
- const joined = (Array.isArray(value) ? value.map((f) => {
428
- return (!!f ? Object.entries(f) : []).map(([k, v]) => buildCondition$1(k, v, key));
429
- }) : [buildCondition$1(key, value, parentPath)]).flat().map((c) => {
427
+ const joined = (Array.isArray(value) ? value.flatMap((f) => {
428
+ const branch = (!!f ? Object.entries(f) : []).map(([k, v]) => buildCondition$1(k, v, key));
429
+ if (branch.length <= 1) return branch;
430
+ return [{
431
+ sql: `(${branch.map((c) => c.sql).join(" AND ")})`,
432
+ values: branch.flatMap((c) => c.values)
433
+ }];
434
+ }) : [buildCondition$1(key, value, parentPath)]).map((c) => {
430
435
  values.push(...c.values);
431
436
  return c.sql;
432
437
  }).join(` ${joinOperator} `);