@mastra/upstash 0.11.1-alpha.0 → 0.11.1-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.
@@ -1,23 +1,23 @@
1
1
 
2
- > @mastra/upstash@0.11.1-alpha.0 build /home/runner/work/mastra/mastra/stores/upstash
2
+ > @mastra/upstash@0.11.1-alpha.2 build /home/runner/work/mastra/mastra/stores/upstash
3
3
  > tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting
4
4
 
5
5
  CLI Building entry: src/index.ts
6
6
  CLI Using tsconfig: tsconfig.json
7
7
  CLI tsup v8.5.0
8
8
  TSC Build start
9
- TSC ⚡️ Build success in 10527ms
9
+ TSC ⚡️ Build success in 9310ms
10
10
  DTS Build start
11
11
  CLI Target: es2022
12
12
  Analysis will use the bundled TypeScript version 5.8.3
13
13
  Writing package typings: /home/runner/work/mastra/mastra/stores/upstash/dist/_tsup-dts-rollup.d.ts
14
14
  Analysis will use the bundled TypeScript version 5.8.3
15
15
  Writing package typings: /home/runner/work/mastra/mastra/stores/upstash/dist/_tsup-dts-rollup.d.cts
16
- DTS ⚡️ Build success in 10301ms
16
+ DTS ⚡️ Build success in 12483ms
17
17
  CLI Cleaning output folder
18
18
  ESM Build start
19
19
  CJS Build start
20
- ESM dist/index.js 45.19 KB
21
- ESM ⚡️ Build success in 1620ms
22
- CJS dist/index.cjs 45.36 KB
23
- CJS ⚡️ Build success in 1619ms
20
+ ESM dist/index.js 58.11 KB
21
+ ESM ⚡️ Build success in 1435ms
22
+ CJS dist/index.cjs 58.93 KB
23
+ CJS ⚡️ Build success in 1435ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @mastra/upstash
2
2
 
3
+ ## 0.11.1-alpha.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 15e9d26: Added per-resource working memory for LibSQL, Upstash, and PG
8
+ - 0fb9d64: [MASTRA-4018] Update saveMessages in storage adapters to upsert messages
9
+ - Updated dependencies [15e9d26]
10
+ - Updated dependencies [07d6d88]
11
+ - Updated dependencies [5d74aab]
12
+ - Updated dependencies [144eb0b]
13
+ - @mastra/core@0.10.7-alpha.2
14
+
15
+ ## 0.11.1-alpha.1
16
+
17
+ ### Patch Changes
18
+
19
+ - 2097952: [MASTRA-4021] Fix PG getMessages and update messageLimit for all storage adapters
20
+ - 0e17048: Throw mastra errors in storage packages
21
+ - Updated dependencies [d1baedb]
22
+ - Updated dependencies [4d21bf2]
23
+ - Updated dependencies [2097952]
24
+ - Updated dependencies [4fb0cc2]
25
+ - Updated dependencies [d2a7a31]
26
+ - Updated dependencies [0e17048]
27
+ - @mastra/core@0.10.7-alpha.1
28
+
3
29
  ## 0.11.1-alpha.0
4
30
 
5
31
  ### Patch Changes
@@ -11,6 +11,7 @@ import type { MastraMessageV2 } from '@mastra/core/agent';
11
11
  import { MastraStorage } from '@mastra/core/storage';
12
12
  import { MastraVector } from '@mastra/core/vector';
13
13
  import type { OperatorSupport } from '@mastra/core/vector/filter';
14
+ import type { OperatorValueMap } from '@mastra/core/vector/filter';
14
15
  import type { PaginationArgs } from '@mastra/core/storage';
15
16
  import type { PaginationInfo } from '@mastra/core/storage';
16
17
  import type { QueryResult } from '@mastra/core/vector';
@@ -18,6 +19,7 @@ import type { QueryVectorParams } from '@mastra/core/vector';
18
19
  import type { StorageColumn } from '@mastra/core/storage';
19
20
  import type { StorageGetMessagesArg } from '@mastra/core/storage';
20
21
  import type { StorageGetTracesArg } from '@mastra/core/storage';
22
+ import type { StorageResourceType } from '@mastra/core/storage';
21
23
  import type { StorageThreadType } from '@mastra/core/memory';
22
24
  import type { TABLE_NAMES } from '@mastra/core/storage';
23
25
  import type { UpdateVectorParams } from '@mastra/core/vector';
