@mastra/core 0.4.3 → 0.4.4
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/index.d.cts
CHANGED
|
@@ -18,7 +18,7 @@ export { createTool } from './tools/index.cjs';
|
|
|
18
18
|
import { MastraTTS as MastraTTS$1, TTSConfig } from './tts/index.cjs';
|
|
19
19
|
export { TagMaskOptions, deepMerge, delay, jsonSchemaPropertiesToTSTypes, jsonSchemaToModel, maskStreamTags } from './utils.cjs';
|
|
20
20
|
import { MastraVector as MastraVector$1 } from './vector/index.cjs';
|
|
21
|
-
export { CreateIndexParams, IndexStats, ParamsToArgs, QueryResult, QueryVectorParams, UpsertVectorParams } from './vector/index.cjs';
|
|
21
|
+
export { CreateIndexArgs, CreateIndexParams, IndexStats, ParamsToArgs, QueryResult, QueryVectorArgs, QueryVectorParams, UpsertVectorArgs, UpsertVectorParams } from './vector/index.cjs';
|
|
22
22
|
import { S as Step, W as Workflow$1 } from './workflow-DlRFMI4Q.cjs';
|
|
23
23
|
export { c as createStep } from './workflow-DlRFMI4Q.cjs';
|
|
24
24
|
export { getActivePathsAndStatus, getResultActivePaths, getStepResult, getSuspendedPaths, isErrorEvent, isFinalState, isTransitionEvent, isVariableReference, mergeChildValue, recursivelyCheckForFinalState, updateStepInHierarchy } from './workflows/index.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export { createTool } from './tools/index.js';
|
|
|
18
18
|
import { MastraTTS as MastraTTS$1, TTSConfig } from './tts/index.js';
|
|
19
19
|
export { TagMaskOptions, deepMerge, delay, jsonSchemaPropertiesToTSTypes, jsonSchemaToModel, maskStreamTags } from './utils.js';
|
|
20
20
|
import { MastraVector as MastraVector$1 } from './vector/index.js';
|
|
21
|
-
export { CreateIndexParams, IndexStats, ParamsToArgs, QueryResult, QueryVectorParams, UpsertVectorParams } from './vector/index.js';
|
|
21
|
+
export { CreateIndexArgs, CreateIndexParams, IndexStats, ParamsToArgs, QueryResult, QueryVectorArgs, QueryVectorParams, UpsertVectorArgs, UpsertVectorParams } from './vector/index.js';
|
|
22
22
|
import { S as Step, W as Workflow$1 } from './workflow-fGgxPZk4.js';
|
|
23
23
|
export { c as createStep } from './workflow-fGgxPZk4.js';
|
|
24
24
|
export { getActivePathsAndStatus, getResultActivePaths, getStepResult, getSuspendedPaths, isErrorEvent, isFinalState, isTransitionEvent, isVariableReference, mergeChildValue, recursivelyCheckForFinalState, updateStepInHierarchy } from './workflows/index.js';
|
package/dist/vector/index.d.cts
CHANGED
|
@@ -29,11 +29,13 @@ interface UpsertVectorParams {
|
|
|
29
29
|
metadata?: Record<string, any>[];
|
|
30
30
|
ids?: string[];
|
|
31
31
|
}
|
|
32
|
+
type UpsertVectorArgs = [string, number[][], Record<string, any>[], string[]?];
|
|
32
33
|
interface CreateIndexParams {
|
|
33
34
|
indexName: string;
|
|
34
35
|
dimension: number;
|
|
35
36
|
metric?: 'cosine' | 'euclidean' | 'dotproduct';
|
|
36
37
|
}
|
|
38
|
+
type CreateIndexArgs = [string, number, 'cosine' | 'euclidean' | 'dotproduct'];
|
|
37
39
|
interface QueryVectorParams {
|
|
38
40
|
indexName: string;
|
|
39
41
|
queryVector: number[];
|
|
@@ -41,18 +43,19 @@ interface QueryVectorParams {
|
|
|
41
43
|
filter?: VectorFilter;
|
|
42
44
|
includeVector?: boolean;
|
|
43
45
|
}
|
|
44
|
-
type
|
|
46
|
+
type QueryVectorArgs = [string, number[], number, VectorFilter?, boolean?];
|
|
47
|
+
type ParamsToArgs<T> = [T] | (T extends QueryVectorParams ? QueryVectorArgs : never) | (T extends UpsertVectorParams ? UpsertVectorArgs : never) | (T extends CreateIndexParams ? CreateIndexArgs : never);
|
|
45
48
|
|
|
46
49
|
declare abstract class MastraVector extends MastraBase {
|
|
47
50
|
constructor();
|
|
48
51
|
private readonly baseKeys;
|
|
49
|
-
protected normalizeArgs<T>(method: string, [first, ...rest]: ParamsToArgs<T
|
|
50
|
-
abstract query(...args: ParamsToArgs<QueryVectorParams>): Promise<QueryResult[]>;
|
|
51
|
-
abstract upsert(...args: ParamsToArgs<UpsertVectorParams>): Promise<string[]>;
|
|
52
|
-
abstract createIndex(...args: ParamsToArgs<CreateIndexParams>): Promise<void>;
|
|
52
|
+
protected normalizeArgs<T, E extends any[] = never>(method: string, [first, ...rest]: ParamsToArgs<T> | E, extendedKeys?: string[]): T;
|
|
53
|
+
abstract query<E extends QueryVectorArgs = QueryVectorArgs>(...args: ParamsToArgs<QueryVectorParams> | E): Promise<QueryResult[]>;
|
|
54
|
+
abstract upsert<E extends UpsertVectorArgs = UpsertVectorArgs>(...args: ParamsToArgs<UpsertVectorParams> | E): Promise<string[]>;
|
|
55
|
+
abstract createIndex<E extends CreateIndexArgs = CreateIndexArgs>(...args: ParamsToArgs<CreateIndexParams> | E): Promise<void>;
|
|
53
56
|
abstract listIndexes(): Promise<string[]>;
|
|
54
57
|
abstract describeIndex(indexName: string): Promise<IndexStats>;
|
|
55
58
|
abstract deleteIndex(indexName: string): Promise<void>;
|
|
56
59
|
}
|
|
57
60
|
|
|
58
|
-
export { type CreateIndexParams, type IndexStats, MastraVector, type ParamsToArgs, type QueryResult, type QueryVectorParams, type UpsertVectorParams };
|
|
61
|
+
export { type CreateIndexArgs, type CreateIndexParams, type IndexStats, MastraVector, type ParamsToArgs, type QueryResult, type QueryVectorArgs, type QueryVectorParams, type UpsertVectorArgs, type UpsertVectorParams };
|
package/dist/vector/index.d.ts
CHANGED
|
@@ -29,11 +29,13 @@ interface UpsertVectorParams {
|
|
|
29
29
|
metadata?: Record<string, any>[];
|
|
30
30
|
ids?: string[];
|
|
31
31
|
}
|
|
32
|
+
type UpsertVectorArgs = [string, number[][], Record<string, any>[], string[]?];
|
|
32
33
|
interface CreateIndexParams {
|
|
33
34
|
indexName: string;
|
|
34
35
|
dimension: number;
|
|
35
36
|
metric?: 'cosine' | 'euclidean' | 'dotproduct';
|
|
36
37
|
}
|
|
38
|
+
type CreateIndexArgs = [string, number, 'cosine' | 'euclidean' | 'dotproduct'];
|
|
37
39
|
interface QueryVectorParams {
|
|
38
40
|
indexName: string;
|
|
39
41
|
queryVector: number[];
|
|
@@ -41,18 +43,19 @@ interface QueryVectorParams {
|
|
|
41
43
|
filter?: VectorFilter;
|
|
42
44
|
includeVector?: boolean;
|
|
43
45
|
}
|
|
44
|
-
type
|
|
46
|
+
type QueryVectorArgs = [string, number[], number, VectorFilter?, boolean?];
|
|
47
|
+
type ParamsToArgs<T> = [T] | (T extends QueryVectorParams ? QueryVectorArgs : never) | (T extends UpsertVectorParams ? UpsertVectorArgs : never) | (T extends CreateIndexParams ? CreateIndexArgs : never);
|
|
45
48
|
|
|
46
49
|
declare abstract class MastraVector extends MastraBase {
|
|
47
50
|
constructor();
|
|
48
51
|
private readonly baseKeys;
|
|
49
|
-
protected normalizeArgs<T>(method: string, [first, ...rest]: ParamsToArgs<T
|
|
50
|
-
abstract query(...args: ParamsToArgs<QueryVectorParams>): Promise<QueryResult[]>;
|
|
51
|
-
abstract upsert(...args: ParamsToArgs<UpsertVectorParams>): Promise<string[]>;
|
|
52
|
-
abstract createIndex(...args: ParamsToArgs<CreateIndexParams>): Promise<void>;
|
|
52
|
+
protected normalizeArgs<T, E extends any[] = never>(method: string, [first, ...rest]: ParamsToArgs<T> | E, extendedKeys?: string[]): T;
|
|
53
|
+
abstract query<E extends QueryVectorArgs = QueryVectorArgs>(...args: ParamsToArgs<QueryVectorParams> | E): Promise<QueryResult[]>;
|
|
54
|
+
abstract upsert<E extends UpsertVectorArgs = UpsertVectorArgs>(...args: ParamsToArgs<UpsertVectorParams> | E): Promise<string[]>;
|
|
55
|
+
abstract createIndex<E extends CreateIndexArgs = CreateIndexArgs>(...args: ParamsToArgs<CreateIndexParams> | E): Promise<void>;
|
|
53
56
|
abstract listIndexes(): Promise<string[]>;
|
|
54
57
|
abstract describeIndex(indexName: string): Promise<IndexStats>;
|
|
55
58
|
abstract deleteIndex(indexName: string): Promise<void>;
|
|
56
59
|
}
|
|
57
60
|
|
|
58
|
-
export { type CreateIndexParams, type IndexStats, MastraVector, type ParamsToArgs, type QueryResult, type QueryVectorParams, type UpsertVectorParams };
|
|
61
|
+
export { type CreateIndexArgs, type CreateIndexParams, type IndexStats, MastraVector, type ParamsToArgs, type QueryResult, type QueryVectorArgs, type QueryVectorParams, type UpsertVectorArgs, type UpsertVectorParams };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VectorFilter } from '../filter/index.cjs';
|
|
2
|
-
import { MastraVector, ParamsToArgs, QueryVectorParams, QueryResult, UpsertVectorParams, CreateIndexParams, IndexStats } from '../index.cjs';
|
|
2
|
+
import { MastraVector, ParamsToArgs, QueryVectorParams, QueryVectorArgs, QueryResult, UpsertVectorParams, CreateIndexParams, IndexStats } from '../index.cjs';
|
|
3
3
|
import '../../base-hs9NDAZ2.cjs';
|
|
4
4
|
import '@opentelemetry/api';
|
|
5
5
|
import '../../index-mKY1XrpK.cjs';
|
|
@@ -10,6 +10,7 @@ import '@opentelemetry/sdk-trace-base';
|
|
|
10
10
|
interface LibSQLQueryParams extends QueryVectorParams {
|
|
11
11
|
minScore?: number;
|
|
12
12
|
}
|
|
13
|
+
type LibSQLQueryArgs = [...QueryVectorArgs, number?];
|
|
13
14
|
declare class LibSQLVector extends MastraVector {
|
|
14
15
|
private turso;
|
|
15
16
|
constructor({ connectionUrl, authToken, syncUrl, syncInterval, }: {
|
|
@@ -20,7 +21,7 @@ declare class LibSQLVector extends MastraVector {
|
|
|
20
21
|
});
|
|
21
22
|
protected rewriteDbUrl(url: string): string;
|
|
22
23
|
transformFilter(filter?: VectorFilter): VectorFilter;
|
|
23
|
-
query(...args: ParamsToArgs<LibSQLQueryParams>): Promise<QueryResult[]>;
|
|
24
|
+
query(...args: ParamsToArgs<LibSQLQueryParams> | LibSQLQueryArgs): Promise<QueryResult[]>;
|
|
24
25
|
upsert(...args: ParamsToArgs<UpsertVectorParams>): Promise<string[]>;
|
|
25
26
|
createIndex(...args: ParamsToArgs<CreateIndexParams>): Promise<void>;
|
|
26
27
|
deleteIndex(indexName: string): Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VectorFilter } from '../filter/index.js';
|
|
2
|
-
import { MastraVector, ParamsToArgs, QueryVectorParams, QueryResult, UpsertVectorParams, CreateIndexParams, IndexStats } from '../index.js';
|
|
2
|
+
import { MastraVector, ParamsToArgs, QueryVectorParams, QueryVectorArgs, QueryResult, UpsertVectorParams, CreateIndexParams, IndexStats } from '../index.js';
|
|
3
3
|
import '../../base-D90KQ4XI.js';
|
|
4
4
|
import '@opentelemetry/api';
|
|
5
5
|
import '../../index-mKY1XrpK.js';
|
|
@@ -10,6 +10,7 @@ import '@opentelemetry/sdk-trace-base';
|
|
|
10
10
|
interface LibSQLQueryParams extends QueryVectorParams {
|
|
11
11
|
minScore?: number;
|
|
12
12
|
}
|
|
13
|
+
type LibSQLQueryArgs = [...QueryVectorArgs, number?];
|
|
13
14
|
declare class LibSQLVector extends MastraVector {
|
|
14
15
|
private turso;
|
|
15
16
|
constructor({ connectionUrl, authToken, syncUrl, syncInterval, }: {
|
|
@@ -20,7 +21,7 @@ declare class LibSQLVector extends MastraVector {
|
|
|
20
21
|
});
|
|
21
22
|
protected rewriteDbUrl(url: string): string;
|
|
22
23
|
transformFilter(filter?: VectorFilter): VectorFilter;
|
|
23
|
-
query(...args: ParamsToArgs<LibSQLQueryParams>): Promise<QueryResult[]>;
|
|
24
|
+
query(...args: ParamsToArgs<LibSQLQueryParams> | LibSQLQueryArgs): Promise<QueryResult[]>;
|
|
24
25
|
upsert(...args: ParamsToArgs<UpsertVectorParams>): Promise<string[]>;
|
|
25
26
|
createIndex(...args: ParamsToArgs<CreateIndexParams>): Promise<void>;
|
|
26
27
|
deleteIndex(indexName: string): Promise<void>;
|