@mastra/core 0.2.0-alpha.99 → 0.2.1-alpha.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.
- package/dist/agent/index.d.ts +6 -8
- package/dist/agent/index.js +1 -7
- package/dist/{telemetry-oCUM52DG.d.ts → base-BbtPAA6f.d.ts} +50 -8
- package/dist/{index-Cwb-5AzX.d.ts → base-C7R9FwZ6.d.ts} +450 -403
- package/dist/base.d.ts +3 -43
- package/dist/base.js +1 -3
- package/dist/bundler/index.d.ts +3 -4
- package/dist/bundler/index.js +1 -4
- package/dist/{chunk-MCB4M5W4.js → chunk-22LC46YN.js} +3 -9
- package/dist/chunk-4ZRHVG25.js +402 -0
- package/dist/{chunk-KNPBNSJ7.js → chunk-55GTEVHJ.js} +13 -14
- package/dist/chunk-5HXXWLRX.js +626 -0
- package/dist/chunk-6TCTOQ3G.js +1204 -0
- package/dist/{chunk-ZJOMHCWE.js → chunk-AN562ICT.js} +98 -151
- package/dist/chunk-AWEACB2T.js +66 -0
- package/dist/chunk-BB4KXGBU.js +83 -0
- package/dist/chunk-C6A6W6XS.js +77 -0
- package/dist/{chunk-EO3TIPGQ.js → chunk-CUIUUULJ.js} +375 -254
- package/dist/chunk-HT63PEVD.js +37 -0
- package/dist/chunk-K36NSQWH.js +10 -0
- package/dist/chunk-NUDAZEOG.js +35 -0
- package/dist/{chunk-ICMEXHKD.js → chunk-O2VP5JBC.js} +48 -55
- package/dist/{chunk-42DYOLDV.js → chunk-PNZK456O.js} +13 -21
- package/dist/chunk-RG66XEJT.js +8 -0
- package/dist/chunk-SIFBBGY6.js +190 -0
- package/dist/{chunk-A7SNFYQB.js → chunk-V4WSAQOP.js} +7 -15
- package/dist/chunk-V5UMPUKC.js +218 -0
- package/dist/{chunk-DHCULRJM.js → chunk-VE4JJJSW.js} +126 -78
- package/dist/chunk-ZINPRHAN.js +22 -0
- package/dist/{chunk-C55JWGDU.js → chunk-ZJOXJFJI.js} +42 -15
- package/dist/deployer/index.d.ts +3 -5
- package/dist/deployer/index.js +1 -5
- package/dist/eval/index.d.ts +8 -13
- package/dist/eval/index.js +1 -3
- package/dist/filter/index.js +1 -2
- package/dist/hooks/index.d.ts +13 -18
- package/dist/hooks/index.js +1 -2
- package/dist/{index-CBZ2mk2H.d.ts → index-B2JCcAQt.d.ts} +1 -1
- package/dist/index.d.ts +16 -16
- package/dist/index.js +37 -67
- package/dist/integration/index.d.ts +8 -10
- package/dist/integration/index.js +1 -3
- package/dist/llm/index.d.ts +6 -8
- package/dist/llm/index.js +1 -1
- package/dist/logger/index.d.ts +1 -1
- package/dist/logger/index.js +1 -2
- package/dist/mastra/index.d.ts +23 -25
- package/dist/mastra/index.js +1 -9
- package/dist/memory/index.d.ts +8 -10
- package/dist/memory/index.js +1 -9
- package/dist/relevance/index.js +1 -8
- package/dist/storage/index.d.ts +21 -10
- package/dist/storage/index.js +3 -7
- package/dist/telemetry/index.d.ts +35 -5
- package/dist/telemetry/index.js +1 -2
- package/dist/telemetry/otel-vendor.d.ts +7 -0
- package/dist/telemetry/otel-vendor.js +7 -0
- package/dist/tools/index.d.ts +6 -8
- package/dist/tools/index.js +1 -2
- package/dist/tts/index.d.ts +2 -4
- package/dist/tts/index.js +1 -5
- package/dist/{metric-BWeQNZt6.d.ts → types-m9RryK9a.d.ts} +6 -1
- package/dist/utils.js +1 -2
- package/dist/vector/index.d.ts +4 -6
- package/dist/vector/index.js +1 -4
- package/dist/vector/libsql/index.d.ts +2 -4
- package/dist/vector/libsql/index.js +1 -6
- package/dist/{workflow-DTtv7_Eq.d.ts → workflow-7xHmmFH5.d.ts} +3 -6
- package/dist/workflows/index.d.ts +7 -9
- package/dist/workflows/index.js +1 -4
- package/package.json +22 -18
- package/dist/chunk-4LJFWC2Q.js +0 -216
- package/dist/chunk-4ZUSEHLH.js +0 -285
- package/dist/chunk-AJJZUHB4.js +0 -14
- package/dist/chunk-G4MCO7XF.js +0 -70
- package/dist/chunk-HBTQNIAX.js +0 -90
- package/dist/chunk-HPXWJBQK.js +0 -222
- package/dist/chunk-JJ57BXQR.js +0 -16
- package/dist/chunk-JP37ODNX.js +0 -36
- package/dist/chunk-K3N7KJHH.js +0 -52
- package/dist/chunk-MDM2JS2U.js +0 -1288
- package/dist/chunk-VOUPGVRD.js +0 -27
- package/dist/chunk-Z7JFMQZZ.js +0 -551
- /package/dist/{chunk-AE3H2QEY.js → chunk-ZDWFBE5L.js} +0 -0
|
@@ -1,20 +1,50 @@
|
|
|
1
|
-
export { O as OtelConfig, S as SamplingStrategy, T as Telemetry } from '../
|
|
1
|
+
export { O as OtelConfig, S as SamplingStrategy, T as Telemetry } from '../base-BbtPAA6f.js';
|
|
2
2
|
import { SpanKind } from '@opentelemetry/api';
|
|
3
|
-
import '@opentelemetry/
|
|
4
|
-
import '@opentelemetry/sdk-trace-base';
|
|
3
|
+
import { ExportResult } from '@opentelemetry/core';
|
|
4
|
+
import { SpanExporter, ReadableSpan } from '@opentelemetry/sdk-trace-base';
|
|
5
|
+
import { L as Logger } from '../index-B2JCcAQt.js';
|
|
6
|
+
import { a as MastraStorage } from '../base-C7R9FwZ6.js';
|
|
7
|
+
import 'pino';
|
|
8
|
+
import 'stream';
|
|
9
|
+
import 'ai';
|
|
10
|
+
import '../types-m9RryK9a.js';
|
|
11
|
+
import 'sift';
|
|
12
|
+
import 'zod';
|
|
13
|
+
import 'json-schema';
|
|
14
|
+
import '../vector/index.js';
|
|
15
|
+
import '../tts/index.js';
|
|
5
16
|
|
|
6
17
|
declare function withSpan(options: {
|
|
7
18
|
spanName?: string;
|
|
8
19
|
skipIfNoTelemetry?: boolean;
|
|
9
20
|
spanKind?: SpanKind;
|
|
21
|
+
tracerName?: string;
|
|
10
22
|
}): any;
|
|
11
23
|
declare function InstrumentClass(options?: {
|
|
12
24
|
prefix?: string;
|
|
13
25
|
spanKind?: SpanKind;
|
|
14
26
|
excludeMethods?: string[];
|
|
15
27
|
methodFilter?: (methodName: string) => boolean;
|
|
28
|
+
tracerName?: string;
|
|
16
29
|
}): (target: any) => any;
|
|
17
30
|
|
|
18
|
-
declare function hasActiveTelemetry(): boolean;
|
|
31
|
+
declare function hasActiveTelemetry(tracerName?: string): boolean;
|
|
19
32
|
|
|
20
|
-
|
|
33
|
+
declare class OTLPTraceExporter implements SpanExporter {
|
|
34
|
+
private storage;
|
|
35
|
+
private queue;
|
|
36
|
+
private serializer;
|
|
37
|
+
private logger;
|
|
38
|
+
private activeFlush;
|
|
39
|
+
constructor({ logger, storage }: {
|
|
40
|
+
logger: Logger;
|
|
41
|
+
storage: MastraStorage;
|
|
42
|
+
});
|
|
43
|
+
export(internalRepresentation: ReadableSpan[], resultCallback: (result: ExportResult) => void): void;
|
|
44
|
+
shutdown(): Promise<void>;
|
|
45
|
+
flush(): Promise<void>;
|
|
46
|
+
forceFlush(): Promise<void>;
|
|
47
|
+
__setLogger(logger: Logger): void;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { InstrumentClass, OTLPTraceExporter as OTLPStorageExporter, hasActiveTelemetry, withSpan };
|
package/dist/telemetry/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { InstrumentClass, Telemetry, hasActiveTelemetry, withSpan } from '../chunk-
|
|
2
|
-
import '../chunk-AJJZUHB4.js';
|
|
1
|
+
export { InstrumentClass, OTLPTraceExporter as OTLPStorageExporter, Telemetry, hasActiveTelemetry, withSpan } from '../chunk-4ZRHVG25.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { NodeSDK } from '@opentelemetry/sdk-node';
|
|
2
|
+
export { ConsoleSpanExporter } from '@opentelemetry/sdk-trace-node';
|
|
3
|
+
export { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';
|
|
4
|
+
export { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
|
|
5
|
+
export { Resource } from '@opentelemetry/resources';
|
|
6
|
+
export { OTLPTraceExporter as OTLPHttpExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
|
7
|
+
export { AlwaysOffSampler, AlwaysOnSampler, ParentBasedSampler, Sampler, TraceIdRatioBasedSampler } from '@opentelemetry/sdk-trace-base';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { NodeSDK } from '@opentelemetry/sdk-node';
|
|
2
|
+
export { ConsoleSpanExporter } from '@opentelemetry/sdk-trace-node';
|
|
3
|
+
export { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';
|
|
4
|
+
export { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
|
|
5
|
+
export { Resource } from '@opentelemetry/resources';
|
|
6
|
+
export { OTLPTraceExporter as OTLPHttpExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
|
7
|
+
export { AlwaysOffSampler, AlwaysOnSampler, ParentBasedSampler, TraceIdRatioBasedSampler } from '@opentelemetry/sdk-trace-base';
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { j as ToolExecutionContext, T as ToolAction, c as MastraPrimitives } from '../
|
|
3
|
-
export {
|
|
2
|
+
import { j as ToolExecutionContext, T as ToolAction, c as MastraPrimitives } from '../base-C7R9FwZ6.js';
|
|
3
|
+
export { Q as CoreTool } from '../base-C7R9FwZ6.js';
|
|
4
4
|
import 'ai';
|
|
5
|
-
import '
|
|
6
|
-
import '../base.js';
|
|
5
|
+
import '../base-BbtPAA6f.js';
|
|
7
6
|
import '@opentelemetry/api';
|
|
8
|
-
import '../index-
|
|
7
|
+
import '../index-B2JCcAQt.js';
|
|
9
8
|
import 'pino';
|
|
10
9
|
import 'stream';
|
|
11
|
-
import '../telemetry-oCUM52DG.js';
|
|
12
|
-
import '@opentelemetry/sdk-node';
|
|
13
10
|
import '@opentelemetry/sdk-trace-base';
|
|
14
|
-
import '../
|
|
11
|
+
import '../types-m9RryK9a.js';
|
|
15
12
|
import 'sift';
|
|
13
|
+
import 'json-schema';
|
|
16
14
|
import '../vector/index.js';
|
|
17
15
|
import '../tts/index.js';
|
|
18
16
|
|
package/dist/tools/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { Tool, createTool } from '../chunk-
|
|
2
|
-
import '../chunk-AJJZUHB4.js';
|
|
1
|
+
export { Tool, createTool } from '../chunk-ZINPRHAN.js';
|
package/dist/tts/index.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { MastraBase } from '../base.js';
|
|
1
|
+
import { M as MastraBase } from '../base-BbtPAA6f.js';
|
|
2
2
|
import '@opentelemetry/api';
|
|
3
|
-
import '../index-
|
|
3
|
+
import '../index-B2JCcAQt.js';
|
|
4
4
|
import 'pino';
|
|
5
5
|
import 'stream';
|
|
6
|
-
import '../telemetry-oCUM52DG.js';
|
|
7
|
-
import '@opentelemetry/sdk-node';
|
|
8
6
|
import '@opentelemetry/sdk-trace-base';
|
|
9
7
|
|
|
10
8
|
interface BuiltInModelConfig {
|
package/dist/tts/index.js
CHANGED
|
@@ -6,4 +6,9 @@ declare abstract class Metric {
|
|
|
6
6
|
abstract measure(input: string, output: string): Promise<MetricResult>;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
interface TestInfo {
|
|
10
|
+
testName?: string;
|
|
11
|
+
testPath?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { type MetricResult as M, type TestInfo as T, Metric as a };
|
package/dist/utils.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { deepMerge, delay, jsonSchemaPropertiesToTSTypes, jsonSchemaToModel, maskStreamTags } from './chunk-
|
|
2
|
-
import './chunk-AJJZUHB4.js';
|
|
1
|
+
export { deepMerge, delay, jsonSchemaPropertiesToTSTypes, jsonSchemaToModel, maskStreamTags } from './chunk-55GTEVHJ.js';
|
package/dist/vector/index.d.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { MastraBase } from '../base.js';
|
|
1
|
+
import { M as MastraBase } from '../base-BbtPAA6f.js';
|
|
2
2
|
import * as ai from 'ai';
|
|
3
3
|
import '@opentelemetry/api';
|
|
4
|
-
import '../index-
|
|
4
|
+
import '../index-B2JCcAQt.js';
|
|
5
5
|
import 'pino';
|
|
6
6
|
import 'stream';
|
|
7
|
-
import '../telemetry-oCUM52DG.js';
|
|
8
|
-
import '@opentelemetry/sdk-node';
|
|
9
7
|
import '@opentelemetry/sdk-trace-base';
|
|
10
8
|
|
|
11
|
-
declare const
|
|
9
|
+
declare const defaultEmbedder: ((modelId: string) => ai.EmbeddingModel<string>) & ((modelId: "bge-small-en-v1.5" | "bge-base-en-v1.5") => ai.EmbeddingModel<string>);
|
|
12
10
|
|
|
13
11
|
interface QueryResult {
|
|
14
12
|
id: string;
|
|
@@ -31,4 +29,4 @@ declare abstract class MastraVector extends MastraBase {
|
|
|
31
29
|
abstract deleteIndex(indexName: string): Promise<void>;
|
|
32
30
|
}
|
|
33
31
|
|
|
34
|
-
export { type IndexStats, MastraVector, type QueryResult,
|
|
32
|
+
export { type IndexStats, MastraVector, type QueryResult, defaultEmbedder };
|
package/dist/vector/index.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { Filter } from '../../filter/index.js';
|
|
2
2
|
import { MastraVector, QueryResult, IndexStats } from '../index.js';
|
|
3
|
-
import '../../base.js';
|
|
3
|
+
import '../../base-BbtPAA6f.js';
|
|
4
4
|
import '@opentelemetry/api';
|
|
5
|
-
import '../../index-
|
|
5
|
+
import '../../index-B2JCcAQt.js';
|
|
6
6
|
import 'pino';
|
|
7
7
|
import 'stream';
|
|
8
|
-
import '../../telemetry-oCUM52DG.js';
|
|
9
|
-
import '@opentelemetry/sdk-node';
|
|
10
8
|
import '@opentelemetry/sdk-trace-base';
|
|
11
9
|
import 'ai';
|
|
12
10
|
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
export { DefaultVectorDB, DefaultVectorDB as LibSQLVector } from '../../chunk-
|
|
2
|
-
import '../../chunk-C55JWGDU.js';
|
|
3
|
-
import '../../chunk-G4MCO7XF.js';
|
|
4
|
-
import '../../chunk-ICMEXHKD.js';
|
|
5
|
-
import '../../chunk-4LJFWC2Q.js';
|
|
6
|
-
import '../../chunk-AJJZUHB4.js';
|
|
1
|
+
export { DefaultVectorDB, DefaultVectorDB as LibSQLVector } from '../../chunk-AN562ICT.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Snapshot } from 'xstate';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { S as StepExecutionContext, b as StepAction, R as RetryConfig, c as MastraPrimitives, W as WorkflowOptions, I as IAction, d as StepVariableType, e as StepConfig, f as StepResult, g as WorkflowRunState, h as StepGraph } from './
|
|
4
|
-
import { MastraBase } from './base.js';
|
|
3
|
+
import { S as StepExecutionContext, b as StepAction, R as RetryConfig, c as MastraPrimitives, W as WorkflowOptions, I as IAction, d as StepVariableType, e as StepConfig, f as StepResult, g as WorkflowRunState, h as StepGraph } from './base-C7R9FwZ6.js';
|
|
4
|
+
import { M as MastraBase } from './base-BbtPAA6f.js';
|
|
5
5
|
|
|
6
6
|
declare class Step<TStepId extends string = any, TSchemaIn extends z.ZodSchema | undefined = undefined, TSchemaOut extends z.ZodSchema | undefined = undefined, TContext extends StepExecutionContext<TSchemaIn> = StepExecutionContext<TSchemaIn>> implements StepAction<TStepId, TSchemaIn, TSchemaOut, TContext> {
|
|
7
7
|
id: TStepId;
|
|
@@ -73,10 +73,7 @@ declare class Workflow<TSteps extends Step<any, any, any>[] = any, TTriggerSchem
|
|
|
73
73
|
*/
|
|
74
74
|
commit(): this;
|
|
75
75
|
getState(runId: string): Promise<WorkflowRunState | null>;
|
|
76
|
-
watch(
|
|
77
|
-
onTransition?: (state: WorkflowRunState) => void | Promise<void>;
|
|
78
|
-
pollInterval?: number;
|
|
79
|
-
}): Promise<WorkflowRunState>;
|
|
76
|
+
watch(onTransition: (state: WorkflowRunState) => void): () => void;
|
|
80
77
|
resume({ runId, stepId, context: resumeContext, }: {
|
|
81
78
|
runId: string;
|
|
82
79
|
stepId: string;
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
export { S as Step, W as Workflow, c as createStep } from '../workflow-
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
1
|
+
export { S as Step, W as Workflow, c as createStep } from '../workflow-7xHmmFH5.js';
|
|
2
|
+
import { V as VariableReference, f as StepResult } from '../base-C7R9FwZ6.js';
|
|
3
|
+
export { Y as ActionContext, X as BaseCondition, a5 as DependencyCheckOutput, ab as ExtractSchemaFromStep, ae as ExtractSchemaType, ac as ExtractStepResult, af as PathsToStringProps, a2 as ResolverFunctionInput, a3 as ResolverFunctionOutput, R as RetryConfig, b as StepAction, _ as StepCondition, e as StepConfig, Z as StepDef, S as StepExecutionContext, h as StepGraph, aa as StepId, ad as StepInputType, U as StepNode, d as StepVariableType, a4 as SubscriberFunctionOutput, a7 as WorkflowActionParams, a8 as WorkflowActions, a6 as WorkflowActors, $ as WorkflowContext, a1 as WorkflowEvent, a0 as WorkflowLogMessage, W as WorkflowOptions, g as WorkflowRunState, a9 as WorkflowState } from '../base-C7R9FwZ6.js';
|
|
4
4
|
import 'xstate';
|
|
5
5
|
import 'zod';
|
|
6
|
-
import '../base.js';
|
|
6
|
+
import '../base-BbtPAA6f.js';
|
|
7
7
|
import '@opentelemetry/api';
|
|
8
|
-
import '../index-
|
|
8
|
+
import '../index-B2JCcAQt.js';
|
|
9
9
|
import 'pino';
|
|
10
10
|
import 'stream';
|
|
11
|
-
import '../telemetry-oCUM52DG.js';
|
|
12
|
-
import '@opentelemetry/sdk-node';
|
|
13
11
|
import '@opentelemetry/sdk-trace-base';
|
|
14
12
|
import 'ai';
|
|
15
|
-
import '
|
|
16
|
-
import '../metric-BWeQNZt6.js';
|
|
13
|
+
import '../types-m9RryK9a.js';
|
|
17
14
|
import 'sift';
|
|
15
|
+
import 'json-schema';
|
|
18
16
|
import '../vector/index.js';
|
|
19
17
|
import '../tts/index.js';
|
|
20
18
|
|
package/dist/workflows/index.js
CHANGED
|
@@ -1,4 +1 @@
|
|
|
1
|
-
export { Step, Workflow, createStep, getStepResult, isErrorEvent, isTransitionEvent, isVariableReference } from '../chunk-
|
|
2
|
-
import '../chunk-G4MCO7XF.js';
|
|
3
|
-
import '../chunk-ICMEXHKD.js';
|
|
4
|
-
import '../chunk-AJJZUHB4.js';
|
|
1
|
+
export { Step, Workflow, createStep, getStepResult, isErrorEvent, isTransitionEvent, isVariableReference } from '../chunk-6TCTOQ3G.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1-alpha.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/core.esm.js",
|
|
@@ -39,9 +39,12 @@
|
|
|
39
39
|
"default": "./dist/base.js"
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
|
-
"./
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
"./telemetry/otel-vendor": {
|
|
43
|
+
"import": {
|
|
44
|
+
"types": "./dist/telemetry/otel-vendor.d.ts",
|
|
45
|
+
"default": "./dist/telemetry/otel-vendor.js"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
45
48
|
"./package.json": "./package.json"
|
|
46
49
|
},
|
|
47
50
|
"sideEffects": false,
|
|
@@ -49,13 +52,17 @@
|
|
|
49
52
|
"@libsql/client": "^0.14.0",
|
|
50
53
|
"@opentelemetry/api": "^1.9.0",
|
|
51
54
|
"@opentelemetry/auto-instrumentations-node": "^0.53.0",
|
|
55
|
+
"@opentelemetry/core": "^1.30.1",
|
|
52
56
|
"@opentelemetry/exporter-trace-otlp-http": "^0.55.0",
|
|
57
|
+
"@opentelemetry/otlp-exporter-base": "^0.57.1",
|
|
58
|
+
"@opentelemetry/otlp-transformer": "^0.57.1",
|
|
53
59
|
"@opentelemetry/resources": "^1.28.0",
|
|
54
60
|
"@opentelemetry/sdk-metrics": "^1.28.0",
|
|
55
61
|
"@opentelemetry/sdk-node": "^0.55.0",
|
|
56
|
-
"@opentelemetry/sdk-trace-base": "^1.
|
|
62
|
+
"@opentelemetry/sdk-trace-base": "^1.30.1",
|
|
57
63
|
"@opentelemetry/sdk-trace-node": "^1.28.0",
|
|
58
64
|
"@opentelemetry/semantic-conventions": "^1.28.0",
|
|
65
|
+
"ai": "^4.1.41",
|
|
59
66
|
"cohere-ai": "^7.15.4",
|
|
60
67
|
"date-fns": "^3.0.5",
|
|
61
68
|
"dotenv": "^16.4.7",
|
|
@@ -69,26 +76,23 @@
|
|
|
69
76
|
"xstate": "^5.19.0",
|
|
70
77
|
"zod": "^3.24.1"
|
|
71
78
|
},
|
|
72
|
-
"peerDependencies": {
|
|
73
|
-
"ai": "^4.0.0"
|
|
74
|
-
},
|
|
75
79
|
"devDependencies": {
|
|
76
|
-
"@ai-sdk/openai": "
|
|
77
|
-
"@babel/
|
|
78
|
-
"@
|
|
80
|
+
"@ai-sdk/openai": "^1.1.12",
|
|
81
|
+
"@babel/core": "^7.26.7",
|
|
82
|
+
"@microsoft/api-extractor": "^7.49.2",
|
|
79
83
|
"@size-limit/preset-small-lib": "^11.1.4",
|
|
80
|
-
"@
|
|
84
|
+
"@types/babel__core": "^7.20.5",
|
|
81
85
|
"@types/json-schema": "^7.0.15",
|
|
82
86
|
"@types/lodash-es": "^4.17.12",
|
|
83
|
-
"@types/node": "^22.1
|
|
87
|
+
"@types/node": "^22.13.1",
|
|
84
88
|
"@types/pino": "^7.0.5",
|
|
85
89
|
"@types/qs": "^6.9.15",
|
|
86
|
-
"
|
|
90
|
+
"eslint": "^9.20.1",
|
|
87
91
|
"size-limit": "^11.1.4",
|
|
88
|
-
"ts-node": "^10.9.2",
|
|
89
92
|
"tsup": "^8.3.6",
|
|
90
93
|
"typescript": "^5.7.3",
|
|
91
|
-
"vitest": "^3.0.4"
|
|
94
|
+
"vitest": "^3.0.4",
|
|
95
|
+
"@internal/lint": "0.0.0"
|
|
92
96
|
},
|
|
93
97
|
"engines": {
|
|
94
98
|
"node": ">=20"
|
|
@@ -124,8 +128,8 @@
|
|
|
124
128
|
"scripts": {
|
|
125
129
|
"check": "tsc --noEmit",
|
|
126
130
|
"analyze": "size-limit --why",
|
|
127
|
-
"
|
|
128
|
-
"build": "tsup
|
|
131
|
+
"lint": "eslint .",
|
|
132
|
+
"build": "tsup --config tsup.config.ts",
|
|
129
133
|
"build:watch": "pnpm build --watch",
|
|
130
134
|
"size": "size-limit",
|
|
131
135
|
"test": "vitest run"
|
package/dist/chunk-4LJFWC2Q.js
DELETED
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import { __name, __publicField } from './chunk-AJJZUHB4.js';
|
|
2
|
-
|
|
3
|
-
// src/filter/base.ts
|
|
4
|
-
var _a;
|
|
5
|
-
var BaseFilterTranslator = (_a = class {
|
|
6
|
-
/**
|
|
7
|
-
* Operator type checks
|
|
8
|
-
*/
|
|
9
|
-
isOperator(key) {
|
|
10
|
-
return key.startsWith("$");
|
|
11
|
-
}
|
|
12
|
-
isLogicalOperator(key) {
|
|
13
|
-
return _a.DEFAULT_OPERATORS.logical.includes(key);
|
|
14
|
-
}
|
|
15
|
-
isBasicOperator(key) {
|
|
16
|
-
return _a.DEFAULT_OPERATORS.basic.includes(key);
|
|
17
|
-
}
|
|
18
|
-
isNumericOperator(key) {
|
|
19
|
-
return _a.DEFAULT_OPERATORS.numeric.includes(key);
|
|
20
|
-
}
|
|
21
|
-
isArrayOperator(key) {
|
|
22
|
-
return _a.DEFAULT_OPERATORS.array.includes(key);
|
|
23
|
-
}
|
|
24
|
-
isElementOperator(key) {
|
|
25
|
-
return _a.DEFAULT_OPERATORS.element.includes(key);
|
|
26
|
-
}
|
|
27
|
-
isRegexOperator(key) {
|
|
28
|
-
return _a.DEFAULT_OPERATORS.regex.includes(key);
|
|
29
|
-
}
|
|
30
|
-
isFieldOperator(key) {
|
|
31
|
-
return this.isOperator(key) && !this.isLogicalOperator(key);
|
|
32
|
-
}
|
|
33
|
-
isCustomOperator(key) {
|
|
34
|
-
const support = this.getSupportedOperators();
|
|
35
|
-
return support.custom?.includes(key) ?? false;
|
|
36
|
-
}
|
|
37
|
-
getSupportedOperators() {
|
|
38
|
-
return _a.DEFAULT_OPERATORS;
|
|
39
|
-
}
|
|
40
|
-
isValidOperator(key) {
|
|
41
|
-
const support = this.getSupportedOperators();
|
|
42
|
-
const allSupported = Object.values(support).flat();
|
|
43
|
-
return allSupported.includes(key);
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Value normalization for comparison operators
|
|
47
|
-
*/
|
|
48
|
-
normalizeComparisonValue(value) {
|
|
49
|
-
if (value instanceof Date) {
|
|
50
|
-
return value.toISOString();
|
|
51
|
-
}
|
|
52
|
-
if (typeof value === "number" && Object.is(value, -0)) {
|
|
53
|
-
return 0;
|
|
54
|
-
}
|
|
55
|
-
return value;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Helper method to simulate $all operator using $and + $eq when needed.
|
|
59
|
-
* Some vector stores don't support $all natively.
|
|
60
|
-
*/
|
|
61
|
-
simulateAllOperator(field, values) {
|
|
62
|
-
return {
|
|
63
|
-
$and: values.map((value) => ({
|
|
64
|
-
[field]: {
|
|
65
|
-
$in: [
|
|
66
|
-
this.normalizeComparisonValue(value)
|
|
67
|
-
]
|
|
68
|
-
}
|
|
69
|
-
}))
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Utility functions for type checking
|
|
74
|
-
*/
|
|
75
|
-
isPrimitive(value) {
|
|
76
|
-
return value === null || value === undefined || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
77
|
-
}
|
|
78
|
-
isRegex(value) {
|
|
79
|
-
return value instanceof RegExp;
|
|
80
|
-
}
|
|
81
|
-
isEmpty(obj) {
|
|
82
|
-
return obj === null || obj === undefined || typeof obj === "object" && Object.keys(obj).length === 0;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Helper to handle array value normalization consistently
|
|
86
|
-
*/
|
|
87
|
-
normalizeArrayValues(values) {
|
|
88
|
-
return values.map((value) => this.normalizeComparisonValue(value));
|
|
89
|
-
}
|
|
90
|
-
validateFilter(filter) {
|
|
91
|
-
const validation = this.validateFilterSupport(filter);
|
|
92
|
-
if (!validation.supported) {
|
|
93
|
-
throw new Error(validation.messages.join(", "));
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Validates if a filter structure is supported by the specific vector DB
|
|
98
|
-
* and returns detailed validation information.
|
|
99
|
-
*/
|
|
100
|
-
validateFilterSupport(node, path = "") {
|
|
101
|
-
const messages = [];
|
|
102
|
-
if (this.isPrimitive(node) || this.isEmpty(node)) {
|
|
103
|
-
return {
|
|
104
|
-
supported: true,
|
|
105
|
-
messages: []
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
if (Array.isArray(node)) {
|
|
109
|
-
const arrayResults = node.map((item) => this.validateFilterSupport(item, path));
|
|
110
|
-
const arrayMessages = arrayResults.flatMap((r) => r.messages);
|
|
111
|
-
return {
|
|
112
|
-
supported: arrayResults.every((r) => r.supported),
|
|
113
|
-
messages: arrayMessages
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
const nodeObj = node;
|
|
117
|
-
let isSupported = true;
|
|
118
|
-
for (const [key, value] of Object.entries(nodeObj)) {
|
|
119
|
-
const newPath = path ? `${path}.${key}` : key;
|
|
120
|
-
if (this.isOperator(key)) {
|
|
121
|
-
if (!this.isValidOperator(key)) {
|
|
122
|
-
isSupported = false;
|
|
123
|
-
messages.push(_a.ErrorMessages.UNSUPPORTED_OPERATOR(key));
|
|
124
|
-
continue;
|
|
125
|
-
}
|
|
126
|
-
if (!path && !this.isLogicalOperator(key)) {
|
|
127
|
-
isSupported = false;
|
|
128
|
-
messages.push(_a.ErrorMessages.INVALID_TOP_LEVEL_OPERATOR(key));
|
|
129
|
-
continue;
|
|
130
|
-
}
|
|
131
|
-
if (key === "$elemMatch" && (typeof value !== "object" || Array.isArray(value))) {
|
|
132
|
-
isSupported = false;
|
|
133
|
-
messages.push(_a.ErrorMessages.ELEM_MATCH_REQUIRES_OBJECT);
|
|
134
|
-
continue;
|
|
135
|
-
}
|
|
136
|
-
if (this.isLogicalOperator(key)) {
|
|
137
|
-
if (key === "$not") {
|
|
138
|
-
if (Array.isArray(value) || typeof value !== "object") {
|
|
139
|
-
isSupported = false;
|
|
140
|
-
messages.push(_a.ErrorMessages.NOT_REQUIRES_OBJECT);
|
|
141
|
-
continue;
|
|
142
|
-
}
|
|
143
|
-
if (this.isEmpty(value)) {
|
|
144
|
-
isSupported = false;
|
|
145
|
-
messages.push(_a.ErrorMessages.NOT_CANNOT_BE_EMPTY);
|
|
146
|
-
continue;
|
|
147
|
-
}
|
|
148
|
-
continue;
|
|
149
|
-
}
|
|
150
|
-
if (path && !this.isLogicalOperator(path.split(".").pop())) {
|
|
151
|
-
isSupported = false;
|
|
152
|
-
messages.push(_a.ErrorMessages.INVALID_LOGICAL_OPERATOR_LOCATION(key, newPath));
|
|
153
|
-
continue;
|
|
154
|
-
}
|
|
155
|
-
if (Array.isArray(value)) {
|
|
156
|
-
const hasDirectOperators = value.some((item) => typeof item === "object" && Object.keys(item).length === 1 && this.isFieldOperator(Object.keys(item)[0]));
|
|
157
|
-
if (hasDirectOperators) {
|
|
158
|
-
isSupported = false;
|
|
159
|
-
messages.push(_a.ErrorMessages.INVALID_LOGICAL_OPERATOR_CONTENT(newPath));
|
|
160
|
-
continue;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
const nestedValidation = this.validateFilterSupport(value, newPath);
|
|
166
|
-
if (!nestedValidation.supported) {
|
|
167
|
-
isSupported = false;
|
|
168
|
-
messages.push(...nestedValidation.messages);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
return {
|
|
172
|
-
supported: isSupported,
|
|
173
|
-
messages
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
}, __name(_a, "BaseFilterTranslator"), __publicField(_a, "BASIC_OPERATORS", [
|
|
177
|
-
"$eq",
|
|
178
|
-
"$ne"
|
|
179
|
-
]), __publicField(_a, "NUMERIC_OPERATORS", [
|
|
180
|
-
"$gt",
|
|
181
|
-
"$gte",
|
|
182
|
-
"$lt",
|
|
183
|
-
"$lte"
|
|
184
|
-
]), __publicField(_a, "ARRAY_OPERATORS", [
|
|
185
|
-
"$in",
|
|
186
|
-
"$nin",
|
|
187
|
-
"$all",
|
|
188
|
-
"$elemMatch"
|
|
189
|
-
]), __publicField(_a, "LOGICAL_OPERATORS", [
|
|
190
|
-
"$and",
|
|
191
|
-
"$or",
|
|
192
|
-
"$not",
|
|
193
|
-
"$nor"
|
|
194
|
-
]), __publicField(_a, "ELEMENT_OPERATORS", [
|
|
195
|
-
"$exists"
|
|
196
|
-
]), __publicField(_a, "REGEX_OPERATORS", [
|
|
197
|
-
"$regex",
|
|
198
|
-
"$options"
|
|
199
|
-
]), __publicField(_a, "DEFAULT_OPERATORS", {
|
|
200
|
-
logical: _a.LOGICAL_OPERATORS,
|
|
201
|
-
basic: _a.BASIC_OPERATORS,
|
|
202
|
-
numeric: _a.NUMERIC_OPERATORS,
|
|
203
|
-
array: _a.ARRAY_OPERATORS,
|
|
204
|
-
element: _a.ELEMENT_OPERATORS,
|
|
205
|
-
regex: _a.REGEX_OPERATORS
|
|
206
|
-
}), __publicField(_a, "ErrorMessages", {
|
|
207
|
-
UNSUPPORTED_OPERATOR: /* @__PURE__ */ __name((op) => `Unsupported operator: ${op}`, "UNSUPPORTED_OPERATOR"),
|
|
208
|
-
INVALID_LOGICAL_OPERATOR_LOCATION: /* @__PURE__ */ __name((op, path) => `Logical operator ${op} cannot be used at field level: ${path}`, "INVALID_LOGICAL_OPERATOR_LOCATION"),
|
|
209
|
-
NOT_REQUIRES_OBJECT: `$not operator requires an object`,
|
|
210
|
-
NOT_CANNOT_BE_EMPTY: `$not operator cannot be empty`,
|
|
211
|
-
INVALID_LOGICAL_OPERATOR_CONTENT: /* @__PURE__ */ __name((path) => `Logical operators must contain field conditions, not direct operators: ${path}`, "INVALID_LOGICAL_OPERATOR_CONTENT"),
|
|
212
|
-
INVALID_TOP_LEVEL_OPERATOR: /* @__PURE__ */ __name((op) => `Invalid top-level operator: ${op}`, "INVALID_TOP_LEVEL_OPERATOR"),
|
|
213
|
-
ELEM_MATCH_REQUIRES_OBJECT: `$elemMatch requires an object with conditions`
|
|
214
|
-
}), _a);
|
|
215
|
-
|
|
216
|
-
export { BaseFilterTranslator };
|