@mastra/upstash 0.3.5-alpha.0 → 0.4.0-alpha.1

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.3.5-alpha.0 build /home/runner/work/mastra/mastra/stores/upstash
2
+ > @mastra/upstash@0.4.0-alpha.1 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.4.0
8
8
  TSC Build start
9
- TSC ⚡️ Build success in 8244ms
9
+ TSC ⚡️ Build success in 8537ms
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 11442ms
16
+ DTS ⚡️ Build success in 11892ms
17
17
  CLI Cleaning output folder
18
18
  ESM Build start
19
19
  CJS Build start
20
- ESM dist/index.js 32.29 KB
21
- ESM ⚡️ Build success in 996ms
22
- CJS dist/index.cjs 32.43 KB
23
- CJS ⚡️ Build success in 996ms
20
+ ESM dist/index.js 30.09 KB
21
+ ESM ⚡️ Build success in 1126ms
22
+ CJS dist/index.cjs 30.23 KB
23
+ CJS ⚡️ Build success in 1126ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @mastra/upstash
2
2
 
3
+ ## 0.4.0-alpha.1
4
+
5
+ ### Minor Changes
6
+
7
+ - 83da932: Move @mastra/core to peerdeps
8
+
9
+ ### Patch Changes
10
+
11
+ - a7292b0: BREAKING(@mastra/core, all vector stores): Vector store breaking changes (remove deprecated functions and positional arguments)
12
+ - Updated dependencies [b3a3d63]
13
+ - Updated dependencies [344f453]
14
+ - Updated dependencies [0a3ae6d]
15
+ - Updated dependencies [95911be]
16
+ - Updated dependencies [5eb5a99]
17
+ - Updated dependencies [7e632c5]
18
+ - Updated dependencies [1e9fbfa]
19
+ - Updated dependencies [b2ae5aa]
20
+ - Updated dependencies [a7292b0]
21
+ - Updated dependencies [0dcb9f0]
22
+ - @mastra/core@0.10.0-alpha.1
23
+
3
24
  ## 0.3.5-alpha.0
4
25
 
5
26
  ### Patch Changes
@@ -9,7 +9,6 @@ import { MastraStorage } from '@mastra/core/storage';
9
9
  import { MastraVector } from '@mastra/core/vector';
10
10
  import type { MessageType } from '@mastra/core/memory';
11
11
  import type { OperatorSupport } from '@mastra/core/vector/filter';
12
- import type { ParamsToArgs } from '@mastra/core/vector';
13
12
  import type { QueryResult } from '@mastra/core/vector';
14
13
  import type { QueryVectorParams } from '@mastra/core/vector';
15
14
  import type { StorageColumn } from '@mastra/core/storage';
@@ -150,36 +149,19 @@ declare class UpstashVector extends MastraVector {
150
149
  url: string;
151
150
  token: string;
152
151
  });
153
- upsert(...args: ParamsToArgs<UpsertVectorParams>): Promise<string[]>;
152
+ upsert({ indexName, vectors, metadata, ids }: UpsertVectorParams): Promise<string[]>;
154
153
  transformFilter(filter?: VectorFilter): string | undefined;
155
- createIndex(..._args: ParamsToArgs<CreateIndexParams>): Promise<void>;
156
- query(...args: ParamsToArgs<QueryVectorParams>): Promise<QueryResult[]>;
154
+ createIndex(_params: CreateIndexParams): Promise<void>;
155
+ query({ indexName, queryVector, topK, filter, includeVector, }: QueryVectorParams): Promise<QueryResult[]>;
157
156
  listIndexes(): Promise<string[]>;
158
157
  /**
159
158
  * Retrieves statistics about a vector index.
160
159
  *
161
- * @param params - The parameters for describing an index
162
- * @param params.indexName - The name of the index to describe
160
+ * @param {string} indexName - The name of the index to describe
163
161
  * @returns A promise that resolves to the index statistics including dimension, count and metric
164
162
  */
