@mastra/upstash 0.1.6-alpha.0 → 0.1.6-alpha.3

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,18 +1,23 @@
1
1
 
2
- > @mastra/upstash@0.1.6-alpha.0 build /home/runner/work/mastra/mastra/stores/upstash
3
- > tsup src/index.ts --format esm --experimental-dts --clean --treeshake
2
+ > @mastra/upstash@0.1.6-alpha.3 build /home/runner/work/mastra/mastra/stores/upstash
3
+ > tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake
4
4
 
5
5
  CLI Building entry: src/index.ts
6
6
  CLI Using tsconfig: tsconfig.json
7
7
  CLI tsup v8.3.6
8
8
  TSC Build start
9
- TSC ⚡️ Build success in 7747ms
9
+ TSC ⚡️ Build success in 7823ms
10
10
  DTS Build start
11
11
  CLI Target: es2022
12
12
  Analysis will use the bundled TypeScript version 5.7.3
13
13
  Writing package typings: /home/runner/work/mastra/mastra/stores/upstash/dist/_tsup-dts-rollup.d.ts
14
- DTS ⚡️ Build success in 6238ms
14
+ Analysis will use the bundled TypeScript version 5.7.3
15
+ Writing package typings: /home/runner/work/mastra/mastra/stores/upstash/dist/_tsup-dts-rollup.d.cts
16
+ DTS ⚡️ Build success in 10302ms
15
17
  CLI Cleaning output folder
16
18
  ESM Build start
17
- ESM dist/index.js 16.11 KB
18
- ESM ⚡️ Build success in 623ms
19
+ CJS Build start
20
+ CJS dist/index.cjs 16.25 KB
21
+ CJS ⚡️ Build success in 793ms
22
+ ESM dist/index.js 16.12 KB
23
+ ESM ⚡️ Build success in 793ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # @mastra/upstash
2
2
 
3
+ ## 0.1.6-alpha.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 0fd78ac: Update vector store functions to use object params
8
+ - fd14a3f: Updating filter location from @mastra/core/filter to @mastra/core/vector/filter
9
+ - c4fdac3: Updated tests for upstash and astra
10
+ - 4d4e1e1: Updated vector tests and pinecone
11
+ - bb4f447: Add support for commonjs
12
+ - Updated dependencies [0fd78ac]
13
+ - Updated dependencies [0d25b75]
14
+ - Updated dependencies [fd14a3f]
15
+ - Updated dependencies [3f369a2]
16
+ - Updated dependencies [4d4e1e1]
17
+ - Updated dependencies [bb4f447]
18
+ - @mastra/core@0.4.3-alpha.3
19
+
20
+ ## 0.1.6-alpha.2
21
+
22
+ ### Patch Changes
23
+
24
+ - Updated dependencies [2512a93]
25
+ - Updated dependencies [e62de74]
26
+ - @mastra/core@0.4.3-alpha.2
27
+
28
+ ## 0.1.6-alpha.1
29
+
30
+ ### Patch Changes
31
+
32
+ - Updated dependencies [0d185b1]
33
+ - Updated dependencies [ed55f1d]
34
+ - Updated dependencies [8d13b14]
35
+ - Updated dependencies [3ee4831]
36
+ - Updated dependencies [108793c]
37
+ - Updated dependencies [5f28f44]
38
+ - @mastra/core@0.4.3-alpha.1
39
+
3
40
  ## 0.1.6-alpha.0
4
41
 
5
42
  ### Patch Changes
package/README.md CHANGED
@@ -14,7 +14,26 @@ npm install @mastra/upstash
14
14
  import { UpstashVector } from '@mastra/upstash';
15
15
 
16
16
  const vectorStore = new UpstashVector({
17
- // configuration options
17
+ url: process.env.UPSTASH_VECTOR_REST_URL,
18
+ token: process.env.UPSTASH_VECTOR_TOKEN
19
+ });
20
+
21
+ // Add vectors
22
+ const vectors = [[0.1, 0.2, ...], [0.3, 0.4, ...]];
23
+ const metadata = [{ text: 'doc1' }, { text: 'doc2' }];
24
+ const ids = await vectorStore.upsert({
25
+ indexName: 'my-namespace',
26
+ vectors,
27
+ metadata
28
+ });
29
+
30
+ // Query vectors
31
+ const results = await vectorStore.query({
32
+ indexName: 'my-namespace',
33
+ queryVector: [0.1, 0.2, ...],
34
+ topK: 10,
35
+ filter: { text: { $eq: 'doc1' } },
36
+ includeVector: false
18
37
  });