@@ -42,9 +44,9 @@ declare interface UpstashConfig {
42
44
  export { UpstashConfig }
43
45
  export { UpstashConfig as UpstashConfig_alias_1 }
44
46
 
45
- export declare class UpstashFilterTranslator extends BaseFilterTranslator {
47
+ export declare class UpstashFilterTranslator extends BaseFilterTranslator<UpstashVectorFilter, string | undefined> {
46
48
  protected getSupportedOperators(): OperatorSupport;
47
- translate(filter?: VectorFilter): string | undefined;
49
+ translate(filter?: UpstashVectorFilter): string | undefined;
48
50
  private translateNode;
49
51
  private readonly COMPARISON_OPS;
50
52
  private translateOperator;
@@ -56,11 +58,18 @@ export declare class UpstashFilterTranslator extends BaseFilterTranslator {
56
58
  private joinConditions;
57
59
  }
58
60
 
61
+ declare type UpstashOperatorValueMap = Omit<OperatorValueMap, '$options' | '$elemMatch'> & {
62
+ $contains: string;
63
+ };
64
+
65
+ declare type UpstashQueryVectorParams = QueryVectorParams<UpstashVectorFilter>;
66
+
59
67
  declare class UpstashStore extends MastraStorage {
60
68
  private redis;
61
69
  constructor(config: UpstashConfig);
62
70
  get supports(): {
63
71
  selectByIncludeResourceScope: boolean;
72
+ resourceWorkingMemory: boolean;
64
73
  };
65
74
  private transformEvalRecord;
66
75
  private parseJSON;
@@ -221,11 +230,22 @@ declare class UpstashStore extends MastraStorage {
221
230
  };
222
231
  }[];
223
232
  }): Promise<MastraMessageV2[]>;
233
+ getResourceById({ resourceId }: {
234
+ resourceId: string;
235
+ }): Promise<StorageResourceType | null>;
236
+ saveResource({ resource }: {
237
+ resource: StorageResourceType;
238
+ }): Promise<StorageResourceType>;
239
+ updateResource({ resourceId, workingMemory, metadata, }: {
240
+ resourceId: string;
241
+ workingMemory?: string;
242
+ metadata?: Record<string, unknown>;
243
+ }): Promise<StorageResourceType>;
224
244
  }
225
245
  export { UpstashStore }
226
246
  export { UpstashStore as UpstashStore_alias_1 }
227
247
 
