@mastra/upstash 1.5.5-alpha.0 → 1.5.5

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.
@@ -3,7 +3,7 @@ name: mastra-upstash
3
3
  description: Documentation for @mastra/upstash. Use when working with @mastra/upstash APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/upstash"
6
- version: "1.5.5-alpha.0"
6
+ version: "1.5.5"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.5.5-alpha.0",
2
+ "version": "1.5.5",
3
3
  "package": "@mastra/upstash",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -382,6 +382,7 @@ Vector store prompts define query patterns and filtering capabilities for each v
382
382
 
383
383
  ```ts
384
384
  import { MONGODB_PROMPT } from '@mastra/mongodb'
385
+ import { Agent } from '@mastra/core/agent'
385
386
 
386
387
  export const ragAgent = new Agent({
387
388
  id: 'rag-agent',
@@ -416,6 +417,7 @@ export const ragAgent = new Agent({
416
417
 
417
418
  ```ts
418
419
  import { PINECONE_PROMPT } from '@mastra/pinecone'
420
+ import { Agent } from '@mastra/core/agent'
419
421
 
420
422
  export const ragAgent = new Agent({
421
423
  id: 'rag-agent',
@@ -433,6 +435,7 @@ export const ragAgent = new Agent({
433
435
 
434
436
  ```ts
435
437
  import { QDRANT_PROMPT } from '@mastra/qdrant'
438
+ import { Agent } from '@mastra/core/agent'
436
439
 
437
440
  export const ragAgent = new Agent({
438
441
  id: 'rag-agent',
@@ -450,6 +453,7 @@ export const ragAgent = new Agent({
450
453
 
451
454
  ```ts
452
455
  import { CHROMA_PROMPT } from '@mastra/chroma'
456
+ import { Agent } from '@mastra/core/agent'
453
457
 
454
458
  export const ragAgent = new Agent({
455
459
  id: 'rag-agent',
@@ -467,6 +471,7 @@ export const ragAgent = new Agent({
467
471
 
468
472
  ```ts
469
473
  import { ASTRA_PROMPT } from '@mastra/astra'
474
+ import { Agent } from '@mastra/core/agent'
470
475
 
471
476
  export const ragAgent = new Agent({
472
477
  id: 'rag-agent',
@@ -484,6 +489,7 @@ export const ragAgent = new Agent({
484
489
 
485
490
  ```ts
486
491
  import { LIBSQL_PROMPT } from '@mastra/libsql'
492
+ import { Agent } from '@mastra/core/agent'
487
493
 
488
494
  export const ragAgent = new Agent({
489
495
  id: 'rag-agent',
@@ -501,6 +507,7 @@ export const ragAgent = new Agent({
501
507
 
502
508
  ```ts
503
509
  import { UPSTASH_PROMPT } from '@mastra/upstash'
510
+ import { Agent } from '@mastra/core/agent'
504
511
 
505
512
  export const ragAgent = new Agent({
506
513
  id: 'rag-agent',
@@ -518,6 +525,7 @@ export const ragAgent = new Agent({
518
525
 
519
526
  ```ts
520
527
  import { VECTORIZE_PROMPT } from '@mastra/vectorize'
528
+ import { Agent } from '@mastra/core/agent'
521
529
 
522
530
  export const ragAgent = new Agent({
523
531
  id: 'rag-agent',
@@ -535,6 +543,7 @@ export const ragAgent = new Agent({
535
543
 
536
544
  ```ts
537
545
  import { OPENSEARCH_PROMPT } from '@mastra/opensearch'
546
+ import { Agent } from '@mastra/core/agent'
538
547
 
539
548
  export const ragAgent = new Agent({
540
549
  id: 'rag-agent',
@@ -552,6 +561,7 @@ export const ragAgent = new Agent({
552
561
 
553
562
  ```ts
554
563
  import { ORACLEDB_PROMPT } from '@mastra/oracledb'
564
+ import { Agent } from '@mastra/core/agent'
555
565
 
556
566
  export const ragAgent = new Agent({
557
567
  id: 'rag-agent',
@@ -569,6 +579,7 @@ export const ragAgent = new Agent({
569
579
 
570
580
  ```ts
571
581
  import { S3VECTORS_PROMPT } from '@mastra/s3vectors'
582
+ import { Agent } from '@mastra/core/agent'
572
583
 
573
584
  export const ragAgent = new Agent({
574
585
  id: 'rag-agent',
@@ -18,13 +18,13 @@ The UpstashVector class provides vector search using [Upstash Vector](https://up
18
18
 
19
19
  ### `createIndex()`
20
20
 
21
- Note: This method is a no-op for Upstash as indexes are created automatically.
21
+ Note: This method is a no-op for Upstash. Indexes (Upstash namespaces) are created automatically on first write, and the parameters below are ignored.
22
22
 
23
23
  **indexName** (`string`): Name of the index to create
24
24
 
25
25
  **dimension** (`number`): Vector dimension (must match your embedding model)
26
26
 
27
- **metric** (`'cosine' | 'euclidean' | 'dotproduct'`): Distance metric for similarity search (Default: `cosine`)
27
+ **metric** (`'cosine' | 'euclidean' | 'dotproduct'`): Ignored. The metric is set on the Upstash index itself.
28
28
 
29
29
  ### `upsert()`
30
30
 
@@ -70,7 +70,7 @@ Returns:
70
70
  interface IndexStats {
71
71
  dimension: number
72
72
  count: number
73
- metric: 'cosine' | 'euclidean' | 'dotproduct'
73
+ metric?: 'cosine' | 'euclidean' | 'dotproduct'
74
74
  }
75
75
  ```
76
76
 
@@ -82,10 +82,14 @@ interface IndexStats {
82
82
 
83
83
  **indexName** (`string`): Name of the index to update
84
84
 
85
- **id** (`string`): ID of the item to update
85
+ **id** (`string`): ID of the item to update. Mutually exclusive with filter.
86
+
87
+ **filter** (`Record<string, any>`): Metadata filter matching up to 1,000 items to update. Mutually exclusive with id. Must not be empty.
86
88
 
87
89
  **update** (`object`): Update object containing vector, sparse vector, and/or metadata
88
90
 
91
+ Provide exactly one of `id` or `filter`.
92
+
89
93
  The `update` object can have the following properties:
90
94
 
91
95
  - `vector` (optional): An array of numbers representing the new dense vector.
package/dist/index.cjs CHANGED
@@ -8,7 +8,7 @@ let _mastra_core_evals = require("@mastra/core/evals");
8
8
  let _mastra_core_vector = require("@mastra/core/vector");
9
9
  let _upstash_vector = require("@upstash/vector");
10
10
  let _mastra_core_vector_filter = require("@mastra/core/vector/filter");
11
- //#region src/cache/index.ts
11
+ // src/cache/index.ts
12
12
  /**
13
13
  * Upstash Redis implementation of MastraServerCache.
14
14
  *
@@ -50,8 +50,7 @@ var UpstashServerCache = class extends _mastra_redis.RedisServerCache {
50
50
  super({ client }, redisOptions);
51
51
  }
52
52
  };
53
- //#endregion
54
- //#region src/storage/domains/utils.ts
53
+ // src/storage/domains/utils.ts
55
54
  function getKey(tableName, keys) {
56
55
  return `${tableName}:${Object.entries(keys).filter(([_, value]) => value !== void 0).map(([key, value]) => `${key}:${value}`).join(":")}`;
57
56
  }
@@ -79,8 +78,7 @@ function processRecord(tableName, record) {
79
78
  processedRecord
80
79
  };
81
80
  }
82
- //#endregion
83
- //#region src/storage/db/index.ts
81
+ // src/storage/db/index.ts
84
82
  /**
85
83
  * Resolves UpstashDomainConfig to a Redis client.
86
84
  * Handles creating a new Redis client if url/token are provided.
@@ -166,8 +164,7 @@ var UpstashDB = class {
166
164
  }
167
165
  }
168
166
  };
169
- //#endregion
170
- //#region src/storage/domains/background-tasks/index.ts
167
+ // src/storage/domains/background-tasks/index.ts
171
168
  function toStorageRecord(task) {
172
169
  return {
173
170
  id: task.id,
@@ -351,8 +348,7 @@ var BackgroundTasksUpstash = class extends _mastra_core_storage.BackgroundTasksS
351
348
  return total;
352
349
  }
353
350
  };
354
- //#endregion
355
- //#region src/storage/domains/run-fencing.ts
351
+ // src/storage/domains/run-fencing.ts
356
352
  function runClaimKey(claims, runId) {
357
353
  return `${claims}:run_id:${runId}`;
358
354
  }
@@ -584,8 +580,7 @@ function writeBatch(client, check) {
584
580
  async function assertRunFence(client, check) {
585
581
  if (check) await new FencedWriteBatch(client, check).exec();
586
582
  }
587
- //#endregion
588
- //#region src/storage/domains/memory/index.ts
583
+ // src/storage/domains/memory/index.ts
589
584
  function getThreadMessagesKey(threadId) {
590
585
  return `thread:${threadId}:messages`;
591
586
  }
@@ -1493,7 +1488,7 @@ var StoreMemoryUpstash = class extends _mastra_core_storage.MemoryStorage {
1493
1488
  const aValue = new Date(a[field]).getTime();
1494
1489
  const bValue = new Date(b[field]).getTime();
1495
1490
  if (direction === "ASC") return aValue - bValue;
1496
- else return bValue - aValue;
1491
+ return bValue - aValue;
1497
1492
  });
1498
1493
  }
1499
1494
  async cloneThread(args) {
@@ -1598,8 +1593,7 @@ var StoreMemoryUpstash = class extends _mastra_core_storage.MemoryStorage {
1598
1593
  }
1599
1594
  }
1600
1595
  };
1601
- //#endregion
1602
- //#region src/storage/domains/scores/index.ts
1596
+ // src/storage/domains/scores/index.ts
1603
1597
  /**
1604
1598
  * Upstash-specific score row transformation.
1605
1599
  * Uses default options (no timestamp conversion).
@@ -1878,8 +1872,7 @@ var ScoresUpstash = class extends _mastra_core_storage.ScoresStorage {
1878
1872
  };
1879
1873
  }
1880
1874
  };
1881
- //#endregion
1882
- //#region src/storage/domains/workflows/index.ts
1875
+ // src/storage/domains/workflows/index.ts
1883
1876
  var WorkflowsUpstash = class extends _mastra_core_storage.WorkflowsStorage {
1884
1877
  client;
1885
1878
  #db;
@@ -2370,8 +2363,7 @@ var WorkflowsUpstash = class extends _mastra_core_storage.WorkflowsStorage {
2370
2363
  }
2371
2364
  }
2372
2365
  };
2373
- //#endregion
2374
- //#region src/storage/index.ts
2366
+ // src/storage/index.ts
2375
2367
  /**
2376
2368
  * Type guard for pre-configured client config
2377
2369
  */
@@ -2427,8 +2419,7 @@ var UpstashStore = class extends _mastra_core_storage.MastraCompositeStore {
2427
2419
  }
2428
2420
  async close() {}
2429
2421
  };
2430
- //#endregion
2431
- //#region src/vector/filter.ts
2422
+ // src/vector/filter.ts
2432
2423
  var UpstashFilterTranslator = class extends _mastra_core_vector_filter.BaseFilterTranslator {
2433
2424
  getSupportedOperators() {
2434
2425
  return {
@@ -2574,8 +2565,7 @@ var UpstashFilterTranslator = class extends _mastra_core_vector_filter.BaseFilte
2574
2565
  return `(${(Array.isArray(conditions) ? conditions.map((c) => this.translateNode(c)) : [this.translateNode(conditions)]).join(` ${operator} `)})`;
2575
2566
  }
2576
2567
  };
2577
- //#endregion
2578
- //#region src/vector/index.ts
2568
+ // src/vector/index.ts
2579
2569
  var UpstashVector = class extends _mastra_core_vector.MastraVector {
2580
2570
  client;
2581
2571
  /**
@@ -2931,8 +2921,7 @@ var UpstashVector = class extends _mastra_core_vector.MastraVector {
2931
2921
  }
2932
2922
  }
2933
2923
  };
2934
- //#endregion
2935
- //#region src/vector/prompt.ts
2924
+ // src/vector/prompt.ts
2936
2925
  /**
2937
2926
  * Vector store specific prompt that details supported operators and examples.
2938
2927
  * This prompt helps users construct valid filters for Upstash Vector.
@@ -3010,7 +2999,6 @@ Example Complex Query:
3010
2999
  ]}
3011
3000
  ]
3012
3001
  }`;
3013
- //#endregion
3014
3002
  exports.BackgroundTasksUpstash = BackgroundTasksUpstash;
3015
3003
  Object.defineProperty(exports, "RedisServerCache", {
3016
3004
  enumerable: true,