19
38
  ```
20
39
 
@@ -0,0 +1,133 @@
1
+ import { BaseFilterTranslator } from '@mastra/core/vector/filter';
2
+ import type { CreateIndexParams } from '@mastra/core/vector';
3
+ import type { EvalRow } from '@mastra/core/storage';
4
+ import { MastraStorage } from '@mastra/core/storage';
5
+ import { MastraVector } from '@mastra/core/vector';
6
+ import type { MessageType } from '@mastra/core/memory';
7
+ import type { OperatorSupport } from '@mastra/core/vector/filter';
8
+ import type { ParamsToArgs } from '@mastra/core/vector';
9
+ import type { QueryResult } from '@mastra/core/vector';
10
+ import type { QueryVectorParams } from '@mastra/core/vector';
11
+ import type { StorageColumn } from '@mastra/core/storage';
12
+ import type { StorageGetMessagesArg } from '@mastra/core/storage';
13
+ import type { StorageThreadType } from '@mastra/core/memory';
14
+ import type { TABLE_NAMES } from '@mastra/core/storage';
15
+ import type { UpsertVectorParams } from '@mastra/core/vector';
16
+ import type { VectorFilter } from '@mastra/core/vector/filter';
17
+ import type { WorkflowRunState } from '@mastra/core/workflows';
18
+
19
+ declare interface UpstashConfig {
20
+ url: string;
21
+ token: string;
22
+ }
23
+ export { UpstashConfig }
24
+ export { UpstashConfig as UpstashConfig_alias_1 }
25
+
26
+ export declare class UpstashFilterTranslator extends BaseFilterTranslator {
27
+ protected getSupportedOperators(): OperatorSupport;
28
+ translate(filter?: VectorFilter): string | undefined;
29
+ private translateNode;
30
+ private readonly COMPARISON_OPS;
31
+ private translateOperator;
32
+ private readonly NEGATED_OPERATORS;
33
+ private formatNot;
34
+ private formatValue;
35
+ private formatArray;
36
+ private formatComparison;
37
+ private joinConditions;
38
+ }
39
+
40
+ declare class UpstashStore extends MastraStorage {
41
+ batchInsert(_input: {
42
+ tableName: TABLE_NAMES;
43
+ records: Record<string, any>[];
44
+ }): Promise<void>;
45
+ getEvalsByAgentName(_agentName: string, _type?: 'test' | 'live'): Promise<EvalRow[]>;
46
+ getTraces(_input: {
47
+ name?: string;
48
+ scope?: string;
49
+ page: number;
50
+ perPage: number;
51
+ attributes?: Record<string, string>;
52
+ }): Promise<any[]>;
53
+ private redis;
54
+ constructor(config: UpstashConfig);
55
+ private getKey;
56
+ private ensureDate;
57
+ private serializeDate;
58
+ createTable({ tableName, schema, }: {
59
+ tableName: TABLE_NAMES;
60
+ schema: Record<string, StorageColumn>;
61
+ }): Promise<void>;
62
+ clearTable({ tableName }: {
63
+ tableName: TABLE_NAMES;
64
+ }): Promise<void>;
65
+ insert({ tableName, record }: {
66
+ tableName: TABLE_NAMES;
67
+ record: Record<string, any>;
68
+ }): Promise<void>;
69
+ load<R>({ tableName, keys }: {
70
+ tableName: TABLE_NAMES;
71
+ keys: Record<string, string>;
72
+ }): Promise<R | null>;
73
+ getThreadById({ threadId }: {
74
+ threadId: string;
75
+ }): Promise<StorageThreadType | null>;
76
+ getThreadsByResourceId({ resourceId }: {
77
+ resourceId: string;
78
+ }): Promise<StorageThreadType[]>;
79
+ saveThread({ thread }: {
80
+ thread: StorageThreadType;
81
+ }): Promise<StorageThreadType>;
82
+ updateThread({ id, title, metadata, }: {
83
+ id: string;
84
+ title: string;
85
+ metadata: Record<string, unknown>;
86
+ }): Promise<StorageThreadType>;
87
+ deleteThread({ threadId }: {
88
+ threadId: string;
89
+ }): Promise<void>;
90
+ private getMessageKey;
91
+ private getThreadMessagesKey;
92
+ saveMessages({ messages }: {
93
+ messages: MessageType[];
94
+ }): Promise<MessageType[]>;
95
+ getMessages<T = unknown>({ threadId, selectBy }: StorageGetMessagesArg): Promise<T[]>;
96
+ persistWorkflowSnapshot(params: {
97
+ namespace: string;
98
+ workflowName: string;
99
+ runId: string;
100
+ snapshot: WorkflowRunState;
101
+ }): Promise<void>;
102
+ loadWorkflowSnapshot(params: {
103
+ namespace: string;
104
+ workflowName: string;
105
+ runId: string;
106
+ }): Promise<WorkflowRunState | null>;
107
+ close(): Promise<void>;
108
+ }
109
+ export { UpstashStore }
110
+ export { UpstashStore as UpstashStore_alias_1 }
111
+
112
+ declare class UpstashVector extends MastraVector {
113
+ private client;
114
+ constructor({ url, token }: {
115
+ url: string;
116
+ token: string;
117
+ });
118
+ upsert(...args: ParamsToArgs<UpsertVectorParams>): Promise<string[]>;
119
+ transformFilter(filter?: VectorFilter): string | undefined;
120
+ createIndex(..._args: ParamsToArgs<CreateIndexParams>): Promise<void>;
121
+ query(...args: ParamsToArgs<QueryVectorParams>): Promise<QueryResult[]>;
122
+ listIndexes(): Promise<string[]>;
123
+ describeIndex(indexName: string): Promise<{
124
+ dimension: number;
125
+ count: number;
126
+ metric: "cosine" | "euclidean" | "dotproduct";
127
+ }>;
128
+ deleteIndex(indexName: string): Promise<void>;
129
+ }
130
+ export { UpstashVector }
131
+ export { UpstashVector as UpstashVector_alias_1 }
132
+
133
+ export { }
@@ -1,16 +1,20 @@
1
- import { BaseFilterTranslator } from '@mastra/core/filter';
2
- import { EvalRow } from '@mastra/core/storage';
3
- import { Filter } from '@mastra/core/filter';
1
+ import { BaseFilterTranslator } from '@mastra/core/vector/filter';
2
+ import type { CreateIndexParams } from '@mastra/core/vector';
3
+ import type { EvalRow } from '@mastra/core/storage';
4
4
  import { MastraStorage } from '@mastra/core/storage';
5
5
  import { MastraVector } from '@mastra/core/vector';
6
- import { MessageType } from '@mastra/core/memory';
7
- import { OperatorSupport } from '@mastra/core/filter';
6
+ import type { MessageType } from '@mastra/core/memory';
7
+ import type { OperatorSupport } from '@mastra/core/vector/filter';
8
+ import type { ParamsToArgs } from '@mastra/core/vector';
8
9
  import type { QueryResult } from '@mastra/core/vector';
9
- import { StorageColumn } from '@mastra/core/storage';
10
- import { StorageGetMessagesArg } from '@mastra/core/storage';
11
- import { StorageThreadType } from '@mastra/core/memory';
12
- import { TABLE_NAMES } from '@mastra/core/storage';
13
- import { WorkflowRunState } from '@mastra/core/workflows';
10
+ import type { QueryVectorParams } from '@mastra/core/vector';
11
+ import type { StorageColumn } from '@mastra/core/storage';
12
+ import type { StorageGetMessagesArg } from '@mastra/core/storage';
13
+ import type { StorageThreadType } from '@mastra/core/memory';
14
+ import type { TABLE_NAMES } from '@mastra/core/storage';
15
+ import type { UpsertVectorParams } from '@mastra/core/vector';
16
+ import type { VectorFilter } from '@mastra/core/vector/filter';
17
+ import type { WorkflowRunState } from '@mastra/core/workflows';
14
18
 
15
19
  declare interface UpstashConfig {
16
20
  url: string;
@@ -21,7 +25,7 @@ export { UpstashConfig as UpstashConfig_alias_1 }
21
25
 
22
26
  export declare class UpstashFilterTranslator extends BaseFilterTranslator {
23
27
  protected getSupportedOperators(): OperatorSupport;
24
- translate(filter?: Filter): string | undefined;
28
+ translate(filter?: VectorFilter): string | undefined;
25
29
  private translateNode;
26
30
  private readonly COMPARISON_OPS;
27
31
  private translateOperator;
@@ -34,12 +38,12 @@ export declare class UpstashFilterTranslator extends BaseFilterTranslator {
34
38
  }
35
39
 
36
40
  declare class UpstashStore extends MastraStorage {
37
- batchInsert({ tableName, records }: {
41
+ batchInsert(_input: {
38
42
  tableName: TABLE_NAMES;
39
43
  records: Record<string, any>[];
40
44
  }): Promise<void>;
41
- getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
42
- getTraces({ name, scope, page, perPage, attributes, }: {
45
+ getEvalsByAgentName(_agentName: string, _type?: 'test' | 'live'): Promise<EvalRow[]>;
46
+ getTraces(_input: {
43
47
  name?: string;
44
48
  scope?: string;
45
49
  page: number;
@@ -111,10 +115,10 @@ declare class UpstashVector extends MastraVector {
111
115
  url: string;
112
116
  token: string;
113
117
  });
114
- upsert(indexName: string, vectors: number[][], metadata?: Record<string, any>[], ids?: string[]): Promise<string[]>;
115
- transformFilter(filter?: Filter): string | undefined;
116
- createIndex(_indexName: string, _dimension: number, _metric?: 'cosine' | 'euclidean' | 'dotproduct'): Promise<void>;
117
- query(indexName: string, queryVector: number[], topK?: number, filter?: Filter, includeVector?: boolean): Promise<QueryResult[]>;
118
+ upsert(...args: ParamsToArgs<UpsertVectorParams>): Promise<string[]>;
119
+ transformFilter(filter?: VectorFilter): string | undefined;
120
+ createIndex(..._args: ParamsToArgs<CreateIndexParams>): Promise<void>;
121
+ query(...args: ParamsToArgs<QueryVectorParams>): Promise<QueryResult[]>;
118
122
  listIndexes(): Promise<string[]>;
119
123
  describeIndex(indexName: string): Promise<{
120
124
  dimension: number;