@mastra/upstash 0.1.0-alpha.10 → 0.1.0-alpha.12

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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @mastra/upstash
2
2
 
3
+ ## 0.1.0-alpha.12
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [a9345f9]
8
+ - @mastra/core@0.2.0-alpha.102
9
+
10
+ ## 0.1.0-alpha.11
11
+
12
+ ### Patch Changes
13
+
14
+ - 4f1d1a1: Enforce types ann cleanup package.json
15
+ - Updated dependencies [66a03ec]
16
+ - Updated dependencies [4f1d1a1]
17
+ - @mastra/core@0.2.0-alpha.101
18
+
3
19
  ## 0.1.0-alpha.10
4
20
 
5
21
  ### Patch Changes
@@ -0,0 +1,116 @@
1
+ import { BaseFilterTranslator } from '@mastra/core/filter';
2
+ import { Filter } from '@mastra/core/filter';
3
+ import { MastraStorage } from '@mastra/core/storage';
4
+ import { MastraVector } from '@mastra/core/vector';
5
+ import { MessageType } from '@mastra/core/memory';
6
+ import { OperatorSupport } from '@mastra/core/filter';
7
+ import type { QueryResult } from '@mastra/core/vector';
8
+ import { StorageColumn } from '@mastra/core/storage';
9
+ import { StorageGetMessagesArg } from '@mastra/core/storage';
10
+ import { StorageThreadType } from '@mastra/core/memory';
11
+ import { TABLE_NAMES } from '@mastra/core/storage';
12
+ import { WorkflowRunState } from '@mastra/core/workflows';
13
+
14
+ declare interface UpstashConfig {
15
+ url: string;
16
+ token: string;
17
+ }
18
+ export { UpstashConfig }
19
+ export { UpstashConfig as UpstashConfig_alias_1 }
20
+
21
+ export declare class UpstashFilterTranslator extends BaseFilterTranslator {
22
+ protected getSupportedOperators(): OperatorSupport;
23
+ translate(filter?: Filter): string | undefined;
24
+ private translateNode;
25
+ private readonly COMPARISON_OPS;
26
+ private translateOperator;
27
+ private readonly NEGATED_OPERATORS;
28
+ private formatNot;
29
+ private formatValue;
30
+ private formatArray;
31
+ private formatComparison;
32
+ private joinConditions;
33
+ }
34
+
35
+ declare class UpstashStore extends MastraStorage {
36
+ private redis;
37
+ constructor(config: UpstashConfig);
38
+ private getKey;
39
+ private ensureDate;
40
+ private serializeDate;
41
+ createTable({ tableName, schema, }: {
42
+ tableName: TABLE_NAMES;
43
+ schema: Record<string, StorageColumn>;
44
+ }): Promise<void>;
45
+ clearTable({ tableName }: {
46
+ tableName: TABLE_NAMES;
47
+ }): Promise<void>;
48
+ insert({ tableName, record }: {
49
+ tableName: TABLE_NAMES;
50
+ record: Record<string, any>;
51
+ }): Promise<void>;
52
+ load<R>({ tableName, keys }: {
53
+ tableName: TABLE_NAMES;
54
+ keys: Record<string, string>;
55
+ }): Promise<R | null>;
56
+ getThreadById({ threadId }: {
57
+ threadId: string;
58
+ }): Promise<StorageThreadType | null>;
59
+ getThreadsByResourceId({ resourceId }: {
60
+ resourceId: string;
61
+ }): Promise<StorageThreadType[]>;
62
+ saveThread({ thread }: {
63
+ thread: StorageThreadType;
64
+ }): Promise<StorageThreadType>;
65
+ updateThread({ id, title, metadata, }: {
66
+ id: string;
67
+ title: string;
68
+ metadata: Record<string, unknown>;
69
+ }): Promise<StorageThreadType>;
70
+ deleteThread({ threadId }: {
71
+ threadId: string;
72
+ }): Promise<void>;
73
+ private getMessageKey;
74
+ private getThreadMessagesKey;
75
+ saveMessages({ messages }: {
76
+ messages: MessageType[];
77
+ }): Promise<MessageType[]>;
78
+ getMessages<T = unknown>({ threadId, selectBy }: StorageGetMessagesArg): Promise<T[]>;
79
+ persistWorkflowSnapshot(params: {
80
+ namespace: string;
81
+ workflowName: string;
82
+ runId: string;
83
+ snapshot: WorkflowRunState;
84
+ }): Promise<void>;
85
+ loadWorkflowSnapshot(params: {
86
+ namespace: string;
87
+ workflowName: string;
88
+ runId: string;
89
+ }): Promise<WorkflowRunState | null>;
90
+ close(): Promise<void>;
91
+ }
92
+ export { UpstashStore }
93
+ export { UpstashStore as UpstashStore_alias_1 }
94
+
95
+ declare class UpstashVector extends MastraVector {
96
+ private client;
97
+ constructor({ url, token }: {
98
+ url: string;
99
+ token: string;
100
+ });
101
+ upsert(indexName: string, vectors: number[][], metadata?: Record<string, any>[], ids?: string[]): Promise<string[]>;
102
+ transformFilter(filter?: Filter): string | undefined;
103
+ createIndex(_indexName: string, _dimension: number, _metric?: 'cosine' | 'euclidean' | 'dotproduct'): Promise<void>;
104
+ query(indexName: string, queryVector: number[], topK?: number, filter?: Filter, includeVector?: boolean): Promise<QueryResult[]>;
105
+ listIndexes(): Promise<string[]>;
106
+ describeIndex(indexName: string): Promise<{
107
+ dimension: number;
108
+ count: number;
109
+ metric: "cosine" | "euclidean" | "dotproduct";
110
+ }>;
111
+ deleteIndex(indexName: string): Promise<void>;
112
+ }
113
+ export { UpstashVector }
114
+ export { UpstashVector as UpstashVector_alias_1 }
115
+
116
+ export { }
package/dist/index.d.ts CHANGED
@@ -1,88 +1,3 @@
1
- import { StorageThreadType, MessageType } from '@mastra/core/memory';
2
- import { MastraStorage, TABLE_NAMES, StorageColumn, StorageGetMessagesArg } from '@mastra/core/storage';
3
- import { WorkflowRunState } from '@mastra/core/workflows';
4
- import { Filter } from '@mastra/core/filter';
5
- import { MastraVector, QueryResult } from '@mastra/core/vector';
6
-
7
- interface UpstashConfig {
8
- url: string;
9
- token: string;
10
- }
11
- declare class UpstashStore extends MastraStorage {
12
- private redis;
13
- constructor(config: UpstashConfig);
14
- private getKey;
15
- private ensureDate;
16
- private serializeDate;
17
- createTable({ tableName, schema, }: {
18
- tableName: TABLE_NAMES;
19
- schema: Record<string, StorageColumn>;
20
- }): Promise<void>;
21
- clearTable({ tableName }: {
22
- tableName: TABLE_NAMES;
23
- }): Promise<void>;
24
- insert({ tableName, record }: {
25
- tableName: TABLE_NAMES;
26
- record: Record<string, any>;
27
- }): Promise<void>;
28
- load<R>({ tableName, keys }: {
29
- tableName: TABLE_NAMES;
30
- keys: Record<string, string>;
31
- }): Promise<R | null>;
32
- getThreadById({ threadId }: {
33
- threadId: string;
34
- }): Promise<StorageThreadType | null>;
35
- getThreadsByResourceId({ resourceId }: {
36
- resourceId: string;
37
- }): Promise<StorageThreadType[]>;
38
- saveThread({ thread }: {
39
- thread: StorageThreadType;
40
- }): Promise<StorageThreadType>;
41
- updateThread({ id, title, metadata, }: {
42
- id: string;
43
- title: string;
44
- metadata: Record<string, unknown>;
45
- }): Promise<StorageThreadType>;
46
- deleteThread({ threadId }: {
47
- threadId: string;
48
- }): Promise<void>;
49
- private getMessageKey;
50
- private getThreadMessagesKey;
51
- saveMessages({ messages }: {
52
- messages: MessageType[];
53
- }): Promise<MessageType[]>;
54
- getMessages<T = unknown>({ threadId, selectBy }: StorageGetMessagesArg): Promise<T[]>;
55
- persistWorkflowSnapshot(params: {
56
- namespace: string;
57
- workflowName: string;
58
- runId: string;
59
- snapshot: WorkflowRunState;
60
- }): Promise<void>;
61
- loadWorkflowSnapshot(params: {
62
- namespace: string;
63
- workflowName: string;
64
- runId: string;
65
- }): Promise<WorkflowRunState | null>;
66
- close(): Promise<void>;
67
- }
68
-
69
- declare class UpstashVector extends MastraVector {
70
- private client;
71
- constructor({ url, token }: {
72
- url: string;
73
- token: string;
74
- });
75
- upsert(indexName: string, vectors: number[][], metadata?: Record<string, any>[], ids?: string[]): Promise<string[]>;
76
- transformFilter(filter?: Filter): string | undefined;
77
- createIndex(_indexName: string, _dimension: number, _metric?: 'cosine' | 'euclidean' | 'dotproduct'): Promise<void>;
78
- query(indexName: string, queryVector: number[], topK?: number, filter?: Filter, includeVector?: boolean): Promise<QueryResult[]>;
79
- listIndexes(): Promise<string[]>;
80
- describeIndex(indexName: string): Promise<{
81
- dimension: number;
82
- count: number;
83
- metric: "cosine" | "euclidean" | "dotproduct";
84
- }>;
85
- deleteIndex(indexName: string): Promise<void>;
86
- }
87
-
88
- export { type UpstashConfig, UpstashStore, UpstashVector };
1
+ export { UpstashConfig } from './_tsup-dts-rollup.js';
2
+ export { UpstashStore } from './_tsup-dts-rollup.js';
3
+ export { UpstashVector } from './_tsup-dts-rollup.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/upstash",
3
- "version": "0.1.0-alpha.10",
3
+ "version": "0.1.0-alpha.12",
4
4
  "description": "Upstash provider for Mastra - includes both vector and db storage capabilities",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -17,11 +17,11 @@