165
- describeIndex(...args: ParamsToArgs<DescribeIndexParams>): Promise<IndexStats>;
166
- deleteIndex(...args: ParamsToArgs<DeleteIndexParams>): Promise<void>;
167
- /**
168
- * @deprecated Use {@link updateVector} instead. This method will be removed on May 20th, 2025.
169
- *
170
- * Updates a vector by its ID with the provided vector and/or metadata.
171
- * @param indexName - The name of the index containing the vector.
172
- * @param id - The ID of the vector to update.
173
- * @param update - An object containing the vector and/or metadata to update.
174
- * @param update.vector - An optional array of numbers representing the new vector.
175
- * @param update.metadata - An optional record containing the new metadata.
176
- * @returns A promise that resolves when the update is complete.
177
- * @throws Will throw an error if no updates are provided or if the update operation fails.
178
- */
179
- updateIndexById(indexName: string, id: string, update: {
180
- vector?: number[];
181
- metadata?: Record<string, any>;
182
- }): Promise<void>;
163
+ describeIndex({ indexName }: DescribeIndexParams): Promise<IndexStats>;
164
+ deleteIndex({ indexName }: DeleteIndexParams): Promise<void>;
183
165
  /**
184
166
  * Updates a vector by its ID with the provided vector and/or metadata.
185
167
  * @param indexName - The name of the index containing the vector.
@@ -190,17 +172,7 @@ declare class UpstashVector extends MastraVector {
190
172
  * @returns A promise that resolves when the update is complete.
191
173
  * @throws Will throw an error if no updates are provided or if the update operation fails.
192
174
  */
193
- updateVector(...args: ParamsToArgs<UpdateVectorParams>): Promise<void>;
194
- /**
195
- * @deprecated Use {@link deleteVector} instead. This method will be removed on May 20th, 2025.
196
- *
197
- * Deletes a vector by its ID.
198
- * @param indexName - The name of the index containing the vector.
199
- * @param id - The ID of the vector to delete.
200
- * @returns A promise that resolves when the deletion is complete.
201
- * @throws Will throw an error if the deletion operation fails.
202
- */
203
- deleteIndexById(indexName: string, id: string): Promise<void>;
175
+ updateVector({ indexName, id, update }: UpdateVectorParams): Promise<void>;
204
176
  /**
205
177
  * Deletes a vector by its ID.
206
178
  * @param indexName - The name of the index containing the vector.
@@ -208,7 +180,7 @@ declare class UpstashVector extends MastraVector {
208
180
  * @returns A promise that resolves when the deletion is complete.
209
181
  * @throws Will throw an error if the deletion operation fails.
210
182
  */
211
- deleteVector(...args: ParamsToArgs<DeleteVectorParams>): Promise<void>;
183
+ deleteVector({ indexName, id }: DeleteVectorParams): Promise<void>;
212
184
  }
213
185
  export { UpstashVector }
214
186
  export { UpstashVector as UpstashVector_alias_1 }
@@ -9,7 +9,6 @@ import { MastraStorage } from '@mastra/core/storage';
9
9
  import { MastraVector } from '@mastra/core/vector';
10
10
  import type { MessageType } from '@mastra/core/memory';
11
11
  import type { OperatorSupport } from '@mastra/core/vector/filter';
12
- import type { ParamsToArgs } from '@mastra/core/vector';
13
12
  import type { QueryResult } from '@mastra/core/vector';
14
13
  import type { QueryVectorParams } from '@mastra/core/vector';
15
14
  import type { StorageColumn } from '@mastra/core/storage';
@@ -150,36 +149,19 @@ declare class UpstashVector extends MastraVector {
150
149
  url: string;
151
150
  token: string;
152
151
  });
153
- upsert(...args: ParamsToArgs<UpsertVectorParams>): Promise<string[]>;
152
+ upsert({ indexName, vectors, metadata, ids }: UpsertVectorParams): Promise<string[]>;
154
153
  transformFilter(filter?: VectorFilter): string | undefined;
155
- createIndex(..._args: ParamsToArgs<CreateIndexParams>): Promise<void>;
156
- query(...args: ParamsToArgs<QueryVectorParams>): Promise<QueryResult[]>;
154
+ createIndex(_params: CreateIndexParams): Promise<void>;
155
+ query({ indexName, queryVector, topK, filter, includeVector, }: QueryVectorParams): Promise<QueryResult[]>;
157
156
  listIndexes(): Promise<string[]>;
158
157
  /**
159
158
  * Retrieves statistics about a vector index.
160
159
  *
161
- * @param params - The parameters for describing an index
162
- * @param params.indexName - The name of the index to describe
160
+ * @param {string} indexName - The name of the index to describe
163
161
  * @returns A promise that resolves to the index statistics including dimension, count and metric
164
162
  */
