@mastra/upstash 1.0.5 → 1.1.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/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './cache/index.js';
1
2
  export * from './storage/index.js';
2
3
  export * from './vector/index.js';
3
4
  export { UPSTASH_PROMPT } from './vector/prompt.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"}
package/dist/index.js CHANGED
@@ -1,5 +1,7 @@
1
- import { BackgroundTasksStorage, TABLE_BACKGROUND_TASKS, MemoryStorage, TABLE_THREADS, TABLE_MESSAGES, TABLE_RESOURCES, ensureDate, createStorageErrorId, normalizePerPage, calculatePagination, filterByDateRange, ScoresStorage, TABLE_SCORERS, WorkflowsStorage, TABLE_WORKFLOW_SNAPSHOT, MastraCompositeStore, createVectorErrorId, serializeDate, transformScoreRow as transformScoreRow$1 } from '@mastra/core/storage';
1
+ import { RedisServerCache, upstashPreset } from '@mastra/redis';
2
+ export { RedisServerCache, upstashPreset } from '@mastra/redis';
2
3
  import { Redis } from '@upstash/redis';
4
+ import { BackgroundTasksStorage, TABLE_BACKGROUND_TASKS, MemoryStorage, TABLE_THREADS, TABLE_MESSAGES, TABLE_RESOURCES, ensureDate, createStorageErrorId, normalizePerPage, calculatePagination, filterByDateRange, ScoresStorage, TABLE_SCORERS, WorkflowsStorage, TABLE_WORKFLOW_SNAPSHOT, MastraCompositeStore, createVectorErrorId, serializeDate, transformScoreRow as transformScoreRow$1 } from '@mastra/core/storage';
3
5
  import { MastraError, ErrorCategory, ErrorDomain } from '@mastra/core/error';
4
6
  import { MessageList } from '@mastra/core/agent';
5
7
  import { saveScorePayloadSchema } from '@mastra/core/evals';
@@ -8,7 +10,23 @@ import { MastraVector } from '@mastra/core/vector';
8
10
  import { Index } from '@upstash/vector';
9
11
  import { BaseFilterTranslator } from '@mastra/core/vector/filter';
10
12
 
11
- // src/storage/index.ts
13
+ // src/cache/index.ts
14
+ var UpstashServerCache = class extends RedisServerCache {
15
+ constructor(config, options = {}) {
16
+ let client;
17
+ if ("client" in config) {
18
+ client = config.client;
19
+ } else {
20
+ client = new Redis({ url: config.url, token: config.token });
21
+ }
22
+ const redisOptions = {
23
+ ...upstashPreset,
24
+ keyPrefix: options.keyPrefix,
25
+ ttlSeconds: options.ttlSeconds
26
+ };
27
+ super({ client }, redisOptions);
28
+ }
29
+ };
12
30
  function getKey(tableName, keys) {
13
31
  const keyParts = Object.entries(keys).filter(([_, value]) => value !== void 0).map(([key, value]) => `${key}:${value}`);
14
32
  return `${tableName}:${keyParts.join(":")}`;
@@ -2870,6 +2888,6 @@ Example Complex Query:
2870
2888
  ]
2871
2889
  }`;
2872
2890
 
2873
- export { BackgroundTasksUpstash, ScoresUpstash, StoreMemoryUpstash, UPSTASH_PROMPT, UpstashStore, UpstashVector, WorkflowsUpstash };
2891
+ export { BackgroundTasksUpstash, ScoresUpstash, StoreMemoryUpstash, UPSTASH_PROMPT, UpstashServerCache, UpstashStore, UpstashVector, WorkflowsUpstash };
2874
2892
  //# sourceMappingURL=index.js.map
2875
2893
  //# sourceMappingURL=index.js.map