17
17
  "dependencies": {
18
18
  "@upstash/redis": "^1.28.3",
19
19
  "@upstash/vector": "^1.1.7",
20
- "@mastra/core": "^0.2.0-alpha.100"
20
+ "@mastra/core": "^0.2.0-alpha.102"
21
21
  },
22
22
  "devDependencies": {
23
- "@tsconfig/recommended": "^1.0.7",
24
- "@types/node": "^22.9.0",
23
+ "@microsoft/api-extractor": "^7.49.2",
24
+ "@types/node": "^22.13.1",
25
25
  "tsup": "^8.0.1",
26
26
  "vitest": "^3.0.4"
27
27
  },
@@ -29,7 +29,7 @@
29
29
  "pretest": "docker compose up -d",
30
30
  "test": "vitest run",
31
31
  "posttest": "docker compose down",
32
- "build": "tsup src/index.ts --format esm --dts --clean --treeshake",
32
+ "build": "tsup src/index.ts --format esm --experimental-dts --clean --treeshake",
33
33
  "build:watch": "pnpm build --watch"
34
34
  }
35
35
  }
@@ -1,4 +1,4 @@
1
- import { BaseFilterTranslator, Filter, FieldCondition, OperatorSupport } from '@mastra/core/filter';
1
+ import { BaseFilterTranslator, type Filter, type FieldCondition, type OperatorSupport } from '@mastra/core/filter';
2
2
 
3
3
  export class UpstashFilterTranslator extends BaseFilterTranslator {
4
4
  protected override getSupportedOperators(): OperatorSupport {