165
- describeIndex(...args: ParamsToArgs<DescribeIndexParams>): Promise<IndexStats>;
166
- deleteIndex(...args: ParamsToArgs<DeleteIndexParams>): Promise<void>;
167
- /**
168
- * @deprecated Use {@link updateVector} instead. This method will be removed on May 20th, 2025.
169
- *
170
- * Updates a vector by its ID with the provided vector and/or metadata.
171
- * @param indexName - The name of the index containing the vector.
172
- * @param id - The ID of the vector to update.
173
- * @param update - An object containing the vector and/or metadata to update.
174
- * @param update.vector - An optional array of numbers representing the new vector.
175
- * @param update.metadata - An optional record containing the new metadata.
176
- * @returns A promise that resolves when the update is complete.
177
- * @throws Will throw an error if no updates are provided or if the update operation fails.
178
- */
179
- updateIndexById(indexName: string, id: string, update: {
180
- vector?: number[];
181
- metadata?: Record<string, any>;
182
- }): Promise<void>;
163
+ describeIndex({ indexName }: DescribeIndexParams): Promise<IndexStats>;
164
+ deleteIndex({ indexName }: DeleteIndexParams): Promise<void>;
183
165
  /**
184
166
  * Updates a vector by its ID with the provided vector and/or metadata.
185
167
  * @param indexName - The name of the index containing the vector.
@@ -190,17 +172,7 @@ declare class UpstashVector extends MastraVector {
190
172
  * @returns A promise that resolves when the update is complete.
191
173
  * @throws Will throw an error if no updates are provided or if the update operation fails.
192
174
  */
193
- updateVector(...args: ParamsToArgs<UpdateVectorParams>): Promise<void>;
194
- /**
195
- * @deprecated Use {@link deleteVector} instead. This method will be removed on May 20th, 2025.
196
- *
197
- * Deletes a vector by its ID.
198
- * @param indexName - The name of the index containing the vector.
199
- * @param id - The ID of the vector to delete.
200
- * @returns A promise that resolves when the deletion is complete.
201
- * @throws Will throw an error if the deletion operation fails.
202
- */
203
- deleteIndexById(indexName: string, id: string): Promise<void>;
175
+ updateVector({ indexName, id, update }: UpdateVectorParams): Promise<void>;
204
176
  /**
205
177
  * Deletes a vector by its ID.
206
178
  * @param indexName - The name of the index containing the vector.
@@ -208,7 +180,7 @@ declare class UpstashVector extends MastraVector {
208
180
  * @returns A promise that resolves when the deletion is complete.
209
181
  * @throws Will throw an error if the deletion operation fails.
210
182
  */
211
- deleteVector(...args: ParamsToArgs<DeleteVectorParams>): Promise<void>;
183
+ deleteVector({ indexName, id }: DeleteVectorParams): Promise<void>;
212
184
  }
213
185
  export { UpstashVector }
214
186
  export { UpstashVector as UpstashVector_alias_1 }
package/dist/index.cjs CHANGED
@@ -675,9 +675,7 @@ var UpstashVector = class extends vector.MastraVector {
675
675
  token
676
676
  });
677
677
  }
