@mastra/core 0.9.4 → 0.10.0-alpha.1
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.
- package/README.md +3 -2
- package/dist/agent/index.cjs +2 -2
- package/dist/agent/index.d.cts +13 -14
- package/dist/agent/index.d.ts +13 -14
- package/dist/agent/index.js +1 -1
- package/dist/{base-BCfssGt6.d.ts → base-DttB7sJD.d.ts} +1187 -886
- package/dist/{base-CAEcd6q2.d.cts → base-aJ3etsh5.d.cts} +1187 -886
- package/dist/{base-H7siSAfu.d.cts → base-aPYtPBT2.d.cts} +3 -3
- package/dist/{base-4Z34GQL8.d.ts → base-tc5kgDTD.d.ts} +3 -3
- package/dist/base.cjs +2 -2
- package/dist/base.d.cts +2 -3
- package/dist/base.d.ts +2 -3
- package/dist/base.js +1 -1
- package/dist/bundler/index.cjs +2 -2
- package/dist/bundler/index.d.cts +2 -3
- package/dist/bundler/index.d.ts +2 -3
- package/dist/bundler/index.js +1 -1
- package/dist/{chunk-W4BSLENO.js → chunk-2NTUAUGH.js} +1 -1
- package/dist/{chunk-S34QVMKE.js → chunk-2PW6UJMW.js} +77 -10
- package/dist/{chunk-WE36CRQV.cjs → chunk-2U7ZZUFO.cjs} +2 -2
- package/dist/{workflows/vNext/index.js → chunk-3SQ3G2EJ.js} +19 -16
- package/dist/chunk-5HULBQ2W.cjs +38 -0
- package/dist/{chunk-XRGDVLM4.cjs → chunk-5JRD3NDP.cjs} +15 -15
- package/dist/{chunk-GXKODTLA.cjs → chunk-5W2G7S44.cjs} +83 -68
- package/dist/chunk-75Z4BZEE.js +36 -0
- package/dist/{chunk-66GQROSI.cjs → chunk-AOGUTJUO.cjs} +58 -51
- package/dist/{chunk-WIKOYZ63.js → chunk-BPTSLJHA.js} +9 -9
- package/dist/{chunk-JBJ7KXN5.js → chunk-C3ICEF6E.js} +1 -1
- package/dist/{chunk-E4FAXBUV.cjs → chunk-CWSFP2HS.cjs} +2 -2
- package/dist/{chunk-FW5RS6WV.js → chunk-E7CLY6SK.js} +42 -35
- package/dist/{chunk-235X76GC.js → chunk-FI7R232B.js} +2 -2
- package/dist/chunk-GQ2XQ4UN.js +321 -0
- package/dist/{chunk-H4CEZSRM.js → chunk-J7GDGV6F.js} +1 -1
- package/dist/{chunk-NLBJOFNG.js → chunk-JW5TMK2L.js} +1 -1
- package/dist/{chunk-NOPY74PV.js → chunk-KJQFFEEQ.js} +1 -1
- package/dist/{chunk-V2Q2FEVO.cjs → chunk-KSPHQSZX.cjs} +2 -2
- package/dist/{chunk-NZV4OA6P.js → chunk-LHRZV5VG.js} +2 -23
- package/dist/chunk-NMDM4IZN.cjs +78 -0
- package/dist/chunk-OBEALYTK.js +74 -0
- package/dist/{chunk-PEK4TY3P.js → chunk-OCT2762Q.js} +1 -1
- package/dist/{chunk-5DUFC7TV.cjs → chunk-P7BGXOQV.cjs} +2 -2
- package/dist/{chunk-WQKOM7XM.cjs → chunk-PIZM25KI.cjs} +3 -24
- package/dist/{chunk-S7J63JOG.cjs → chunk-RVS6OUJN.cjs} +2 -2
- package/dist/{chunk-5JUWUTPJ.cjs → chunk-SKG2NIZW.cjs} +2 -2
- package/dist/chunk-SWW4EBUZ.cjs +96 -0
- package/dist/{chunk-RGE4UF6A.cjs → chunk-TMPFLJLG.cjs} +2 -2
- package/dist/{workflows/vNext/index.cjs → chunk-TTKQ37ZZ.cjs} +24 -21
- package/dist/{chunk-EJITEVAB.cjs → chunk-U3L3NEOM.cjs} +81 -10
- package/dist/chunk-VHLL4AZK.js +90 -0
- package/dist/{chunk-EG74VBSP.cjs → chunk-YEULQPUY.cjs} +6 -6
- package/dist/{chunk-SOLXHDNQ.js → chunk-ZB3LEHL2.js} +81 -66
- package/dist/{chunk-TAFOICHR.js → chunk-ZKN6HYYQ.js} +1 -1
- package/dist/chunk-ZZDAC5KD.cjs +325 -0
- package/dist/deployer/index.cjs +2 -2
- package/dist/deployer/index.d.cts +2 -3
- package/dist/deployer/index.d.ts +2 -3
- package/dist/deployer/index.js +1 -1
- package/dist/eval/index.d.cts +13 -14
- package/dist/eval/index.d.ts +13 -14
- package/dist/hooks/index.d.cts +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/index.cjs +88 -159
- package/dist/index.d.cts +17 -25
- package/dist/index.d.ts +17 -25
- package/dist/index.js +18 -25
- package/dist/integration/index.cjs +3 -3
- package/dist/integration/index.d.cts +12 -13
- package/dist/integration/index.d.ts +12 -13
- package/dist/integration/index.js +1 -1
- package/dist/llm/index.d.cts +13 -14
- package/dist/llm/index.d.ts +13 -14
- package/dist/logger/index.cjs +18 -17
- package/dist/logger/index.d.cts +42 -2
- package/dist/logger/index.d.ts +42 -2
- package/dist/logger/index.js +2 -1
- package/dist/{index-QV27jkxQ.d.ts → logger-EhZkzZOr.d.cts} +38 -52
- package/dist/{index-QV27jkxQ.d.cts → logger-EhZkzZOr.d.ts} +38 -52
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.d.cts +11 -12
- package/dist/mastra/index.d.ts +11 -12
- package/dist/mastra/index.js +1 -1
- package/dist/mcp/index.cjs +75 -17
- package/dist/mcp/index.d.cts +14 -15
- package/dist/mcp/index.d.ts +14 -15
- package/dist/mcp/index.js +69 -15
- package/dist/memory/index.cjs +4 -4
- package/dist/memory/index.d.cts +12 -13
- package/dist/memory/index.d.ts +12 -13
- package/dist/memory/index.js +1 -1
- package/dist/network/index.cjs +8 -8
- package/dist/network/index.d.cts +12 -13
- package/dist/network/index.d.ts +12 -13
- package/dist/network/index.js +5 -5
- package/dist/relevance/index.cjs +4 -4
- package/dist/relevance/index.d.cts +15 -16
- package/dist/relevance/index.d.ts +15 -16
- package/dist/relevance/index.js +1 -1
- package/dist/server/index.cjs +4 -0
- package/dist/server/index.d.cts +13 -12
- package/dist/server/index.d.ts +13 -12
- package/dist/server/index.js +4 -1
- package/dist/storage/index.cjs +184 -3
- package/dist/storage/index.d.cts +83 -13
- package/dist/storage/index.d.ts +83 -13
- package/dist/storage/index.js +186 -1
- package/dist/telemetry/index.d.cts +14 -15
- package/dist/telemetry/index.d.ts +14 -15
- package/dist/telemetry/otel-vendor.cjs +2 -2
- package/dist/telemetry/otel-vendor.d.cts +1 -1
- package/dist/telemetry/otel-vendor.d.ts +1 -1
- package/dist/telemetry/otel-vendor.js +1 -1
- package/dist/tools/index.cjs +4 -4
- package/dist/tools/index.d.cts +12 -13
- package/dist/tools/index.d.ts +12 -13
- package/dist/tools/index.js +1 -1
- package/dist/tts/index.cjs +2 -2
- package/dist/tts/index.d.cts +2 -3
- package/dist/tts/index.d.ts +2 -3
- package/dist/tts/index.js +1 -1
- package/dist/{types-BtMyV38I.d.ts → types-Bo1uigWx.d.cts} +1 -1
- package/dist/{types-BtMyV38I.d.cts → types-Bo1uigWx.d.ts} +1 -1
- package/dist/utils.cjs +28 -12
- package/dist/utils.d.cts +59 -16
- package/dist/utils.d.ts +59 -16
- package/dist/utils.js +1 -1
- package/dist/vector/filter/index.cjs +189 -7
- package/dist/vector/filter/index.js +190 -1
- package/dist/vector/index.cjs +2 -2
- package/dist/vector/index.d.cts +28 -20
- package/dist/vector/index.d.ts +28 -20
- package/dist/vector/index.js +1 -1
- package/dist/voice/index.cjs +4 -4
- package/dist/voice/index.d.cts +12 -13
- package/dist/voice/index.d.ts +12 -13
- package/dist/voice/index.js +1 -1
- package/dist/workflows/index.cjs +17 -69
- package/dist/workflows/index.d.cts +197 -77
- package/dist/workflows/index.d.ts +197 -77
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/legacy/index.cjs +90 -0
- package/dist/workflows/legacy/index.d.cts +87 -0
- package/dist/workflows/legacy/index.d.ts +87 -0
- package/dist/workflows/legacy/index.js +1 -0
- package/package.json +19 -40
- package/workflows/legacy.d.ts +1 -0
- package/dist/chunk-4WABQORE.js +0 -781
- package/dist/chunk-CIEPFV6B.js +0 -658
- package/dist/chunk-CMPPXW4U.js +0 -154
- package/dist/chunk-CTKNWYK2.js +0 -131
- package/dist/chunk-LGERQTJM.js +0 -190
- package/dist/chunk-O44MSFMZ.cjs +0 -168
- package/dist/chunk-QDAMIZY3.cjs +0 -783
- package/dist/chunk-QHDPLMHB.cjs +0 -667
- package/dist/chunk-RAQBTCIR.cjs +0 -134
- package/dist/chunk-YK3XJ52U.cjs +0 -192
- package/dist/storage/libsql/index.cjs +0 -581
- package/dist/storage/libsql/index.d.cts +0 -104
- package/dist/storage/libsql/index.d.ts +0 -104
- package/dist/storage/libsql/index.js +0 -578
- package/dist/vector/libsql/index.cjs +0 -14
- package/dist/vector/libsql/index.d.cts +0 -82
- package/dist/vector/libsql/index.d.ts +0 -82
- package/dist/vector/libsql/index.js +0 -1
- package/dist/workflows/vNext/index.d.cts +0 -209
- package/dist/workflows/vNext/index.d.ts +0 -209
- package/storage/libsql.d.ts +0 -1
- package/vector/libsql.d.ts +0 -1
- package/workflows/vNext.d.ts +0 -1
package/dist/utils.d.cts
CHANGED
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { aO as VercelTool, a9 as ToolAction, a as Mastra, bf as MastraPrimitives, ab as MastraMemory, t as ToolsInput, aP as CoreTool, r as Agent, q as LegacyWorkflow, p as LegacyStep, x as StepExecutionContext, s as WorkflowContext, af as Workflow, ae as Step, bg as AgentNetwork, bh as MCPServerBase } from './base-aJ3etsh5.cjs';
|
|
2
2
|
import { LanguageModelV1, CoreMessage, Message } from 'ai';
|
|
3
3
|
import { MastraTTS } from './tts/index.cjs';
|
|
4
4
|
import { MastraVector } from './vector/index.cjs';
|
|
5
|
-
import {
|
|
5
|
+
import { M as Metric } from './types-Bo1uigWx.cjs';
|
|
6
6
|
import { z } from 'zod';
|
|
7
|
-
import {
|
|
8
|
-
import './base-
|
|
7
|
+
import { I as IMastraLogger } from './logger-EhZkzZOr.cjs';
|
|
8
|
+
import './base-aPYtPBT2.cjs';
|
|
9
9
|
import { RuntimeContext } from './runtime-context/index.cjs';
|
|
10
10
|
import 'sift';
|
|
11
11
|
import 'json-schema';
|
|
12
|
-
import '@opentelemetry/api';
|
|
13
|
-
import 'xstate';
|
|
14
|
-
import 'node:events';
|
|
15
|
-
import 'node:http';
|
|
16
|
-
import 'hono';
|
|
17
|
-
import 'events';
|
|
18
12
|
import './deployer/index.cjs';
|
|
19
13
|
import './bundler/index.cjs';
|
|
14
|
+
import '@opentelemetry/api';
|
|
20
15
|
import 'stream';
|
|
21
|
-
import 'pino';
|
|
22
16
|
import '@opentelemetry/sdk-trace-base';
|
|
17
|
+
import 'node:http';
|
|
18
|
+
import 'hono';
|
|
23
19
|
import 'hono/cors';
|
|
24
20
|
import 'hono-openapi';
|
|
21
|
+
import 'xstate';
|
|
22
|
+
import 'node:events';
|
|
23
|
+
import 'events';
|
|
25
24
|
import 'ai/test';
|
|
26
25
|
import './vector/filter/index.cjs';
|
|
27
26
|
|
|
@@ -64,7 +63,7 @@ interface ToolOptions {
|
|
|
64
63
|
runId?: string;
|
|
65
64
|
threadId?: string;
|
|
66
65
|
resourceId?: string;
|
|
67
|
-
logger?:
|
|
66
|
+
logger?: IMastraLogger;
|
|
68
67
|
description?: string;
|
|
69
68
|
mastra?: (Mastra & MastraPrimitives) | MastraPrimitives;
|
|
70
69
|
runtimeContext: RuntimeContext;
|
|
@@ -101,9 +100,53 @@ declare function makeCoreTool(originalTool: ToolToConvert, options: ToolOptions,
|
|
|
101
100
|
*/
|
|
102
101
|
declare function createMastraProxy({ mastra, logger }: {
|
|
103
102
|
mastra: Mastra;
|
|
104
|
-
logger:
|
|
105
|
-
}): Mastra<Record<string, Agent<any, ToolsInput, Record<string, Metric>>>, Record<string,
|
|
106
|
-
declare function checkEvalStorageFields(traceObject: any, logger?:
|
|
103
|
+
logger: IMastraLogger;
|
|
104
|
+
}): Mastra<Record<string, Agent<any, ToolsInput, Record<string, Metric>>>, Record<string, LegacyWorkflow<LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], string, any, any>>, Record<string, Workflow<Step<string, any, any, any, any>[], string, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>>>, Record<string, MastraVector>, Record<string, MastraTTS>, IMastraLogger, Record<string, AgentNetwork>, Record<string, MCPServerBase>>;
|
|
105
|
+
declare function checkEvalStorageFields(traceObject: any, logger?: IMastraLogger): boolean;
|
|
106
|
+
declare function isUiMessage(message: CoreMessage | Message): message is Message;
|
|
107
|
+
declare function isCoreMessage(message: CoreMessage | Message): message is CoreMessage;
|
|
107
108
|
declare function ensureAllMessagesAreCoreMessages(messages: (CoreMessage | Message)[]): CoreMessage[];
|
|
109
|
+
/** Represents a validated SQL identifier (e.g., table or column name). */
|
|
110
|
+
type SqlIdentifier = string & {
|
|
111
|
+
__brand: 'SqlIdentifier';
|
|
112
|
+
};
|
|
113
|
+
/** Represents a validated dot-separated SQL field key. */
|
|
114
|
+
type FieldKey = string & {
|
|
115
|
+
__brand: 'FieldKey';
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Parses and returns a valid SQL identifier (such as a table or column name).
|
|
119
|
+
* The identifier must:
|
|
120
|
+
* - Start with a letter (a-z, A-Z) or underscore (_)
|
|
121
|
+
* - Contain only letters, numbers, or underscores
|
|
122
|
+
* - Be at most 63 characters long
|
|
123
|
+
*
|
|
124
|
+
* @param name - The identifier string to parse.
|
|
125
|
+
* @param kind - Optional label for error messages (e.g., 'table name').
|
|
126
|
+
* @returns The validated identifier as a branded type.
|
|
127
|
+
* @throws {Error} If the identifier does not conform to SQL naming rules.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* const id = parseSqlIdentifier('my_table'); // Ok
|
|
131
|
+
* parseSqlIdentifier('123table'); // Throws error
|
|
132
|
+
*/
|
|
133
|
+
declare function parseSqlIdentifier(name: string, kind?: string): SqlIdentifier;
|
|
134
|
+
/**
|
|
135
|
+
* Parses and returns a valid dot-separated SQL field key (e.g., 'user.profile.name').
|
|
136
|
+
* Each segment must:
|
|
137
|
+
* - Start with a letter (a-z, A-Z) or underscore (_)
|
|
138
|
+
* - Contain only letters, numbers, or underscores
|
|
139
|
+
* - Be at most 63 characters long
|
|
140
|
+
*
|
|
141
|
+
* @param key - The dot-separated field key string to parse.
|
|
142
|
+
* @returns The validated field key as a branded type.
|
|
143
|
+
* @throws {Error} If any segment of the key is invalid.
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* const key = parseFieldKey('user_profile.name'); // Ok
|
|
147
|
+
* parseFieldKey('user..name'); // Throws error
|
|
148
|
+
* parseFieldKey('user.123name'); // Throws error
|
|
149
|
+
*/
|
|
150
|
+
declare function parseFieldKey(key: string): FieldKey;
|
|
108
151
|
|
|
109
|
-
export { type TagMaskOptions, type ToolOptions, checkEvalStorageFields, createMastraProxy, deepMerge, delay, ensureAllMessagesAreCoreMessages, ensureToolProperties, isVercelTool, isZodType, makeCoreTool, maskStreamTags, resolveSerializedZodOutput };
|
|
152
|
+
export { type TagMaskOptions, type ToolOptions, checkEvalStorageFields, createMastraProxy, deepMerge, delay, ensureAllMessagesAreCoreMessages, ensureToolProperties, isCoreMessage, isUiMessage, isVercelTool, isZodType, makeCoreTool, maskStreamTags, parseFieldKey, parseSqlIdentifier, resolveSerializedZodOutput };
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { aO as VercelTool, a9 as ToolAction, a as Mastra, bf as MastraPrimitives, ab as MastraMemory, t as ToolsInput, aP as CoreTool, r as Agent, q as LegacyWorkflow, p as LegacyStep, x as StepExecutionContext, s as WorkflowContext, af as Workflow, ae as Step, bg as AgentNetwork, bh as MCPServerBase } from './base-DttB7sJD.js';
|
|
2
2
|
import { LanguageModelV1, CoreMessage, Message } from 'ai';
|
|
3
3
|
import { MastraTTS } from './tts/index.js';
|
|
4
4
|
import { MastraVector } from './vector/index.js';
|
|
5
|
-
import {
|
|
5
|
+
import { M as Metric } from './types-Bo1uigWx.js';
|
|
6
6
|
import { z } from 'zod';
|
|
7
|
-
import {
|
|
8
|
-
import './base-
|
|
7
|
+
import { I as IMastraLogger } from './logger-EhZkzZOr.js';
|
|
8
|
+
import './base-tc5kgDTD.js';
|
|
9
9
|
import { RuntimeContext } from './runtime-context/index.js';
|
|
10
10
|
import 'sift';
|
|
11
11
|
import 'json-schema';
|
|
12
|
-
import '@opentelemetry/api';
|
|
13
|
-
import 'xstate';
|
|
14
|
-
import 'node:events';
|
|
15
|
-
import 'node:http';
|
|
16
|
-
import 'hono';
|
|
17
|
-
import 'events';
|
|
18
12
|
import './deployer/index.js';
|
|
19
13
|
import './bundler/index.js';
|
|
14
|
+
import '@opentelemetry/api';
|
|
20
15
|
import 'stream';
|
|
21
|
-
import 'pino';
|
|
22
16
|
import '@opentelemetry/sdk-trace-base';
|
|
17
|
+
import 'node:http';
|
|
18
|
+
import 'hono';
|
|
23
19
|
import 'hono/cors';
|
|
24
20
|
import 'hono-openapi';
|
|
21
|
+
import 'xstate';
|
|
22
|
+
import 'node:events';
|
|
23
|
+
import 'events';
|
|
25
24
|
import 'ai/test';
|
|
26
25
|
import './vector/filter/index.js';
|
|
27
26
|
|
|
@@ -64,7 +63,7 @@ interface ToolOptions {
|
|
|
64
63
|
runId?: string;
|
|
65
64
|
threadId?: string;
|
|
66
65
|
resourceId?: string;
|
|
67
|
-
logger?:
|
|
66
|
+
logger?: IMastraLogger;
|
|
68
67
|
description?: string;
|
|
69
68
|
mastra?: (Mastra & MastraPrimitives) | MastraPrimitives;
|
|
70
69
|
runtimeContext: RuntimeContext;
|
|
@@ -101,9 +100,53 @@ declare function makeCoreTool(originalTool: ToolToConvert, options: ToolOptions,
|
|
|
101
100
|
*/
|
|
102
101
|
declare function createMastraProxy({ mastra, logger }: {
|
|
103
102
|
mastra: Mastra;
|
|
104
|
-
logger:
|
|
105
|
-
}): Mastra<Record<string, Agent<any, ToolsInput, Record<string, Metric>>>, Record<string,
|
|
106
|
-
declare function checkEvalStorageFields(traceObject: any, logger?:
|
|
103
|
+
logger: IMastraLogger;
|
|
104
|
+
}): Mastra<Record<string, Agent<any, ToolsInput, Record<string, Metric>>>, Record<string, LegacyWorkflow<LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], string, any, any>>, Record<string, Workflow<Step<string, any, any, any, any>[], string, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>>>, Record<string, MastraVector>, Record<string, MastraTTS>, IMastraLogger, Record<string, AgentNetwork>, Record<string, MCPServerBase>>;
|
|
105
|
+
declare function checkEvalStorageFields(traceObject: any, logger?: IMastraLogger): boolean;
|
|
106
|
+
declare function isUiMessage(message: CoreMessage | Message): message is Message;
|
|
107
|
+
declare function isCoreMessage(message: CoreMessage | Message): message is CoreMessage;
|
|
107
108
|
declare function ensureAllMessagesAreCoreMessages(messages: (CoreMessage | Message)[]): CoreMessage[];
|
|
109
|
+
/** Represents a validated SQL identifier (e.g., table or column name). */
|
|
110
|
+
type SqlIdentifier = string & {
|
|
111
|
+
__brand: 'SqlIdentifier';
|
|
112
|
+
};
|
|
113
|
+
/** Represents a validated dot-separated SQL field key. */
|
|
114
|
+
type FieldKey = string & {
|
|
115
|
+
__brand: 'FieldKey';
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Parses and returns a valid SQL identifier (such as a table or column name).
|
|
119
|
+
* The identifier must:
|
|
120
|
+
* - Start with a letter (a-z, A-Z) or underscore (_)
|
|
121
|
+
* - Contain only letters, numbers, or underscores
|
|
122
|
+
* - Be at most 63 characters long
|
|
123
|
+
*
|
|
124
|
+
* @param name - The identifier string to parse.
|
|
125
|
+
* @param kind - Optional label for error messages (e.g., 'table name').
|
|
126
|
+
* @returns The validated identifier as a branded type.
|
|
127
|
+
* @throws {Error} If the identifier does not conform to SQL naming rules.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* const id = parseSqlIdentifier('my_table'); // Ok
|
|
131
|
+
* parseSqlIdentifier('123table'); // Throws error
|
|
132
|
+
*/
|
|
133
|
+
declare function parseSqlIdentifier(name: string, kind?: string): SqlIdentifier;
|
|
134
|
+
/**
|
|
135
|
+
* Parses and returns a valid dot-separated SQL field key (e.g., 'user.profile.name').
|
|
136
|
+
* Each segment must:
|
|
137
|
+
* - Start with a letter (a-z, A-Z) or underscore (_)
|
|
138
|
+
* - Contain only letters, numbers, or underscores
|
|
139
|
+
* - Be at most 63 characters long
|
|
140
|
+
*
|
|
141
|
+
* @param key - The dot-separated field key string to parse.
|
|
142
|
+
* @returns The validated field key as a branded type.
|
|
143
|
+
* @throws {Error} If any segment of the key is invalid.
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* const key = parseFieldKey('user_profile.name'); // Ok
|
|
147
|
+
* parseFieldKey('user..name'); // Throws error
|
|
148
|
+
* parseFieldKey('user.123name'); // Throws error
|
|
149
|
+
*/
|
|
150
|
+
declare function parseFieldKey(key: string): FieldKey;
|
|
108
151
|
|
|
109
|
-
export { type TagMaskOptions, type ToolOptions, checkEvalStorageFields, createMastraProxy, deepMerge, delay, ensureAllMessagesAreCoreMessages, ensureToolProperties, isVercelTool, isZodType, makeCoreTool, maskStreamTags, resolveSerializedZodOutput };
|
|
152
|
+
export { type TagMaskOptions, type ToolOptions, checkEvalStorageFields, createMastraProxy, deepMerge, delay, ensureAllMessagesAreCoreMessages, ensureToolProperties, isCoreMessage, isUiMessage, isVercelTool, isZodType, makeCoreTool, maskStreamTags, parseFieldKey, parseSqlIdentifier, resolveSerializedZodOutput };
|
package/dist/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { checkEvalStorageFields, createMastraProxy, deepMerge, delay, ensureAllMessagesAreCoreMessages, ensureToolProperties, isVercelTool, isZodType, makeCoreTool, maskStreamTags, resolveSerializedZodOutput } from './chunk-
|
|
1
|
+
export { checkEvalStorageFields, createMastraProxy, deepMerge, delay, ensureAllMessagesAreCoreMessages, ensureToolProperties, isCoreMessage, isUiMessage, isVercelTool, isZodType, makeCoreTool, maskStreamTags, parseFieldKey, parseSqlIdentifier, resolveSerializedZodOutput } from './chunk-2PW6UJMW.js';
|
|
@@ -1,10 +1,192 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/vector/filter/base.ts
|
|
4
|
+
var BaseFilterTranslator = class _BaseFilterTranslator {
|
|
5
|
+
/**
|
|
6
|
+
* Operator type checks
|
|
7
|
+
*/
|
|
8
|
+
isOperator(key) {
|
|
9
|
+
return key.startsWith("$");
|
|
10
|
+
}
|
|
11
|
+
static BASIC_OPERATORS = ["$eq", "$ne"];
|
|
12
|
+
static NUMERIC_OPERATORS = ["$gt", "$gte", "$lt", "$lte"];
|
|
13
|
+
static ARRAY_OPERATORS = ["$in", "$nin", "$all", "$elemMatch"];
|
|
14
|
+
static LOGICAL_OPERATORS = ["$and", "$or", "$not", "$nor"];
|
|
15
|
+
static ELEMENT_OPERATORS = ["$exists"];
|
|
16
|
+
static REGEX_OPERATORS = ["$regex", "$options"];
|
|
17
|
+
static DEFAULT_OPERATORS = {
|
|
18
|
+
logical: _BaseFilterTranslator.LOGICAL_OPERATORS,
|
|
19
|
+
basic: _BaseFilterTranslator.BASIC_OPERATORS,
|
|
20
|
+
numeric: _BaseFilterTranslator.NUMERIC_OPERATORS,
|
|
21
|
+
array: _BaseFilterTranslator.ARRAY_OPERATORS,
|
|
22
|
+
element: _BaseFilterTranslator.ELEMENT_OPERATORS,
|
|
23
|
+
regex: _BaseFilterTranslator.REGEX_OPERATORS
|
|
24
|
+
};
|
|
25
|
+
isLogicalOperator(key) {
|
|
26
|
+
return _BaseFilterTranslator.DEFAULT_OPERATORS.logical.includes(key);
|
|
27
|
+
}
|
|
28
|
+
isBasicOperator(key) {
|
|
29
|
+
return _BaseFilterTranslator.DEFAULT_OPERATORS.basic.includes(key);
|
|
30
|
+
}
|
|
31
|
+
isNumericOperator(key) {
|
|
32
|
+
return _BaseFilterTranslator.DEFAULT_OPERATORS.numeric.includes(key);
|
|
33
|
+
}
|
|
34
|
+
isArrayOperator(key) {
|
|
35
|
+
return _BaseFilterTranslator.DEFAULT_OPERATORS.array.includes(key);
|
|
36
|
+
}
|
|
37
|
+
isElementOperator(key) {
|
|
38
|
+
return _BaseFilterTranslator.DEFAULT_OPERATORS.element.includes(key);
|
|
39
|
+
}
|
|
40
|
+
isRegexOperator(key) {
|
|
41
|
+
return _BaseFilterTranslator.DEFAULT_OPERATORS.regex.includes(key);
|
|
42
|
+
}
|
|
43
|
+
isFieldOperator(key) {
|
|
44
|
+
return this.isOperator(key) && !this.isLogicalOperator(key);
|
|
45
|
+
}
|
|
46
|
+
isCustomOperator(key) {
|
|
47
|
+
const support = this.getSupportedOperators();
|
|
48
|
+
return support.custom?.includes(key) ?? false;
|
|
49
|
+
}
|
|
50
|
+
getSupportedOperators() {
|
|
51
|
+
return _BaseFilterTranslator.DEFAULT_OPERATORS;
|
|
52
|
+
}
|
|
53
|
+
isValidOperator(key) {
|
|
54
|
+
const support = this.getSupportedOperators();
|
|
55
|
+
const allSupported = Object.values(support).flat();
|
|
56
|
+
return allSupported.includes(key);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Value normalization for comparison operators
|
|
60
|
+
*/
|
|
61
|
+
normalizeComparisonValue(value) {
|
|
62
|
+
if (value instanceof Date) {
|
|
63
|
+
return value.toISOString();
|
|
64
|
+
}
|
|
65
|
+
if (typeof value === "number" && Object.is(value, -0)) {
|
|
66
|
+
return 0;
|
|
67
|
+
}
|
|
68
|
+
return value;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Helper method to simulate $all operator using $and + $eq when needed.
|
|
72
|
+
* Some vector stores don't support $all natively.
|
|
73
|
+
*/
|
|
74
|
+
simulateAllOperator(field, values) {
|
|
75
|
+
return {
|
|
76
|
+
$and: values.map((value) => ({
|
|
77
|
+
[field]: { $in: [this.normalizeComparisonValue(value)] }
|
|
78
|
+
}))
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Utility functions for type checking
|
|
83
|
+
*/
|
|
84
|
+
isPrimitive(value) {
|
|
85
|
+
return value === null || value === void 0 || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
86
|
+
}
|
|
87
|
+
isRegex(value) {
|
|
88
|
+
return value instanceof RegExp;
|
|
89
|
+
}
|
|
90
|
+
isEmpty(obj) {
|
|
91
|
+
return obj === null || obj === void 0 || typeof obj === "object" && Object.keys(obj).length === 0;
|
|
92
|
+
}
|
|
93
|
+
static ErrorMessages = {
|
|
94
|
+
UNSUPPORTED_OPERATOR: (op) => `Unsupported operator: ${op}`,
|
|
95
|
+
INVALID_LOGICAL_OPERATOR_LOCATION: (op, path) => `Logical operator ${op} cannot be used at field level: ${path}`,
|
|
96
|
+
NOT_REQUIRES_OBJECT: `$not operator requires an object`,
|
|
97
|
+
NOT_CANNOT_BE_EMPTY: `$not operator cannot be empty`,
|
|
98
|
+
INVALID_LOGICAL_OPERATOR_CONTENT: (path) => `Logical operators must contain field conditions, not direct operators: ${path}`,
|
|
99
|
+
INVALID_TOP_LEVEL_OPERATOR: (op) => `Invalid top-level operator: ${op}`,
|
|
100
|
+
ELEM_MATCH_REQUIRES_OBJECT: `$elemMatch requires an object with conditions`
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Helper to handle array value normalization consistently
|
|
104
|
+
*/
|
|
105
|
+
normalizeArrayValues(values) {
|
|
106
|
+
return values.map((value) => this.normalizeComparisonValue(value));
|
|
107
|
+
}
|
|
108
|
+
validateFilter(filter) {
|
|
109
|
+
const validation = this.validateFilterSupport(filter);
|
|
110
|
+
if (!validation.supported) {
|
|
111
|
+
throw new Error(validation.messages.join(", "));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Validates if a filter structure is supported by the specific vector DB
|
|
116
|
+
* and returns detailed validation information.
|
|
117
|
+
*/
|
|
118
|
+
validateFilterSupport(node, path = "") {
|
|
119
|
+
const messages = [];
|
|
120
|
+
if (this.isPrimitive(node) || this.isEmpty(node)) {
|
|
121
|
+
return { supported: true, messages: [] };
|
|
122
|
+
}
|
|
123
|
+
if (Array.isArray(node)) {
|
|
124
|
+
const arrayResults = node.map((item) => this.validateFilterSupport(item, path));
|
|
125
|
+
const arrayMessages = arrayResults.flatMap((r) => r.messages);
|
|
126
|
+
return {
|
|
127
|
+
supported: arrayResults.every((r) => r.supported),
|
|
128
|
+
messages: arrayMessages
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
const nodeObj = node;
|
|
132
|
+
let isSupported = true;
|
|
133
|
+
for (const [key, value] of Object.entries(nodeObj)) {
|
|
134
|
+
const newPath = path ? `${path}.${key}` : key;
|
|
135
|
+
if (this.isOperator(key)) {
|
|
136
|
+
if (!this.isValidOperator(key)) {
|
|
137
|
+
isSupported = false;
|
|
138
|
+
messages.push(_BaseFilterTranslator.ErrorMessages.UNSUPPORTED_OPERATOR(key));
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
if (!path && !this.isLogicalOperator(key)) {
|
|
142
|
+
isSupported = false;
|
|
143
|
+
messages.push(_BaseFilterTranslator.ErrorMessages.INVALID_TOP_LEVEL_OPERATOR(key));
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
if (key === "$elemMatch" && (typeof value !== "object" || Array.isArray(value))) {
|
|
147
|
+
isSupported = false;
|
|
148
|
+
messages.push(_BaseFilterTranslator.ErrorMessages.ELEM_MATCH_REQUIRES_OBJECT);
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
if (this.isLogicalOperator(key)) {
|
|
152
|
+
if (key === "$not") {
|
|
153
|
+
if (Array.isArray(value) || typeof value !== "object") {
|
|
154
|
+
isSupported = false;
|
|
155
|
+
messages.push(_BaseFilterTranslator.ErrorMessages.NOT_REQUIRES_OBJECT);
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
if (this.isEmpty(value)) {
|
|
159
|
+
isSupported = false;
|
|
160
|
+
messages.push(_BaseFilterTranslator.ErrorMessages.NOT_CANNOT_BE_EMPTY);
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
if (path && !this.isLogicalOperator(path.split(".").pop())) {
|
|
166
|
+
isSupported = false;
|
|
167
|
+
messages.push(_BaseFilterTranslator.ErrorMessages.INVALID_LOGICAL_OPERATOR_LOCATION(key, newPath));
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
if (Array.isArray(value)) {
|
|
171
|
+
const hasDirectOperators = value.some(
|
|
172
|
+
(item) => typeof item === "object" && Object.keys(item).length === 1 && this.isFieldOperator(Object.keys(item)[0])
|
|
173
|
+
);
|
|
174
|
+
if (hasDirectOperators) {
|
|
175
|
+
isSupported = false;
|
|
176
|
+
messages.push(_BaseFilterTranslator.ErrorMessages.INVALID_LOGICAL_OPERATOR_CONTENT(newPath));
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
const nestedValidation = this.validateFilterSupport(value, newPath);
|
|
183
|
+
if (!nestedValidation.supported) {
|
|
184
|
+
isSupported = false;
|
|
185
|
+
messages.push(...nestedValidation.messages);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return { supported: isSupported, messages };
|
|
189
|
+
}
|
|
190
|
+
};
|
|
4
191
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "BaseFilterTranslator", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function () { return chunkYK3XJ52U_cjs.BaseFilterTranslator; }
|
|
10
|
-
});
|
|
192
|
+
exports.BaseFilterTranslator = BaseFilterTranslator;
|
|
@@ -1 +1,190 @@
|
|
|
1
|
-
|
|
1
|
+
// src/vector/filter/base.ts
|
|
2
|
+
var BaseFilterTranslator = class _BaseFilterTranslator {
|
|
3
|
+
/**
|
|
4
|
+
* Operator type checks
|
|
5
|
+
*/
|
|
6
|
+
isOperator(key) {
|
|
7
|
+
return key.startsWith("$");
|
|
8
|
+
}
|
|
9
|
+
static BASIC_OPERATORS = ["$eq", "$ne"];
|
|
10
|
+
static NUMERIC_OPERATORS = ["$gt", "$gte", "$lt", "$lte"];
|
|
11
|
+
static ARRAY_OPERATORS = ["$in", "$nin", "$all", "$elemMatch"];
|
|
12
|
+
static LOGICAL_OPERATORS = ["$and", "$or", "$not", "$nor"];
|
|
13
|
+
static ELEMENT_OPERATORS = ["$exists"];
|
|
14
|
+
static REGEX_OPERATORS = ["$regex", "$options"];
|
|
15
|
+
static DEFAULT_OPERATORS = {
|
|
16
|
+
logical: _BaseFilterTranslator.LOGICAL_OPERATORS,
|
|
17
|
+
basic: _BaseFilterTranslator.BASIC_OPERATORS,
|
|
18
|
+
numeric: _BaseFilterTranslator.NUMERIC_OPERATORS,
|
|
19
|
+
array: _BaseFilterTranslator.ARRAY_OPERATORS,
|
|
20
|
+
element: _BaseFilterTranslator.ELEMENT_OPERATORS,
|
|
21
|
+
regex: _BaseFilterTranslator.REGEX_OPERATORS
|
|
22
|
+
};
|
|
23
|
+
isLogicalOperator(key) {
|
|
24
|
+
return _BaseFilterTranslator.DEFAULT_OPERATORS.logical.includes(key);
|
|
25
|
+
}
|
|
26
|
+
isBasicOperator(key) {
|
|
27
|
+
return _BaseFilterTranslator.DEFAULT_OPERATORS.basic.includes(key);
|
|
28
|
+
}
|
|
29
|
+
isNumericOperator(key) {
|
|
30
|
+
return _BaseFilterTranslator.DEFAULT_OPERATORS.numeric.includes(key);
|
|
31
|
+
}
|
|
32
|
+
isArrayOperator(key) {
|
|
33
|
+
return _BaseFilterTranslator.DEFAULT_OPERATORS.array.includes(key);
|
|
34
|
+
}
|
|
35
|
+
isElementOperator(key) {
|
|
36
|
+
return _BaseFilterTranslator.DEFAULT_OPERATORS.element.includes(key);
|
|
37
|
+
}
|
|
38
|
+
isRegexOperator(key) {
|
|
39
|
+
return _BaseFilterTranslator.DEFAULT_OPERATORS.regex.includes(key);
|
|
40
|
+
}
|
|
41
|
+
isFieldOperator(key) {
|
|
42
|
+
return this.isOperator(key) && !this.isLogicalOperator(key);
|
|
43
|
+
}
|
|
44
|
+
isCustomOperator(key) {
|
|
45
|
+
const support = this.getSupportedOperators();
|
|
46
|
+
return support.custom?.includes(key) ?? false;
|
|
47
|
+
}
|
|
48
|
+
getSupportedOperators() {
|
|
49
|
+
return _BaseFilterTranslator.DEFAULT_OPERATORS;
|
|
50
|
+
}
|
|
51
|
+
isValidOperator(key) {
|
|
52
|
+
const support = this.getSupportedOperators();
|
|
53
|
+
const allSupported = Object.values(support).flat();
|
|
54
|
+
return allSupported.includes(key);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Value normalization for comparison operators
|
|
58
|
+
*/
|
|
59
|
+
normalizeComparisonValue(value) {
|
|
60
|
+
if (value instanceof Date) {
|
|
61
|
+
return value.toISOString();
|
|
62
|
+
}
|
|
63
|
+
if (typeof value === "number" && Object.is(value, -0)) {
|
|
64
|
+
return 0;
|
|
65
|
+
}
|
|
66
|
+
return value;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Helper method to simulate $all operator using $and + $eq when needed.
|
|
70
|
+
* Some vector stores don't support $all natively.
|
|
71
|
+
*/
|
|
72
|
+
simulateAllOperator(field, values) {
|
|
73
|
+
return {
|
|
74
|
+
$and: values.map((value) => ({
|
|
75
|
+
[field]: { $in: [this.normalizeComparisonValue(value)] }
|
|
76
|
+
}))
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Utility functions for type checking
|
|
81
|
+
*/
|
|
82
|
+
isPrimitive(value) {
|
|
83
|
+
return value === null || value === void 0 || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
84
|
+
}
|
|
85
|
+
isRegex(value) {
|
|
86
|
+
return value instanceof RegExp;
|
|
87
|
+
}
|
|
88
|
+
isEmpty(obj) {
|
|
89
|
+
return obj === null || obj === void 0 || typeof obj === "object" && Object.keys(obj).length === 0;
|
|
90
|
+
}
|
|
91
|
+
static ErrorMessages = {
|
|
92
|
+
UNSUPPORTED_OPERATOR: (op) => `Unsupported operator: ${op}`,
|
|
93
|
+
INVALID_LOGICAL_OPERATOR_LOCATION: (op, path) => `Logical operator ${op} cannot be used at field level: ${path}`,
|
|
94
|
+
NOT_REQUIRES_OBJECT: `$not operator requires an object`,
|
|
95
|
+
NOT_CANNOT_BE_EMPTY: `$not operator cannot be empty`,
|
|
96
|
+
INVALID_LOGICAL_OPERATOR_CONTENT: (path) => `Logical operators must contain field conditions, not direct operators: ${path}`,
|
|
97
|
+
INVALID_TOP_LEVEL_OPERATOR: (op) => `Invalid top-level operator: ${op}`,
|
|
98
|
+
ELEM_MATCH_REQUIRES_OBJECT: `$elemMatch requires an object with conditions`
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Helper to handle array value normalization consistently
|
|
102
|
+
*/
|
|
103
|
+
normalizeArrayValues(values) {
|
|
104
|
+
return values.map((value) => this.normalizeComparisonValue(value));
|
|
105
|
+
}
|
|
106
|
+
validateFilter(filter) {
|
|
107
|
+
const validation = this.validateFilterSupport(filter);
|
|
108
|
+
if (!validation.supported) {
|
|
109
|
+
throw new Error(validation.messages.join(", "));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Validates if a filter structure is supported by the specific vector DB
|
|
114
|
+
* and returns detailed validation information.
|
|
115
|
+
*/
|
|
116
|
+
validateFilterSupport(node, path = "") {
|
|
117
|
+
const messages = [];
|
|
118
|
+
if (this.isPrimitive(node) || this.isEmpty(node)) {
|
|
119
|
+
return { supported: true, messages: [] };
|
|
120
|
+
}
|
|
121
|
+
if (Array.isArray(node)) {
|
|
122
|
+
const arrayResults = node.map((item) => this.validateFilterSupport(item, path));
|
|
123
|
+
const arrayMessages = arrayResults.flatMap((r) => r.messages);
|
|
124
|
+
return {
|
|
125
|
+
supported: arrayResults.every((r) => r.supported),
|
|
126
|
+
messages: arrayMessages
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
const nodeObj = node;
|
|
130
|
+
let isSupported = true;
|
|
131
|
+
for (const [key, value] of Object.entries(nodeObj)) {
|
|
132
|
+
const newPath = path ? `${path}.${key}` : key;
|
|
133
|
+
if (this.isOperator(key)) {
|
|
134
|
+
if (!this.isValidOperator(key)) {
|
|
135
|
+
isSupported = false;
|
|
136
|
+
messages.push(_BaseFilterTranslator.ErrorMessages.UNSUPPORTED_OPERATOR(key));
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
if (!path && !this.isLogicalOperator(key)) {
|
|
140
|
+
isSupported = false;
|
|
141
|
+
messages.push(_BaseFilterTranslator.ErrorMessages.INVALID_TOP_LEVEL_OPERATOR(key));
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
if (key === "$elemMatch" && (typeof value !== "object" || Array.isArray(value))) {
|
|
145
|
+
isSupported = false;
|
|
146
|
+
messages.push(_BaseFilterTranslator.ErrorMessages.ELEM_MATCH_REQUIRES_OBJECT);
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
if (this.isLogicalOperator(key)) {
|
|
150
|
+
if (key === "$not") {
|
|
151
|
+
if (Array.isArray(value) || typeof value !== "object") {
|
|
152
|
+
isSupported = false;
|
|
153
|
+
messages.push(_BaseFilterTranslator.ErrorMessages.NOT_REQUIRES_OBJECT);
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
if (this.isEmpty(value)) {
|
|
157
|
+
isSupported = false;
|
|
158
|
+
messages.push(_BaseFilterTranslator.ErrorMessages.NOT_CANNOT_BE_EMPTY);
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
if (path && !this.isLogicalOperator(path.split(".").pop())) {
|
|
164
|
+
isSupported = false;
|
|
165
|
+
messages.push(_BaseFilterTranslator.ErrorMessages.INVALID_LOGICAL_OPERATOR_LOCATION(key, newPath));
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
if (Array.isArray(value)) {
|
|
169
|
+
const hasDirectOperators = value.some(
|
|
170
|
+
(item) => typeof item === "object" && Object.keys(item).length === 1 && this.isFieldOperator(Object.keys(item)[0])
|
|
171
|
+
);
|
|
172
|
+
if (hasDirectOperators) {
|
|
173
|
+
isSupported = false;
|
|
174
|
+
messages.push(_BaseFilterTranslator.ErrorMessages.INVALID_LOGICAL_OPERATOR_CONTENT(newPath));
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
const nestedValidation = this.validateFilterSupport(value, newPath);
|
|
181
|
+
if (!nestedValidation.supported) {
|
|
182
|
+
isSupported = false;
|
|
183
|
+
messages.push(...nestedValidation.messages);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return { supported: isSupported, messages };
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
export { BaseFilterTranslator };
|
package/dist/vector/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkPIZM25KI_cjs = require('../chunk-PIZM25KI.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "MastraVector", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkPIZM25KI_cjs.MastraVector; }
|
|
10
10
|
});
|