228
- declare class UpstashVector extends MastraVector {
248
+ declare class UpstashVector extends MastraVector<UpstashVectorFilter> {
229
249
  private client;
230
250
  /**
231
251
  * Creates a new UpstashVector instance.
@@ -245,10 +265,10 @@ declare class UpstashVector extends MastraVector {
245
265
  upsert({ indexName: namespace, vectors, metadata, ids }: UpsertVectorParams): Promise<string[]>;
246
266
  /**
247
267
  * Transforms a Mastra vector filter into an Upstash-compatible filter string.
248
- * @param {VectorFilter} [filter] - The filter to transform.
268
+ * @param {UpstashVectorFilter} [filter] - The filter to transform.
249
269
  * @returns {string | undefined} The transformed filter string, or undefined if no filter is provided.
250
270
  */
251
- transformFilter(filter?: VectorFilter): string | undefined;
271
+ transformFilter(filter?: UpstashVectorFilter): string | undefined;
252
272
  /**
253
273
  * Creates a new index. For Upstash, this is a no-op as indexes (known as namespaces in Upstash) are created on-the-fly.
254
274
  * @param {CreateIndexParams} _params - The parameters for creating the index (ignored).
@@ -260,7 +280,7 @@ declare class UpstashVector extends MastraVector {
260
280
  * @param {QueryVectorParams} params - The parameters for the query operation. indexName is the namespace in Upstash.
261
281
  * @returns {Promise<QueryResult[]>} A promise that resolves to the query results.
262
282
  */
263
- query({ indexName: namespace, queryVector, topK, filter, includeVector, }: QueryVectorParams): Promise<QueryResult[]>;
283
+ query({ indexName: namespace, queryVector, topK, filter, includeVector, }: UpstashQueryVectorParams): Promise<QueryResult[]>;
264
284
  /**
265
285
  * Lists all namespaces in the Upstash vector index, which correspond to indexes.
266
286
  * @returns {Promise<string[]>} A promise that resolves to a list of index names.
@@ -302,4 +322,6 @@ declare class UpstashVector extends MastraVector {
302
322
  export { UpstashVector }
303
323
  export { UpstashVector as UpstashVector_alias_1 }
304
324
 
325
+ export declare type UpstashVectorFilter = VectorFilter<keyof UpstashOperatorValueMap, UpstashOperatorValueMap>;
326
+
305
327
  export { }
@@ -11,6 +11,7 @@ import type { MastraMessageV2 } from '@mastra/core/agent';
11
11
  import { MastraStorage } from '@mastra/core/storage';
12
12
  import { MastraVector } from '@mastra/core/vector';
13
13
  import type { OperatorSupport } from '@mastra/core/vector/filter';
14
+ import type { OperatorValueMap } from '@mastra/core/vector/filter';
14
15
  import type { PaginationArgs } from '@mastra/core/storage';
15
16
  import type { PaginationInfo } from '@mastra/core/storage';
16
17
  import type { QueryResult } from '@mastra/core/vector';
@@ -18,6 +19,7 @@ import type { QueryVectorParams } from '@mastra/core/vector';
18
19
  import type { StorageColumn } from '@mastra/core/storage';
19
20
  import type { StorageGetMessagesArg } from '@mastra/core/storage';
20
21
  import type { StorageGetTracesArg } from '@mastra/core/storage';
22
+ import type { StorageResourceType } from '@mastra/core/storage';
21
23
  import type { StorageThreadType } from '@mastra/core/memory';
22
24
  import type { TABLE_NAMES } from '@mastra/core/storage';
23
25
  import type { UpdateVectorParams } from '@mastra/core/vector';
@@ -42,9 +44,9 @@ declare interface UpstashConfig {
42
44
  export { UpstashConfig }
43
45
  export { UpstashConfig as UpstashConfig_alias_1 }
44
46
 
45
- export declare class UpstashFilterTranslator extends BaseFilterTranslator {
47
+ export declare class UpstashFilterTranslator extends BaseFilterTranslator<UpstashVectorFilter, string | undefined> {
46
48
  protected getSupportedOperators(): OperatorSupport;
47
- translate(filter?: VectorFilter): string | undefined;
49
+ translate(filter?: UpstashVectorFilter): string | undefined;
48
50
  private translateNode;
49
51
  private readonly COMPARISON_OPS;
50
52
  private translateOperator;
@@ -56,11 +58,18 @@ export declare class UpstashFilterTranslator extends BaseFilterTranslator {
56
58
  private joinConditions;
57
59
  }
58
60
 
61
+ declare type UpstashOperatorValueMap = Omit<OperatorValueMap, '$options' | '$elemMatch'> & {
62
+ $contains: string;
63
+ };
64
+
65
+ declare type UpstashQueryVectorParams = QueryVectorParams<UpstashVectorFilter>;
66
+
59
67
  declare class UpstashStore extends MastraStorage {
60
68
  private redis;
61
69
  constructor(config: UpstashConfig);
62
70
  get supports(): {
63
71
  selectByIncludeResourceScope: boolean;
72
+ resourceWorkingMemory: boolean;
64
73
  };
65
74
  private transformEvalRecord;
66
75
  private parseJSON;
@@ -221,11 +230,22 @@ declare class UpstashStore extends MastraStorage {
221
230
  };
222
231
  }[];
223
232
  }): Promise<MastraMessageV2[]>;
233
+ getResourceById({ resourceId }: {
234
+ resourceId: string;
235
+ }): Promise<StorageResourceType | null>;
236
+ saveResource({ resource }: {
237
+ resource: StorageResourceType;
238
+ }): Promise<StorageResourceType>;
239
+ updateResource({ resourceId, workingMemory, metadata, }: {
240
+ resourceId: string;
241
+ workingMemory?: string;
242
+ metadata?: Record<string, unknown>;
243
+ }): Promise<StorageResourceType>;
224
244
  }
225
245
  export { UpstashStore }
226
246
  export { UpstashStore as UpstashStore_alias_1 }
227
247
 
228
- declare class UpstashVector extends MastraVector {
248
+ declare class UpstashVector extends MastraVector<UpstashVectorFilter> {
229
249
  private client;
230
250
  /**
231
251
  * Creates a new UpstashVector instance.
@@ -245,10 +265,10 @@ declare class UpstashVector extends MastraVector {
245
265
  upsert({ indexName: namespace, vectors, metadata, ids }: UpsertVectorParams): Promise<string[]>;
246
266
  /**
247
267
  * Transforms a Mastra vector filter into an Upstash-compatible filter string.
248
- * @param {VectorFilter} [filter] - The filter to transform.
268
+ * @param {UpstashVectorFilter} [filter] - The filter to transform.
249
269
  * @returns {string | undefined} The transformed filter string, or undefined if no filter is provided.
250
270
  */
251
- transformFilter(filter?: VectorFilter): string | undefined;
271
+ transformFilter(filter?: UpstashVectorFilter): string | undefined;
252
272
  /**
253
273
  * Creates a new index. For Upstash, this is a no-op as indexes (known as namespaces in Upstash) are created on-the-fly.
254
274
  * @param {CreateIndexParams} _params - The parameters for creating the index (ignored).
@@ -260,7 +280,7 @@ declare class UpstashVector extends MastraVector {
260
280
  * @param {QueryVectorParams} params - The parameters for the query operation. indexName is the namespace in Upstash.
261
281
  * @returns {Promise<QueryResult[]>} A promise that resolves to the query results.
262
282
  */
263
- query({ indexName: namespace, queryVector, topK, filter, includeVector, }: QueryVectorParams): Promise<QueryResult[]>;
283
+ query({ indexName: namespace, queryVector, topK, filter, includeVector, }: UpstashQueryVectorParams): Promise<QueryResult[]>;
264
284
  /**
265
285
  * Lists all namespaces in the Upstash vector index, which correspond to indexes.
266
286
  * @returns {Promise<string[]>} A promise that resolves to a list of index names.
@@ -302,4 +322,6 @@ declare class UpstashVector extends MastraVector {
302
322
  export { UpstashVector }
303
323
  export { UpstashVector as UpstashVector_alias_1 }
304
324
 
325
+ export declare type UpstashVectorFilter = VectorFilter<keyof UpstashOperatorValueMap, UpstashOperatorValueMap>;
326
+
305
327
  export { }