678
- async upsert(...args) {
679
- const params = this.normalizeArgs("upsert", args);
680
- const { indexName, vectors, metadata, ids } = params;
678
+ async upsert({ indexName, vectors, metadata, ids }) {
681
679
  const generatedIds = ids || vectors.map(() => crypto.randomUUID());
682
680
  const points = vectors.map((vector, index) => ({
683
681
  id: generatedIds[index],
@@ -693,12 +691,16 @@ var UpstashVector = class extends vector.MastraVector {
693
691
  const translator = new UpstashFilterTranslator();
694
692
  return translator.translate(filter);
695
693
  }
696
- async createIndex(..._args) {
694
+ async createIndex(_params) {
697
695
  console.log("No need to call createIndex for Upstash");
698
696
  }
699
- async query(...args) {
700
- const params = this.normalizeArgs("query", args);
701
- const { indexName, queryVector, topK = 10, filter, includeVector = false } = params;
697
+ async query({
698
+ indexName,
699
+ queryVector,
700
+ topK = 10,
701
+ filter,
702
+ includeVector = false
703
+ }) {
702
704
  const ns = this.client.namespace(indexName);
703
705
  const filterString = this.transformFilter(filter);
704
706
  const results = await ns.query({
@@ -722,13 +724,10 @@ var UpstashVector = class extends vector.MastraVector {
722
724
  /**
723
725
  * Retrieves statistics about a vector index.
724
726
  *
725
- * @param params - The parameters for describing an index
726
- * @param params.indexName - The name of the index to describe
727
+ * @param {string} indexName - The name of the index to describe
727
728
  * @returns A promise that resolves to the index statistics including dimension, count and metric
728
729
  */
729
- async describeIndex(...args) {
730
- const params = this.normalizeArgs("describeIndex", args);
731
- const { indexName } = params;
730
+ async describeIndex({ indexName }) {
732
731
  const info = await this.client.info();
733
732
  return {
734
733
  dimension: info.dimension,
@@ -736,35 +735,13 @@ var UpstashVector = class extends vector.MastraVector {
736
735
  metric: info?.similarityFunction?.toLowerCase()
737
736
  };
738
737
  }
739
- async deleteIndex(...args) {
740
- const params = this.normalizeArgs("deleteIndex", args);
741
- const { indexName } = params;
738
+ async deleteIndex({ indexName }) {
742
739
  try {
743
740
  await this.client.deleteNamespace(indexName);
744
741
  } catch (error) {
745
742
  console.error("Failed to delete namespace:", error);
746
743
  }
747
744
  }
748
- /**
749
- * @deprecated Use {@link updateVector} instead. This method will be removed on May 20th, 2025.
750
- *
751
- * Updates a vector by its ID with the provided vector and/or metadata.
752
- * @param indexName - The name of the index containing the vector.
753
- * @param id - The ID of the vector to update.
754
- * @param update - An object containing the vector and/or metadata to update.
755
- * @param update.vector - An optional array of numbers representing the new vector.
756
- * @param update.metadata - An optional record containing the new metadata.
757
- * @returns A promise that resolves when the update is complete.
758
- * @throws Will throw an error if no updates are provided or if the update operation fails.
759
- */
760
- async updateIndexById(indexName, id, update) {
761
- this.logger.warn(
762
- `Deprecation Warning: updateIndexById() is deprecated.
763
- Please use updateVector() instead.
764
- updateIndexById() will be removed on May 20th, 2025.`
765
- );
766
- await this.updateVector({ indexName, id, update });
767
- }
768
745
  /**
769
746
  * Updates a vector by its ID with the provided vector and/or metadata.
770
747
  * @param indexName - The name of the index containing the vector.
@@ -775,9 +752,7 @@ var UpstashVector = class extends vector.MastraVector {
775
752
  * @returns A promise that resolves when the update is complete.
776
753
  * @throws Will throw an error if no updates are provided or if the update operation fails.
777
754
  */
778
- async updateVector(...args) {
779
- const params = this.normalizeArgs("updateVector", args);
780
- const { indexName, id, update } = params;
755
+ async updateVector({ indexName, id, update }) {
781
756
  try {
782
757
  if (!update.vector && !update.metadata) {
783
758
  throw new Error("No update data provided");
@@ -804,23 +779,6 @@ var UpstashVector = class extends vector.MastraVector {
804
779
  throw new Error(`Failed to update vector by id: ${id} for index name: ${indexName}: ${error.message}`);
805
780
  }
806
781
  }
807
- /**
808
- * @deprecated Use {@link deleteVector} instead. This method will be removed on May 20th, 2025.
809
- *
810
- * Deletes a vector by its ID.
811
- * @param indexName - The name of the index containing the vector.
812
- * @param id - The ID of the vector to delete.
813
- * @returns A promise that resolves when the deletion is complete.
814
- * @throws Will throw an error if the deletion operation fails.
815
- */
816
- async deleteIndexById(indexName, id) {
817
- this.logger.warn(
818
- `Deprecation Warning: deleteIndexById() is deprecated.
819
- Please use deleteVector() instead.
820
- deleteIndexById() will be removed on May 20th, 2025.`
821
- );
822
- await this.deleteVector({ indexName, id });
823
- }
824
782
  /**
825
783
  * Deletes a vector by its ID.
826
784
  * @param indexName - The name of the index containing the vector.
@@ -828,9 +786,7 @@ var UpstashVector = class extends vector.MastraVector {
828
786
  * @returns A promise that resolves when the deletion is complete.
829
787
  * @throws Will throw an error if the deletion operation fails.
830
788
  */
831
- async deleteVector(...args) {
832
- const params = this.normalizeArgs("deleteVector", args);
833
- const { indexName, id } = params;
789
+ async deleteVector({ indexName, id }) {
834
790
  try {
835
791
  await this.client.delete(id, {
836
792
  namespace: indexName
package/dist/index.js CHANGED
@@ -673,9 +673,7 @@ var UpstashVector = class extends MastraVector {
673
673
  token
674
674
  });
675
675
  }
676
- async upsert(...args) {
677
- const params = this.normalizeArgs("upsert", args);
678
- const { indexName, vectors, metadata, ids } = params;
676
+ async upsert({ indexName, vectors, metadata, ids }) {
679
677
  const generatedIds = ids || vectors.map(() => crypto.randomUUID());
680
678
  const points = vectors.map((vector, index) => ({
681
679
  id: generatedIds[index],
@@ -691,12 +689,16 @@ var UpstashVector = class extends MastraVector {
691
689
  const translator = new UpstashFilterTranslator();
692
690
  return translator.translate(filter);
693
691
  }
694
- async createIndex(..._args) {
692
+ async createIndex(_params) {
695
693
  console.log("No need to call createIndex for Upstash");
696
694
  }
697
- async query(...args) {
698
- const params = this.normalizeArgs("query", args);
699
- const { indexName, queryVector, topK = 10, filter, includeVector = false } = params;
695
+ async query({
696
+ indexName,
697
+ queryVector,
698
+ topK = 10,
699
+ filter,
700
+ includeVector = false
701
+ }) {
700
702
  const ns = this.client.namespace(indexName);
701
703
  const filterString = this.transformFilter(filter);
702
704
  const results = await ns.query({
@@ -720,13 +722,10 @@ var UpstashVector = class extends MastraVector {
720
722
  /**
721
723
  * Retrieves statistics about a vector index.
722
724
  *
723
- * @param params - The parameters for describing an index
724
- * @param params.indexName - The name of the index to describe
725
+ * @param {string} indexName - The name of the index to describe
725
726
  * @returns A promise that resolves to the index statistics including dimension, count and metric
726
727
  */
727
- async describeIndex(...args) {
728
- const params = this.normalizeArgs("describeIndex", args);
729
- const { indexName } = params;
728
+ async describeIndex({ indexName }) {
730
729
  const info = await this.client.info();
731
730
  return {
732
731
  dimension: info.dimension,
@@ -734,35 +733,13 @@ var UpstashVector = class extends MastraVector {
734
733
  metric: info?.similarityFunction?.toLowerCase()
735
734
  };
736
735
  }
737
- async deleteIndex(...args) {
738
- const params = this.normalizeArgs("deleteIndex", args);
739
- const { indexName } = params;
736
+ async deleteIndex({ indexName }) {
740
737
  try {
741
738
  await this.client.deleteNamespace(indexName);
742
739
  } catch (error) {
743
740
  console.error("Failed to delete namespace:", error);
744
741
  }
745
742
  }
746
- /**
747
- * @deprecated Use {@link updateVector} instead. This method will be removed on May 20th, 2025.
748
- *
749
- * Updates a vector by its ID with the provided vector and/or metadata.
750
- * @param indexName - The name of the index containing the vector.
751
- * @param id - The ID of the vector to update.
752
- * @param update - An object containing the vector and/or metadata to update.
753
- * @param update.vector - An optional array of numbers representing the new vector.
754
- * @param update.metadata - An optional record containing the new metadata.
755
- * @returns A promise that resolves when the update is complete.
756
- * @throws Will throw an error if no updates are provided or if the update operation fails.
757
- */
758
- async updateIndexById(indexName, id, update) {
759
- this.logger.warn(
760
- `Deprecation Warning: updateIndexById() is deprecated.
761
- Please use updateVector() instead.
762
- updateIndexById() will be removed on May 20th, 2025.`
763
- );
764
- await this.updateVector({ indexName, id, update });
765
- }
766
743
  /**
767
744
  * Updates a vector by its ID with the provided vector and/or metadata.
768
745
  * @param indexName - The name of the index containing the vector.
@@ -773,9 +750,7 @@ var UpstashVector = class extends MastraVector {
773
750
  * @returns A promise that resolves when the update is complete.
774
751
  * @throws Will throw an error if no updates are provided or if the update operation fails.
775
752
  */
776
- async updateVector(...args) {
777
- const params = this.normalizeArgs("updateVector", args);
778
- const { indexName, id, update } = params;
753
+ async updateVector({ indexName, id, update }) {
779
754
  try {
780
755
  if (!update.vector && !update.metadata) {
781
756
  throw new Error("No update data provided");
@@ -802,23 +777,6 @@ var UpstashVector = class extends MastraVector {
802
777
  throw new Error(`Failed to update vector by id: ${id} for index name: ${indexName}: ${error.message}`);
803
778
  }
804
779
  }
805
- /**
806
- * @deprecated Use {@link deleteVector} instead. This method will be removed on May 20th, 2025.
807
- *
808
- * Deletes a vector by its ID.
809
- * @param indexName - The name of the index containing the vector.
810
- * @param id - The ID of the vector to delete.
811
- * @returns A promise that resolves when the deletion is complete.
812
- * @throws Will throw an error if the deletion operation fails.
813
- */
814
- async deleteIndexById(indexName, id) {
815
- this.logger.warn(
816
- `Deprecation Warning: deleteIndexById() is deprecated.
817
- Please use deleteVector() instead.
818
- deleteIndexById() will be removed on May 20th, 2025.`
819
- );
820
- await this.deleteVector({ indexName, id });
821
- }
822
780
  /**
823
781
  * Deletes a vector by its ID.
824
782
  * @param indexName - The name of the index containing the vector.
@@ -826,9 +784,7 @@ var UpstashVector = class extends MastraVector {
826
784
  * @returns A promise that resolves when the deletion is complete.
827
785
  * @throws Will throw an error if the deletion operation fails.
828
786
  */
829
- async deleteVector(...args) {
830
- const params = this.normalizeArgs("deleteVector", args);
831
- const { indexName, id } = params;
787
+ async deleteVector({ indexName, id }) {
832
788
  try {
833
789
  await this.client.delete(id, {
834
790
  namespace: indexName
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/upstash",
3
- "version": "0.3.5-alpha.0",
3
+ "version": "0.4.0-alpha.1",
4
4
  "description": "Upstash provider for Mastra - includes both vector and db storage capabilities",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -21,8 +21,7 @@
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
23
  "@upstash/redis": "^1.34.5",
24
- "@upstash/vector": "^1.2.1",
25
- "@mastra/core": "^0.9.5-alpha.0"
24
+ "@upstash/vector": "^1.2.1"
26
25
  },
27
26
  "devDependencies": {
28
27
  "@microsoft/api-extractor": "^7.52.5",
@@ -32,7 +31,11 @@
32
31
  "tsup": "^8.4.0",
33
32
  "typescript": "^5.8.2",
34
33
  "vitest": "^3.1.2",
35
- "@internal/lint": "0.0.5"
34
+ "@internal/lint": "0.0.5",
35
+ "@mastra/core": "0.10.0-alpha.1"
36
+ },
37
+ "peerDependencies": {
38
+ "@mastra/core": "^0.9.4"
36
39
  },
37
40
  "scripts": {
38
41
  "pretest": "docker compose up -d",
@@ -1,7 +1,7 @@
1
1
  import type { QueryResult } from '@mastra/core/vector';
2
2
  import dotenv from 'dotenv';
3
3
 
4
- import { describe, it, expect, beforeAll, afterAll, beforeEach, vi, afterEach } from 'vitest';
4
+ import { describe, it, expect, beforeAll, afterAll, afterEach } from 'vitest';
5
5
 
6
6
  import { UpstashVector } from './';
7
7
 
@@ -1202,97 +1202,4 @@ describe.skipIf(!process.env.UPSTASH_VECTOR_URL || !process.env.UPSTASH_VECTOR_T
1202
1202
  });
1203
1203
  });
1204
1204
  });
1205
- describe('Deprecation Warnings', () => {
1206
- const indexName = 'testdeprecationwarnings';
1207
-
1208
- const indexName2 = 'testdeprecationwarnings2';
1209
-
1210
- let warnSpy;
1211
-
1212
- afterAll(async () => {
1213
- await vectorStore.deleteIndex({ indexName });
1214
- await vectorStore.deleteIndex({ indexName: indexName2 });
1215
- });
1216
-
1217
- beforeEach(async () => {
1218
- warnSpy = vi.spyOn(vectorStore['logger'], 'warn');
1219
- });
1220
-
1221
- afterEach(async () => {
1222
- warnSpy.mockRestore();
1223
- await vectorStore.deleteIndex({ indexName: indexName2 });
1224
- });
1225
-
1226
- const createVector = (primaryDimension: number, value: number = 1.0): number[] => {
1227
- const vector = new Array(VECTOR_DIMENSION).fill(0);
1228
- vector[primaryDimension] = value;
1229
- // Normalize the vector for cosine similarity
1230
- const magnitude = Math.sqrt(vector.reduce((sum, val) => sum + val * val, 0));
1231
- return vector.map(val => val / magnitude);
1232
- };
1233
-
1234
- it('should show deprecation warning when using individual args for upsert', async () => {
1235
- await vectorStore.upsert(indexName, [createVector(0, 2)], [{ test: 'data' }]);
1236
-
1237
- expect(warnSpy).toHaveBeenCalledWith(
1238
- expect.stringContaining('Deprecation Warning: Passing individual arguments to upsert() is deprecated'),
1239
- );
1240
- });
1241
-
1242
- it('should show deprecation warning when using individual args for query', async () => {
1243
- await vectorStore.query(indexName, createVector(0, 2), 5);
1244
-
1245
- expect(warnSpy).toHaveBeenCalledWith(
1246
- expect.stringContaining('Deprecation Warning: Passing individual arguments to query() is deprecated'),
1247
- );
1248
- });
1249
-
1250
- it('should not show deprecation warning when using object param for query', async () => {
1251
- await vectorStore.query({
1252
- indexName,
1253
- queryVector: createVector(0, 2),
1254
- topK: 5,
1255
- });
1256
-
1257
- expect(warnSpy).not.toHaveBeenCalled();
1258
- });
1259
-
1260
- it('should not show deprecation warning when using object param for createIndex', async () => {
1261
- await vectorStore.createIndex({
1262
- indexName: indexName2,
1263
- dimension: 3,
1264
- metric: 'cosine',
1265
- });
1266
-
1267
- expect(warnSpy).not.toHaveBeenCalled();
1268
- });
1269
-
1270
- it('should not show deprecation warning when using object param for upsert', async () => {
1271
- await vectorStore.upsert({
1272
- indexName,
1273
- vectors: [createVector(0, 2)],
1274
- metadata: [{ test: 'data' }],
1275
- });
1276
-
1277
- expect(warnSpy).not.toHaveBeenCalled();
1278
- });
1279
-
1280
- it('should maintain backward compatibility with individual args', async () => {
1281
- // Query
1282
- const queryResults = await vectorStore.query(indexName, createVector(0, 2), 5);
1283
- expect(Array.isArray(queryResults)).toBe(true);
1284
-
1285
- // CreateIndex
1286
- await expect(vectorStore.createIndex(indexName2, 3, 'cosine')).resolves.not.toThrow();
1287
-
1288
- // Upsert
1289
- const upsertResults = await vectorStore.upsert({
1290
- indexName,
1291
- vectors: [createVector(0, 2)],
1292
- metadata: [{ test: 'data' }],
1293
- });
1294
- expect(Array.isArray(upsertResults)).toBe(true);
1295
- expect(upsertResults).toHaveLength(1);
1296
- });
1297
- });
1298
1205
  });
@@ -5,7 +5,6 @@ import type {
5
5
  DeleteVectorParams,
6
6
  DescribeIndexParams,
7
7
  IndexStats,
8
- ParamsToArgs,
9
8
  QueryResult,
10
9
  QueryVectorParams,
11
10
  UpdateVectorParams,
@@ -27,11 +26,7 @@ export class UpstashVector extends MastraVector {
27
26
  });
28
27
  }
29
28
 
30
- async upsert(...args: ParamsToArgs<UpsertVectorParams>): Promise<string[]> {
31
- const params = this.normalizeArgs<UpsertVectorParams>('upsert', args);
32
-
33
- const { indexName, vectors, metadata, ids } = params;
34
-
29
+ async upsert({ indexName, vectors, metadata, ids }: UpsertVectorParams): Promise<string[]> {
35
30
  const generatedIds = ids || vectors.map(() => crypto.randomUUID());
36
31
 
37
32
  const points = vectors.map((vector, index) => ({
@@ -51,15 +46,17 @@ export class UpstashVector extends MastraVector {
51
46
  return translator.translate(filter);
52
47
  }
53
48
 
54
- async createIndex(..._args: ParamsToArgs<CreateIndexParams>): Promise<void> {
49
+ async createIndex(_params: CreateIndexParams): Promise<void> {
55
50
  console.log('No need to call createIndex for Upstash');
56
51
  }
57
52
 
58
- async query(...args: ParamsToArgs<QueryVectorParams>): Promise<QueryResult[]> {
59
- const params = this.normalizeArgs<QueryVectorParams>('query', args);
60
-
61
- const { indexName, queryVector, topK = 10, filter, includeVector = false } = params;
62
-
53
+ async query({
54
+ indexName,
55
+ queryVector,
56
+ topK = 10,
57
+ filter,
58
+ includeVector = false,
59
+ }: QueryVectorParams): Promise<QueryResult[]> {
63
60
  const ns = this.client.namespace(indexName);
64
61
 
65
62
  const filterString = this.transformFilter(filter);
@@ -88,13 +85,10 @@ export class UpstashVector extends MastraVector {
88
85
  /**
89
86
  * Retrieves statistics about a vector index.
90
87
  *
91
- * @param params - The parameters for describing an index
92
- * @param params.indexName - The name of the index to describe
88
+ * @param {string} indexName - The name of the index to describe
93
89
  * @returns A promise that resolves to the index statistics including dimension, count and metric
94
90
  */
95
- async describeIndex(...args: ParamsToArgs<DescribeIndexParams>): Promise<IndexStats> {
96
- const params = this.normalizeArgs<DescribeIndexParams>('describeIndex', args);
97
- const { indexName } = params;
91
+ async describeIndex({ indexName }: DescribeIndexParams): Promise<IndexStats> {
98
92
  const info = await this.client.info();
99
93
 
100
94
  return {
@@ -104,9 +98,7 @@ export class UpstashVector extends MastraVector {
104
98
  };
105
99
  }
106
100
 
107
- async deleteIndex(...args: ParamsToArgs<DeleteIndexParams>): Promise<void> {
108
- const params = this.normalizeArgs<DeleteIndexParams>('deleteIndex', args);
109
- const { indexName } = params;
101
+ async deleteIndex({ indexName }: DeleteIndexParams): Promise<void> {
110
102
  try {
111
103
  await this.client.deleteNamespace(indexName);
112
104
  } catch (error) {
@@ -115,8 +107,6 @@ export class UpstashVector extends MastraVector {
115
107
  }
116
108
 
117
109
  /**
118
- * @deprecated Use {@link updateVector} instead. This method will be removed on May 20th, 2025.
119
- *
120
110
  * Updates a vector by its ID with the provided vector and/or metadata.
121
111
  * @param indexName - The name of the index containing the vector.
122
112
  * @param id - The ID of the vector to update.
@@ -126,32 +116,7 @@ export class UpstashVector extends MastraVector {
126
116
  * @returns A promise that resolves when the update is complete.
127
117
  * @throws Will throw an error if no updates are provided or if the update operation fails.
128
118
  */
129
- async updateIndexById(
130
- indexName: string,
131
- id: string,
132
- update: { vector?: number[]; metadata?: Record<string, any> },
133
- ): Promise<void> {
134
- this.logger.warn(
135
- `Deprecation Warning: updateIndexById() is deprecated.
136
- Please use updateVector() instead.
137
- updateIndexById() will be removed on May 20th, 2025.`,
138
- );
139
- await this.updateVector({ indexName, id, update });
140
- }
141
-
142
- /**
143
- * Updates a vector by its ID with the provided vector and/or metadata.
144
- * @param indexName - The name of the index containing the vector.
145
- * @param id - The ID of the vector to update.
146
- * @param update - An object containing the vector and/or metadata to update.
147
- * @param update.vector - An optional array of numbers representing the new vector.
148
- * @param update.metadata - An optional record containing the new metadata.
149
- * @returns A promise that resolves when the update is complete.
150
- * @throws Will throw an error if no updates are provided or if the update operation fails.
151
- */
152
- async updateVector(...args: ParamsToArgs<UpdateVectorParams>): Promise<void> {
153
- const params = this.normalizeArgs<UpdateVectorParams>('updateVector', args);
154
- const { indexName, id, update } = params;
119
+ async updateVector({ indexName, id, update }: UpdateVectorParams): Promise<void> {
155
120
  try {
156
121
  if (!update.vector && !update.metadata) {
157
122
  throw new Error('No update data provided');
@@ -185,24 +150,6 @@ export class UpstashVector extends MastraVector {
185
150
  }
186
151
  }
187
152
 
188
- /**
189
- * @deprecated Use {@link deleteVector} instead. This method will be removed on May 20th, 2025.
190
- *
191
- * Deletes a vector by its ID.
192
- * @param indexName - The name of the index containing the vector.
193
- * @param id - The ID of the vector to delete.
194
- * @returns A promise that resolves when the deletion is complete.
195
- * @throws Will throw an error if the deletion operation fails.
196
- */
197
- async deleteIndexById(indexName: string, id: string): Promise<void> {
198
- this.logger.warn(
199
- `Deprecation Warning: deleteIndexById() is deprecated.
200
- Please use deleteVector() instead.
201
- deleteIndexById() will be removed on May 20th, 2025.`,
202
- );
203
- await this.deleteVector({ indexName, id });
204
- }
205
-
206
153
  /**
207
154
  * Deletes a vector by its ID.
208
155
  * @param indexName - The name of the index containing the vector.
@@ -210,9 +157,7 @@ export class UpstashVector extends MastraVector {
210
157
  * @returns A promise that resolves when the deletion is complete.
211
158
  * @throws Will throw an error if the deletion operation fails.
212
159
  */
213
- async deleteVector(...args: ParamsToArgs<DeleteVectorParams>): Promise<void> {
214
- const params = this.normalizeArgs<DeleteVectorParams>('deleteVector', args);
215
- const { indexName, id } = params;
160
+ async deleteVector({ indexName, id }: DeleteVectorParams): Promise<void> {
216
161
  try {
217
162
  await this.client.delete(id, {
218
163
  namespace: indexName,