@mastra/couchbase 0.0.0-support-d1-client-20250701191943 → 0.0.0-taofeeq-fix-tool-call-showing-after-message-20250806162745

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,22 +1,89 @@
1
1
  # @mastra/couchbase
2
2
 
3
- ## 0.0.0-support-d1-client-20250701191943
3
+ ## 0.0.0-taofeeq-fix-tool-call-showing-after-message-20250806162745
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - Updated dependencies [9dda1ac]
8
- - Updated dependencies [7e801dd]
9
- - Updated dependencies [a606c75]
10
- - Updated dependencies [7aa70a4]
11
- - Updated dependencies [764f86a]
12
- - Updated dependencies [1760a1c]
13
- - Updated dependencies [038e5ae]
14
- - Updated dependencies [7dda16a]
15
- - Updated dependencies [4e809ad]
16
- - Updated dependencies [57929df]
17
- - Updated dependencies [b7852ed]
18
- - Updated dependencies [6320a61]
19
- - @mastra/core@0.0.0-support-d1-client-20250701191943
7
+ - Updated dependencies [8388649]
8
+ - @mastra/core@0.0.0-taofeeq-fix-tool-call-showing-after-message-20250806162745
9
+
10
+ ## 0.11.3
11
+
12
+ ### Patch Changes
13
+
14
+ - 4a406ec: fixes TypeScript declaration file imports to ensure proper ESM compatibility
15
+ - Updated dependencies [cb36de0]
16
+ - Updated dependencies [d0496e6]
17
+ - Updated dependencies [a82b851]
18
+ - Updated dependencies [ea0c5f2]
19
+ - Updated dependencies [41a0a0e]
20
+ - Updated dependencies [2871020]
21
+ - Updated dependencies [94f4812]
22
+ - Updated dependencies [e202b82]
23
+ - Updated dependencies [e00f6a0]
24
+ - Updated dependencies [4a406ec]
25
+ - Updated dependencies [b0e43c1]
26
+ - Updated dependencies [5d377e5]
27
+ - Updated dependencies [1fb812e]
28
+ - Updated dependencies [35c5798]
29
+ - @mastra/core@0.13.0
30
+
31
+ ## 0.11.3-alpha.0
32
+
33
+ ### Patch Changes
34
+
35
+ - 4a406ec: fixes TypeScript declaration file imports to ensure proper ESM compatibility
36
+ - Updated dependencies [cb36de0]
37
+ - Updated dependencies [a82b851]
38
+ - Updated dependencies [41a0a0e]
39
+ - Updated dependencies [2871020]
40
+ - Updated dependencies [4a406ec]
41
+ - Updated dependencies [5d377e5]
42
+ - @mastra/core@0.13.0-alpha.2
43
+
44
+ ## 0.11.2
45
+
46
+ ### Patch Changes
47
+
48
+ - f42c4c2: update peer deps for packages to latest core range
49
+ - Updated dependencies [510e2c8]
50
+ - Updated dependencies [2f72fb2]
51
+ - Updated dependencies [27cc97a]
52
+ - Updated dependencies [3f89307]
53
+ - Updated dependencies [9eda7d4]
54
+ - Updated dependencies [9d49408]
55
+ - Updated dependencies [41daa63]
56
+ - Updated dependencies [ad0a58b]
57
+ - Updated dependencies [254a36b]
58
+ - Updated dependencies [2ecf658]
59
+ - Updated dependencies [7a7754f]
60
+ - Updated dependencies [fc92d80]
61
+ - Updated dependencies [e0f73c6]
62
+ - Updated dependencies [0b89602]
63
+ - Updated dependencies [4d37822]
64
+ - Updated dependencies [23a6a7c]
65
+ - Updated dependencies [cda801d]
66
+ - Updated dependencies [a77c823]
67
+ - Updated dependencies [ff9c125]
68
+ - Updated dependencies [09bca64]
69
+ - Updated dependencies [b8efbb9]
70
+ - Updated dependencies [71466e7]
71
+ - Updated dependencies [0c99fbe]
72
+ - @mastra/core@0.12.0
73
+
74
+ ## 0.11.2-alpha.0
75
+
76
+ ### Patch Changes
77
+
78
+ - f42c4c2: update peer deps for packages to latest core range
79
+ - @mastra/core@0.12.0-alpha.5
80
+
81
+ ## 0.11.1
82
+
83
+ ### Patch Changes
84
+
85
+ - ce088f5: Update all peerdeps to latest core
86
+ - @mastra/core@0.11.1
20
87
 
21
88
  ## 0.11.0
22
89
 
package/LICENSE.md CHANGED
@@ -1,46 +1,15 @@
1
- # Elastic License 2.0 (ELv2)
1
+ # Apache License 2.0
2
2
 
3
- Copyright (c) 2025 Mastra AI, Inc.
3
+ Copyright (c) 2025 Kepler Software, Inc.
4
4
 
5
- **Acceptance**
6
- By using the software, you agree to all of the terms and conditions below.
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
7
8
 
8
- **Copyright License**
9
- The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject to the limitations and conditions below
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
10
 
11
- **Limitations**
12
- You may not provide the software to third parties as a hosted or managed service, where the service provides users with access to any substantial set of the features or functionality of the software.
13
-
14
- You may not move, change, disable, or circumvent the license key functionality in the software, and you may not remove or obscure any functionality in the software that is protected by the license key.
15
-
16
- You may not alter, remove, or obscure any licensing, copyright, or other notices of the licensor in the software. Any use of the licensor’s trademarks is subject to applicable law.
17
-
18
- **Patents**
19
- The licensor grants you a license, under any patent claims the licensor can license, or becomes able to license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case subject to the limitations and conditions in this license. This license does not cover any patent claims that you cause to be infringed by modifications or additions to the software. If you or your company make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
20
-
21
- **Notices**
22
- You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms.
23
-
24
- If you modify the software, you must include in any modified copies of the software prominent notices stating that you have modified the software.
25
-
26
- **No Other Rights**
27
- These terms do not imply any licenses other than those expressly granted in these terms.
28
-
29
- **Termination**
30
- If you use the software in violation of these terms, such use is not licensed, and your licenses will automatically terminate. If the licensor provides you with a notice of your violation, and you cease all violation of this license no later than 30 days after you receive that notice, your licenses will be reinstated retroactively. However, if you violate these terms after such reinstatement, any additional violation of these terms will cause your licenses to terminate automatically and permanently.
31
-
32
- **No Liability**
33
- As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.
34
-
35
- **Definitions**
36
- The _licensor_ is the entity offering these terms, and the _software_ is the software the licensor makes available under these terms, including any portion of it.
37
-
38
- _you_ refers to the individual or entity agreeing to these terms.
39
-
40
- _your company_ is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. _control_ means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
41
-
42
- _your licenses_ are all the licenses granted to you for the software under these terms.
43
-
44
- _use_ means anything you do with the software requiring one of your licenses.
45
-
46
- _trademark_ means trademarks, service marks, and similar rights.
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
package/dist/index.cjs CHANGED
@@ -452,3 +452,5 @@ var CouchbaseVector = class extends vector.MastraVector {
452
452
 
453
453
  exports.CouchbaseVector = CouchbaseVector;
454
454
  exports.DISTANCE_MAPPING = DISTANCE_MAPPING;
455
+ //# sourceMappingURL=index.cjs.map
456
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/vector/index.ts"],"names":["MastraVector","connect","error","MastraError","ErrorDomain","ErrorCategory","SearchRequest","VectorSearch","VectorQuery","MutateInSpec"],"mappings":";;;;;;;AAkBO,IAAM,gBAAA,GAA0D;AAAA,EACrE,MAAA,EAAQ,QAAA;AAAA,EACR,SAAA,EAAW,SAAA;AAAA,EACX,UAAA,EAAY;AACd;AAWO,IAAM,eAAA,GAAN,cAA8BA,mBAAA,CAAa;AAAA,EACxC,cAAA;AAAA,EACA,OAAA;AAAA,EACA,UAAA;AAAA,EACA,cAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AAAA,EACA,MAAA;AAAA,EACA,KAAA;AAAA,EACA,gBAAA;AAAA,EAER,WAAA,CAAY,EAAE,gBAAA,EAAkB,QAAA,EAAU,UAAU,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,IAAM,IAAI,OAAA,EAAS,QAAA,CAAS,oBAAoB,CAAA,EAAG;AAClE,UAAA,MAAM,IAAI,KAAA,CAAM,CAAA,eAAA,EAAkB,EAAE,CAAA,eAAA,CAAiB,CAAA;AAAA,QACvD;AACA,QAAA,MAAM,GAAA;AAAA,MACR;AAEA,MAAA,MAAM,UAAA,CAAW,OAAO,EAAE,CAAA;AAAA,IAC5B,SAASA,OAAA,EAAO;AACd,MAAA,MAAM,IAAIC,iBAAA;AAAA,QACR;AAAA,UACE,EAAA,EAAI,gCAAA;AAAA,UACJ,QAAQC,iBAAA,CAAY,OAAA;AAAA,UACpB,UAAUC,mBAAA,CAAc,WAAA;AAAA,UACxB,OAAA,EAAS;AAAA,YACP;AAAA;AACF,SACF;AAAA,QACAH;AAAA,OACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM,UAAA,GAAa;AACjB,IAAA,IAAI;AACF,MAAA,IAAI,CAAC,KAAK,OAAA,EAAS;AACjB,QAAA;AAAA,MACF;AACA,MAAA,MAAM,IAAA,CAAK,QAAQ,KAAA,EAAM;AAAA,IAC3B,SAASA,OAAA,EAAO;AACd,MAAA,MAAM,IAAIC,iBAAA;AAAA,QACR;AAAA,UACE,EAAA,EAAI,oCAAA;AAAA,UACJ,QAAQC,iBAAA,CAAY,OAAA;AAAA,UACpB,UAAUC,mBAAA,CAAc;AAAA,SAC1B;AAAA,QACAH;AAAA,OACF;AAAA,IACF;AAAA,EACF;AACF","file":"index.cjs","sourcesContent":["import { ErrorCategory, ErrorDomain, MastraError } from '@mastra/core/error';\nimport { MastraVector } from '@mastra/core/vector';\nimport type {\n QueryResult,\n IndexStats,\n CreateIndexParams,\n UpsertVectorParams,\n QueryVectorParams,\n DescribeIndexParams,\n DeleteIndexParams,\n DeleteVectorParams,\n UpdateVectorParams,\n} from '@mastra/core/vector';\nimport type { Bucket, Cluster, Collection, Scope } from 'couchbase';\nimport { MutateInSpec, connect, SearchRequest, VectorQuery, VectorSearch } from 'couchbase';\n\ntype MastraMetric = 'cosine' | 'euclidean' | 'dotproduct';\ntype CouchbaseMetric = 'cosine' | 'l2_norm' | 'dot_product';\nexport const DISTANCE_MAPPING: Record<MastraMetric, CouchbaseMetric> = {\n cosine: 'cosine',\n euclidean: 'l2_norm',\n dotproduct: 'dot_product',\n};\n\nexport type CouchbaseVectorParams = {\n connectionString: string;\n username: string;\n password: string;\n bucketName: string;\n scopeName: string;\n collectionName: string;\n};\n\nexport class CouchbaseVector extends MastraVector {\n private clusterPromise: Promise<Cluster>;\n private cluster: Cluster;\n private bucketName: string;\n private collectionName: string;\n private scopeName: string;\n private collection: Collection;\n private bucket: Bucket;\n private scope: Scope;\n private vector_dimension: number;\n\n constructor({ connectionString, username, password, bucketName, scopeName, collectionName }: CouchbaseVectorParams) {\n super();\n\n try {\n const baseClusterPromise = connect(connectionString, {\n username,\n password,\n configProfile: 'wanDevelopment',\n });\n\n const telemetry = this.__getTelemetry();\n this.clusterPromise =\n telemetry?.traceClass(baseClusterPromise, {\n spanNamePrefix: 'couchbase-vector',\n attributes: {\n 'vector.type': 'couchbase',\n },\n }) ?? baseClusterPromise;\n this.cluster = null as unknown as Cluster;\n this.bucketName = bucketName;\n this.collectionName = collectionName;\n this.scopeName = scopeName;\n this.collection = null as unknown as Collection;\n this.bucket = null as unknown as Bucket;\n this.scope = null as unknown as Scope;\n this.vector_dimension = null as unknown as number;\n } catch (error) {\n throw new MastraError(\n {\n id: 'COUCHBASE_VECTOR_INITIALIZE_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: {\n connectionString,\n username,\n password,\n bucketName,\n scopeName,\n collectionName,\n },\n },\n error,\n );\n }\n }\n\n async getCollection() {\n if (!this.cluster) {\n this.cluster = await this.clusterPromise;\n }\n\n if (!this.collection) {\n this.bucket = this.cluster.bucket(this.bucketName);\n this.scope = this.bucket.scope(this.scopeName);\n this.collection = this.scope.collection(this.collectionName);\n }\n\n return this.collection;\n }\n\n async createIndex({ indexName, dimension, metric = 'dotproduct' as MastraMetric }: CreateIndexParams): Promise<void> {\n try {\n await this.getCollection();\n\n if (!Number.isInteger(dimension) || dimension <= 0) {\n throw new Error('Dimension must be a positive integer');\n }\n\n await this.scope.searchIndexes().upsertIndex({\n name: indexName,\n sourceName: this.bucketName,\n type: 'fulltext-index',\n params: {\n doc_config: {\n docid_prefix_delim: '',\n docid_regexp: '',\n mode: 'scope.collection.type_field',\n type_field: 'type',\n },\n mapping: {\n default_analyzer: 'standard',\n default_datetime_parser: 'dateTimeOptional',\n default_field: '_all',\n default_mapping: {\n dynamic: true,\n enabled: false,\n },\n default_type: '_default',\n docvalues_dynamic: true, // [Doc](https://docs.couchbase.com/server/current/search/search-index-params.html#params) mentions this attribute is required for vector search to return the indexed field\n index_dynamic: true,\n store_dynamic: true, // [Doc](https://docs.couchbase.com/server/current/search/search-index-params.html#params) mentions this attribute is required for vector search to return the indexed field\n type_field: '_type',\n types: {\n [`${this.scopeName}.${this.collectionName}`]: {\n dynamic: true,\n enabled: true,\n properties: {\n embedding: {\n enabled: true,\n fields: [\n {\n dims: dimension,\n index: true,\n name: 'embedding',\n similarity: DISTANCE_MAPPING[metric],\n type: 'vector',\n vector_index_optimized_for: 'recall',\n store: true, // CHANGED due to https://docs.couchbase.com/server/current/search/search-index-params.html#fields\n docvalues: true, // CHANGED due to https://docs.couchbase.com/server/current/search/search-index-params.html#fields\n include_term_vectors: true, // CHANGED due to https://docs.couchbase.com/server/current/search/search-index-params.html#fields\n },\n ],\n },\n content: {\n enabled: true,\n fields: [\n {\n index: true,\n name: 'content',\n store: true,\n type: 'text',\n },\n ],\n },\n },\n },\n },\n },\n store: {\n indexType: 'scorch',\n segmentVersion: 16,\n },\n },\n sourceUuid: '',\n sourceParams: {},\n sourceType: 'gocbcore',\n planParams: {\n maxPartitionsPerPIndex: 64,\n indexPartitions: 16,\n numReplicas: 0,\n },\n });\n this.vector_dimension = dimension;\n } catch (error: any) {\n // Check for 'already exists' error (Couchbase may throw a 400 or 409, or have a message)\n const message = error?.message || error?.toString();\n if (message && message.toLowerCase().includes('index exists')) {\n // Fetch index info and check dimension\n await this.validateExistingIndex(indexName, dimension, metric);\n return;\n }\n throw new MastraError(\n {\n id: 'COUCHBASE_VECTOR_CREATE_INDEX_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: {\n indexName,\n dimension,\n metric,\n },\n },\n error,\n );\n }\n }\n\n async upsert({ vectors, metadata, ids }: UpsertVectorParams): Promise<string[]> {\n try {\n await this.getCollection();\n\n if (!vectors || vectors.length === 0) {\n throw new Error('No vectors provided');\n }\n if (this.vector_dimension) {\n for (const vector of vectors) {\n if (!vector || this.vector_dimension !== vector.length) {\n throw new Error('Vector dimension mismatch');\n }\n }\n }\n\n const pointIds = ids || vectors.map(() => crypto.randomUUID());\n const records = vectors.map((vector, i) => {\n const metadataObj = metadata?.[i] || {};\n const record: Record<string, any> = {\n embedding: vector,\n metadata: metadataObj,\n };\n // If metadata has a text field, save it as content\n if (metadataObj.text) {\n record.content = metadataObj.text;\n }\n return record;\n });\n\n const allPromises = [];\n for (let i = 0; i < records.length; i++) {\n allPromises.push(this.collection.upsert(pointIds[i]!, records[i]));\n }\n await Promise.all(allPromises);\n\n return pointIds;\n } catch (error) {\n throw new MastraError(\n {\n id: 'COUCHBASE_VECTOR_UPSERT_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n },\n error,\n );\n }\n }\n\n async query({ indexName, queryVector, topK = 10, includeVector = false }: QueryVectorParams): Promise<QueryResult[]> {\n try {\n await this.getCollection();\n\n const index_stats = await this.describeIndex({ indexName });\n if (queryVector.length !== index_stats.dimension) {\n throw new Error(\n `Query vector dimension mismatch. Expected ${index_stats.dimension}, got ${queryVector.length}`,\n );\n }\n\n let request = SearchRequest.create(\n VectorSearch.fromVectorQuery(VectorQuery.create('embedding', queryVector).numCandidates(topK)),\n );\n const results = await this.scope.search(indexName, request, {\n fields: ['*'],\n });\n\n if (includeVector) {\n throw new Error('Including vectors in search results is not yet supported by the Couchbase vector store');\n }\n const output = [];\n for (const match of results.rows) {\n const cleanedMetadata: Record<string, any> = {};\n const fields = (match.fields as Record<string, any>) || {}; // Ensure fields is an object\n for (const key in fields) {\n if (Object.prototype.hasOwnProperty.call(fields, key)) {\n const newKey = key.startsWith('metadata.') ? key.substring('metadata.'.length) : key;\n cleanedMetadata[newKey] = fields[key];\n }\n }\n output.push({\n id: match.id as string,\n score: (match.score as number) || 0,\n metadata: cleanedMetadata, // Use the cleaned metadata object\n });\n }\n return output;\n } catch (error) {\n throw new MastraError(\n {\n id: 'COUCHBASE_VECTOR_QUERY_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: {\n indexName,\n topK,\n },\n },\n error,\n );\n }\n }\n\n async listIndexes(): Promise<string[]> {\n try {\n await this.getCollection();\n const indexes = await this.scope.searchIndexes().getAllIndexes();\n return indexes?.map(index => index.name) || [];\n } catch (error) {\n throw new MastraError(\n {\n id: 'COUCHBASE_VECTOR_LIST_INDEXES_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n },\n error,\n );\n }\n }\n\n /**\n * Retrieves statistics about a vector index.\n *\n * @param {string} indexName - The name of the index to describe\n * @returns A promise that resolves to the index statistics including dimension, count and metric\n */\n async describeIndex({ indexName }: DescribeIndexParams): Promise<IndexStats> {\n try {\n await this.getCollection();\n if (!(await this.listIndexes()).includes(indexName)) {\n throw new Error(`Index ${indexName} does not exist`);\n }\n const index = await this.scope.searchIndexes().getIndex(indexName);\n const dimensions =\n index.params.mapping?.types?.[`${this.scopeName}.${this.collectionName}`]?.properties?.embedding?.fields?.[0]\n ?.dims;\n const count = -1; // Not added support yet for adding a count of documents covered by an index\n const metric = index.params.mapping?.types?.[`${this.scopeName}.${this.collectionName}`]?.properties?.embedding\n ?.fields?.[0]?.similarity as CouchbaseMetric;\n return {\n dimension: dimensions,\n count: count,\n metric: Object.keys(DISTANCE_MAPPING).find(\n key => DISTANCE_MAPPING[key as MastraMetric] === metric,\n ) as MastraMetric,\n };\n } catch (error) {\n throw new MastraError(\n {\n id: 'COUCHBASE_VECTOR_DESCRIBE_INDEX_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: {\n indexName,\n },\n },\n error,\n );\n }\n }\n\n async deleteIndex({ indexName }: DeleteIndexParams): Promise<void> {\n try {\n await this.getCollection();\n if (!(await this.listIndexes()).includes(indexName)) {\n throw new Error(`Index ${indexName} does not exist`);\n }\n await this.scope.searchIndexes().dropIndex(indexName);\n this.vector_dimension = null as unknown as number;\n } catch (error) {\n if (error instanceof MastraError) {\n throw error;\n }\n throw new MastraError(\n {\n id: 'COUCHBASE_VECTOR_DELETE_INDEX_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: {\n indexName,\n },\n },\n error,\n );\n }\n }\n\n /**\n * Updates a vector by its ID with the provided vector and/or metadata.\n * @param indexName - The name of the index containing the vector.\n * @param id - The ID of the vector to update.\n * @param update - An object containing the vector and/or metadata to update.\n * @param update.vector - An optional array of numbers representing the new vector.\n * @param update.metadata - An optional record containing the new metadata.\n * @returns A promise that resolves when the update is complete.\n * @throws Will throw an error if no updates are provided or if the update operation fails.\n */\n async updateVector({ id, update }: UpdateVectorParams): Promise<void> {\n try {\n if (!update.vector && !update.metadata) {\n throw new Error('No updates provided');\n }\n if (update.vector && this.vector_dimension && update.vector.length !== this.vector_dimension) {\n throw new Error('Vector dimension mismatch');\n }\n const collection = await this.getCollection();\n\n // Check if document exists\n try {\n await collection.get(id);\n } catch (err: any) {\n if (err.code === 13 || err.message?.includes('document not found')) {\n throw new Error(`Vector with id ${id} does not exist`);\n }\n throw err;\n }\n\n const specs: MutateInSpec[] = [];\n if (update.vector) specs.push(MutateInSpec.replace('embedding', update.vector));\n if (update.metadata) specs.push(MutateInSpec.replace('metadata', update.metadata));\n\n await collection.mutateIn(id, specs);\n } catch (error) {\n throw new MastraError(\n {\n id: 'COUCHBASE_VECTOR_UPDATE_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: {\n id,\n hasVectorUpdate: !!update.vector,\n hasMetadataUpdate: !!update.metadata,\n },\n },\n error,\n );\n }\n }\n\n /**\n * Deletes a vector by its ID.\n * @param indexName - The name of the index containing the vector.\n * @param id - The ID of the vector to delete.\n * @returns A promise that resolves when the deletion is complete.\n * @throws Will throw an error if the deletion operation fails.\n */\n async deleteVector({ id }: DeleteVectorParams): Promise<void> {\n try {\n const collection = await this.getCollection();\n\n // Check if document exists\n try {\n await collection.get(id);\n } catch (err: any) {\n if (err.code === 13 || err.message?.includes('document not found')) {\n throw new Error(`Vector with id ${id} does not exist`);\n }\n throw err;\n }\n\n await collection.remove(id);\n } catch (error) {\n throw new MastraError(\n {\n id: 'COUCHBASE_VECTOR_DELETE_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: {\n id,\n },\n },\n error,\n );\n }\n }\n\n async disconnect() {\n try {\n if (!this.cluster) {\n return;\n }\n await this.cluster.close();\n } catch (error) {\n throw new MastraError(\n {\n id: 'COUCHBASE_VECTOR_DISCONNECT_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n },\n error,\n );\n }\n }\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
- export { DISTANCE_MAPPING } from './_tsup-dts-rollup.js';
2
- export { CouchbaseVectorParams } from './_tsup-dts-rollup.js';
3
- export { CouchbaseVector } from './_tsup-dts-rollup.js';
1
+ export * from './vector/index.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
package/dist/index.js CHANGED
@@ -449,3 +449,5 @@ var CouchbaseVector = class extends MastraVector {
449
449
  };
450
450
 
451
451
  export { CouchbaseVector, DISTANCE_MAPPING };
452
+ //# sourceMappingURL=index.js.map
453
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/vector/index.ts"],"names":[],"mappings":";;;;;AAkBO,IAAM,gBAAA,GAA0D;AAAA,EACrE,MAAA,EAAQ,QAAA;AAAA,EACR,SAAA,EAAW,SAAA;AAAA,EACX,UAAA,EAAY;AACd;AAWO,IAAM,eAAA,GAAN,cAA8B,YAAA,CAAa;AAAA,EACxC,cAAA;AAAA,EACA,OAAA;AAAA,EACA,UAAA;AAAA,EACA,cAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AAAA,EACA,MAAA;AAAA,EACA,KAAA;AAAA,EACA,gBAAA;AAAA,EAER,WAAA,CAAY,EAAE,gBAAA,EAAkB,QAAA,EAAU,UAAU,UAAA,EAAY,SAAA,EAAW,gBAAe,EAA0B;AAClH,IAAA,KAAA,EAAM;AAEN,IAAA,IAAI;AACF,MAAA,MAAM,kBAAA,GAAqB,QAAQ,gBAAA,EAAkB;AAAA,QACnD,QAAA;AAAA,QACA,QAAA;AAAA,QACA,aAAA,EAAe;AAAA,OAChB,CAAA;AAED,MAAA,MAAM,SAAA,GAAY,KAAK,cAAA,EAAe;AACtC,MAAA,IAAA,CAAK,cAAA,GACH,SAAA,EAAW,UAAA,CAAW,kBAAA,EAAoB;AAAA,QACxC,cAAA,EAAgB,kBAAA;AAAA,QAChB,UAAA,EAAY;AAAA,UACV,aAAA,EAAe;AAAA;AACjB,OACD,CAAA,IAAK,kBAAA;AACR,MAAA,IAAA,CAAK,OAAA,GAAU,IAAA;AACf,MAAA,IAAA,CAAK,UAAA,GAAa,UAAA;AAClB,MAAA,IAAA,CAAK,cAAA,GAAiB,cAAA;AACtB,MAAA,IAAA,CAAK,SAAA,GAAY,SAAA;AACjB,MAAA,IAAA,CAAK,UAAA,GAAa,IAAA;AAClB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AAA,UACE,EAAA,EAAI,oCAAA;AAAA,UACJ,QAAQ,WAAA,CAAY,OAAA;AAAA,UACpB,UAAU,aAAA,CAAc;AAAA,SAC1B;AAAA,QACA;AAAA,OACF;AAAA,IACF;AAAA,EACF;AACF","file":"index.js","sourcesContent":["import { ErrorCategory, ErrorDomain, MastraError } from '@mastra/core/error';\nimport { MastraVector } from '@mastra/core/vector';\nimport type {\n QueryResult,\n IndexStats,\n CreateIndexParams,\n UpsertVectorParams,\n QueryVectorParams,\n DescribeIndexParams,\n DeleteIndexParams,\n DeleteVectorParams,\n UpdateVectorParams,\n} from '@mastra/core/vector';\nimport type { Bucket, Cluster, Collection, Scope } from 'couchbase';\nimport { MutateInSpec, connect, SearchRequest, VectorQuery, VectorSearch } from 'couchbase';\n\ntype MastraMetric = 'cosine' | 'euclidean' | 'dotproduct';\ntype CouchbaseMetric = 'cosine' | 'l2_norm' | 'dot_product';\nexport const DISTANCE_MAPPING: Record<MastraMetric, CouchbaseMetric> = {\n cosine: 'cosine',\n euclidean: 'l2_norm',\n dotproduct: 'dot_product',\n};\n\nexport type CouchbaseVectorParams = {\n connectionString: string;\n username: string;\n password: string;\n bucketName: string;\n scopeName: string;\n collectionName: string;\n};\n\nexport class CouchbaseVector extends MastraVector {\n private clusterPromise: Promise<Cluster>;\n private cluster: Cluster;\n private bucketName: string;\n private collectionName: string;\n private scopeName: string;\n private collection: Collection;\n private bucket: Bucket;\n private scope: Scope;\n private vector_dimension: number;\n\n constructor({ connectionString, username, password, bucketName, scopeName, collectionName }: CouchbaseVectorParams) {\n super();\n\n try {\n const baseClusterPromise = connect(connectionString, {\n username,\n password,\n configProfile: 'wanDevelopment',\n });\n\n const telemetry = this.__getTelemetry();\n this.clusterPromise =\n telemetry?.traceClass(baseClusterPromise, {\n spanNamePrefix: 'couchbase-vector',\n attributes: {\n 'vector.type': 'couchbase',\n },\n }) ?? baseClusterPromise;\n this.cluster = null as unknown as Cluster;\n this.bucketName = bucketName;\n this.collectionName = collectionName;\n this.scopeName = scopeName;\n this.collection = null as unknown as Collection;\n this.bucket = null as unknown as Bucket;\n this.scope = null as unknown as Scope;\n this.vector_dimension = null as unknown as number;\n } catch (error) {\n throw new MastraError(\n {\n id: 'COUCHBASE_VECTOR_INITIALIZE_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: {\n connectionString,\n username,\n password,\n bucketName,\n scopeName,\n collectionName,\n },\n },\n error,\n );\n }\n }\n\n async getCollection() {\n if (!this.cluster) {\n this.cluster = await this.clusterPromise;\n }\n\n if (!this.collection) {\n this.bucket = this.cluster.bucket(this.bucketName);\n this.scope = this.bucket.scope(this.scopeName);\n this.collection = this.scope.collection(this.collectionName);\n }\n\n return this.collection;\n }\n\n async createIndex({ indexName, dimension, metric = 'dotproduct' as MastraMetric }: CreateIndexParams): Promise<void> {\n try {\n await this.getCollection();\n\n if (!Number.isInteger(dimension) || dimension <= 0) {\n throw new Error('Dimension must be a positive integer');\n }\n\n await this.scope.searchIndexes().upsertIndex({\n name: indexName,\n sourceName: this.bucketName,\n type: 'fulltext-index',\n params: {\n doc_config: {\n docid_prefix_delim: '',\n docid_regexp: '',\n mode: 'scope.collection.type_field',\n type_field: 'type',\n },\n mapping: {\n default_analyzer: 'standard',\n default_datetime_parser: 'dateTimeOptional',\n default_field: '_all',\n default_mapping: {\n dynamic: true,\n enabled: false,\n },\n default_type: '_default',\n docvalues_dynamic: true, // [Doc](https://docs.couchbase.com/server/current/search/search-index-params.html#params) mentions this attribute is required for vector search to return the indexed field\n index_dynamic: true,\n store_dynamic: true, // [Doc](https://docs.couchbase.com/server/current/search/search-index-params.html#params) mentions this attribute is required for vector search to return the indexed field\n type_field: '_type',\n types: {\n [`${this.scopeName}.${this.collectionName}`]: {\n dynamic: true,\n enabled: true,\n properties: {\n embedding: {\n enabled: true,\n fields: [\n {\n dims: dimension,\n index: true,\n name: 'embedding',\n similarity: DISTANCE_MAPPING[metric],\n type: 'vector',\n vector_index_optimized_for: 'recall',\n store: true, // CHANGED due to https://docs.couchbase.com/server/current/search/search-index-params.html#fields\n docvalues: true, // CHANGED due to https://docs.couchbase.com/server/current/search/search-index-params.html#fields\n include_term_vectors: true, // CHANGED due to https://docs.couchbase.com/server/current/search/search-index-params.html#fields\n },\n ],\n },\n content: {\n enabled: true,\n fields: [\n {\n index: true,\n name: 'content',\n store: true,\n type: 'text',\n },\n ],\n },\n },\n },\n },\n },\n store: {\n indexType: 'scorch',\n segmentVersion: 16,\n },\n },\n sourceUuid: '',\n sourceParams: {},\n sourceType: 'gocbcore',\n planParams: {\n maxPartitionsPerPIndex: 64,\n indexPartitions: 16,\n numReplicas: 0,\n },\n });\n this.vector_dimension = dimension;\n } catch (error: any) {\n // Check for 'already exists' error (Couchbase may throw a 400 or 409, or have a message)\n const message = error?.message || error?.toString();\n if (message && message.toLowerCase().includes('index exists')) {\n // Fetch index info and check dimension\n await this.validateExistingIndex(indexName, dimension, metric);\n return;\n }\n throw new MastraError(\n {\n id: 'COUCHBASE_VECTOR_CREATE_INDEX_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: {\n indexName,\n dimension,\n metric,\n },\n },\n error,\n );\n }\n }\n\n async upsert({ vectors, metadata, ids }: UpsertVectorParams): Promise<string[]> {\n try {\n await this.getCollection();\n\n if (!vectors || vectors.length === 0) {\n throw new Error('No vectors provided');\n }\n if (this.vector_dimension) {\n for (const vector of vectors) {\n if (!vector || this.vector_dimension !== vector.length) {\n throw new Error('Vector dimension mismatch');\n }\n }\n }\n\n const pointIds = ids || vectors.map(() => crypto.randomUUID());\n const records = vectors.map((vector, i) => {\n const metadataObj = metadata?.[i] || {};\n const record: Record<string, any> = {\n embedding: vector,\n metadata: metadataObj,\n };\n // If metadata has a text field, save it as content\n if (metadataObj.text) {\n record.content = metadataObj.text;\n }\n return record;\n });\n\n const allPromises = [];\n for (let i = 0; i < records.length; i++) {\n allPromises.push(this.collection.upsert(pointIds[i]!, records[i]));\n }\n await Promise.all(allPromises);\n\n return pointIds;\n } catch (error) {\n throw new MastraError(\n {\n id: 'COUCHBASE_VECTOR_UPSERT_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n },\n error,\n );\n }\n }\n\n async query({ indexName, queryVector, topK = 10, includeVector = false }: QueryVectorParams): Promise<QueryResult[]> {\n try {\n await this.getCollection();\n\n const index_stats = await this.describeIndex({ indexName });\n if (queryVector.length !== index_stats.dimension) {\n throw new Error(\n `Query vector dimension mismatch. Expected ${index_stats.dimension}, got ${queryVector.length}`,\n );\n }\n\n let request = SearchRequest.create(\n VectorSearch.fromVectorQuery(VectorQuery.create('embedding', queryVector).numCandidates(topK)),\n );\n const results = await this.scope.search(indexName, request, {\n fields: ['*'],\n });\n\n if (includeVector) {\n throw new Error('Including vectors in search results is not yet supported by the Couchbase vector store');\n }\n const output = [];\n for (const match of results.rows) {\n const cleanedMetadata: Record<string, any> = {};\n const fields = (match.fields as Record<string, any>) || {}; // Ensure fields is an object\n for (const key in fields) {\n if (Object.prototype.hasOwnProperty.call(fields, key)) {\n const newKey = key.startsWith('metadata.') ? key.substring('metadata.'.length) : key;\n cleanedMetadata[newKey] = fields[key];\n }\n }\n output.push({\n id: match.id as string,\n score: (match.score as number) || 0,\n metadata: cleanedMetadata, // Use the cleaned metadata object\n });\n }\n return output;\n } catch (error) {\n throw new MastraError(\n {\n id: 'COUCHBASE_VECTOR_QUERY_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: {\n indexName,\n topK,\n },\n },\n error,\n );\n }\n }\n\n async listIndexes(): Promise<string[]> {\n try {\n await this.getCollection();\n const indexes = await this.scope.searchIndexes().getAllIndexes();\n return indexes?.map(index => index.name) || [];\n } catch (error) {\n throw new MastraError(\n {\n id: 'COUCHBASE_VECTOR_LIST_INDEXES_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n },\n error,\n );\n }\n }\n\n /**\n * Retrieves statistics about a vector index.\n *\n * @param {string} indexName - The name of the index to describe\n * @returns A promise that resolves to the index statistics including dimension, count and metric\n */\n async describeIndex({ indexName }: DescribeIndexParams): Promise<IndexStats> {\n try {\n await this.getCollection();\n if (!(await this.listIndexes()).includes(indexName)) {\n throw new Error(`Index ${indexName} does not exist`);\n }\n const index = await this.scope.searchIndexes().getIndex(indexName);\n const dimensions =\n index.params.mapping?.types?.[`${this.scopeName}.${this.collectionName}`]?.properties?.embedding?.fields?.[0]\n ?.dims;\n const count = -1; // Not added support yet for adding a count of documents covered by an index\n const metric = index.params.mapping?.types?.[`${this.scopeName}.${this.collectionName}`]?.properties?.embedding\n ?.fields?.[0]?.similarity as CouchbaseMetric;\n return {\n dimension: dimensions,\n count: count,\n metric: Object.keys(DISTANCE_MAPPING).find(\n key => DISTANCE_MAPPING[key as MastraMetric] === metric,\n ) as MastraMetric,\n };\n } catch (error) {\n throw new MastraError(\n {\n id: 'COUCHBASE_VECTOR_DESCRIBE_INDEX_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: {\n indexName,\n },\n },\n error,\n );\n }\n }\n\n async deleteIndex({ indexName }: DeleteIndexParams): Promise<void> {\n try {\n await this.getCollection();\n if (!(await this.listIndexes()).includes(indexName)) {\n throw new Error(`Index ${indexName} does not exist`);\n }\n await this.scope.searchIndexes().dropIndex(indexName);\n this.vector_dimension = null as unknown as number;\n } catch (error) {\n if (error instanceof MastraError) {\n throw error;\n }\n throw new MastraError(\n {\n id: 'COUCHBASE_VECTOR_DELETE_INDEX_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: {\n indexName,\n },\n },\n error,\n );\n }\n }\n\n /**\n * Updates a vector by its ID with the provided vector and/or metadata.\n * @param indexName - The name of the index containing the vector.\n * @param id - The ID of the vector to update.\n * @param update - An object containing the vector and/or metadata to update.\n * @param update.vector - An optional array of numbers representing the new vector.\n * @param update.metadata - An optional record containing the new metadata.\n * @returns A promise that resolves when the update is complete.\n * @throws Will throw an error if no updates are provided or if the update operation fails.\n */\n async updateVector({ id, update }: UpdateVectorParams): Promise<void> {\n try {\n if (!update.vector && !update.metadata) {\n throw new Error('No updates provided');\n }\n if (update.vector && this.vector_dimension && update.vector.length !== this.vector_dimension) {\n throw new Error('Vector dimension mismatch');\n }\n const collection = await this.getCollection();\n\n // Check if document exists\n try {\n await collection.get(id);\n } catch (err: any) {\n if (err.code === 13 || err.message?.includes('document not found')) {\n throw new Error(`Vector with id ${id} does not exist`);\n }\n throw err;\n }\n\n const specs: MutateInSpec[] = [];\n if (update.vector) specs.push(MutateInSpec.replace('embedding', update.vector));\n if (update.metadata) specs.push(MutateInSpec.replace('metadata', update.metadata));\n\n await collection.mutateIn(id, specs);\n } catch (error) {\n throw new MastraError(\n {\n id: 'COUCHBASE_VECTOR_UPDATE_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: {\n id,\n hasVectorUpdate: !!update.vector,\n hasMetadataUpdate: !!update.metadata,\n },\n },\n error,\n );\n }\n }\n\n /**\n * Deletes a vector by its ID.\n * @param indexName - The name of the index containing the vector.\n * @param id - The ID of the vector to delete.\n * @returns A promise that resolves when the deletion is complete.\n * @throws Will throw an error if the deletion operation fails.\n */\n async deleteVector({ id }: DeleteVectorParams): Promise<void> {\n try {\n const collection = await this.getCollection();\n\n // Check if document exists\n try {\n await collection.get(id);\n } catch (err: any) {\n if (err.code === 13 || err.message?.includes('document not found')) {\n throw new Error(`Vector with id ${id} does not exist`);\n }\n throw err;\n }\n\n await collection.remove(id);\n } catch (error) {\n throw new MastraError(\n {\n id: 'COUCHBASE_VECTOR_DELETE_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n details: {\n id,\n },\n },\n error,\n );\n }\n }\n\n async disconnect() {\n try {\n if (!this.cluster) {\n return;\n }\n await this.cluster.close();\n } catch (error) {\n throw new MastraError(\n {\n id: 'COUCHBASE_VECTOR_DISCONNECT_FAILED',\n domain: ErrorDomain.STORAGE,\n category: ErrorCategory.THIRD_PARTY,\n },\n error,\n );\n }\n }\n}\n"]}
@@ -1,18 +1,18 @@
1
- import type { Collection } from 'couchbase';
2
- import type { CreateIndexParams } from '@mastra/core/vector';
3
- import type { DeleteIndexParams } from '@mastra/core/vector';
4
- import type { DeleteVectorParams } from '@mastra/core/vector';
5
- import type { DescribeIndexParams } from '@mastra/core/vector';
6
- import type { IndexStats } from '@mastra/core/vector';
7
1
  import { MastraVector } from '@mastra/core/vector';
8
- import type { QueryResult } from '@mastra/core/vector';
9
- import type { QueryVectorParams } from '@mastra/core/vector';
10
- import type { UpdateVectorParams } from '@mastra/core/vector';
11
- import type { UpsertVectorParams } from '@mastra/core/vector';
12
-
13
- declare type CouchbaseMetric = 'cosine' | 'l2_norm' | 'dot_product';
14
-
15
- declare class CouchbaseVector extends MastraVector {
2
+ import type { QueryResult, IndexStats, CreateIndexParams, UpsertVectorParams, QueryVectorParams, DescribeIndexParams, DeleteIndexParams, DeleteVectorParams, UpdateVectorParams } from '@mastra/core/vector';
3
+ import type { Collection } from 'couchbase';
4
+ type MastraMetric = 'cosine' | 'euclidean' | 'dotproduct';
5
+ type CouchbaseMetric = 'cosine' | 'l2_norm' | 'dot_product';
6
+ export declare const DISTANCE_MAPPING: Record<MastraMetric, CouchbaseMetric>;
7
+ export type CouchbaseVectorParams = {
8
+ connectionString: string;
9
+ username: string;
10
+ password: string;
11
+ bucketName: string;
12
+ scopeName: string;
13
+ collectionName: string;
14
+ };
15
+ export declare class CouchbaseVector extends MastraVector {
16
16
  private clusterPromise;
17
17
  private cluster;
18
18
  private bucketName;
@@ -57,24 +57,5 @@ declare class CouchbaseVector extends MastraVector {
57
57
  deleteVector({ id }: DeleteVectorParams): Promise<void>;
58
58
  disconnect(): Promise<void>;
59
59
  }
60
- export { CouchbaseVector }
61
- export { CouchbaseVector as CouchbaseVector_alias_1 }
62
-
63
- declare type CouchbaseVectorParams = {
64
- connectionString: string;
65
- username: string;
66
- password: string;
67
- bucketName: string;
68
- scopeName: string;
69
- collectionName: string;
70
- };
71
- export { CouchbaseVectorParams }
72
- export { CouchbaseVectorParams as CouchbaseVectorParams_alias_1 }
73
-
74
- declare const DISTANCE_MAPPING: Record<MastraMetric, CouchbaseMetric>;
75
- export { DISTANCE_MAPPING }
76
- export { DISTANCE_MAPPING as DISTANCE_MAPPING_alias_1 }
77
-
78
- declare type MastraMetric = 'cosine' | 'euclidean' | 'dotproduct';
79
-
80
- export { }
60
+ export {};
61
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vector/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAmB,UAAU,EAAS,MAAM,WAAW,CAAC;AAGpE,KAAK,YAAY,GAAG,QAAQ,GAAG,WAAW,GAAG,YAAY,CAAC;AAC1D,KAAK,eAAe,GAAG,QAAQ,GAAG,SAAS,GAAG,aAAa,CAAC;AAC5D,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,YAAY,EAAE,eAAe,CAIlE,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,qBAAa,eAAgB,SAAQ,YAAY;IAC/C,OAAO,C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 @@
1
1
  {
2
2
  "name": "@mastra/couchbase",
3
- "version": "0.0.0-support-d1-client-20250701191943",
3
+ "version": "0.0.0-taofeeq-fix-tool-call-showing-after-message-20250806162745",
4
4
  "description": "Couchbase vector store provider for Mastra",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -12,7 +12,7 @@
12
12
  "default": "./dist/index.js"
13
13
  },
14
14
  "require": {
15
- "types": "./dist/index.d.cts",
15
+ "types": "./dist/index.d.ts",
16
16
  "default": "./dist/index.cjs"
17
17
  }
18
18
  },
@@ -26,20 +26,21 @@
26
26
  "@types/node": "^20.19.0",
27
27
  "@vitest/coverage-v8": "3.2.3",
28
28
  "@vitest/ui": "3.2.3",
29
- "axios": "^1.10.0",
30
- "eslint": "^9.29.0",
29
+ "axios": "^1.11.0",
30
+ "eslint": "^9.30.1",
31
31
  "tsup": "^8.5.0",
32
32
  "typescript": "^5.8.3",
33
33
  "vitest": "^3.2.4",
34
- "@internal/lint": "0.0.0-support-d1-client-20250701191943",
35
- "@mastra/core": "0.0.0-support-d1-client-20250701191943"
34
+ "@internal/lint": "0.0.0-taofeeq-fix-tool-call-showing-after-message-20250806162745",
35
+ "@mastra/core": "0.0.0-taofeeq-fix-tool-call-showing-after-message-20250806162745",
36
+ "@internal/types-builder": "0.0.0-taofeeq-fix-tool-call-showing-after-message-20250806162745"
36
37
  },
37
38
  "peerDependencies": {
38
- "@mastra/core": "0.0.0-support-d1-client-20250701191943"
39
+ "@mastra/core": "0.0.0-taofeeq-fix-tool-call-showing-after-message-20250806162745"
39
40
  },
40
41
  "scripts": {
41
- "build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
42
- "build:watch": "pnpm build --watch",
42
+ "build": "tsup --silent --config tsup.config.ts",
43
+ "build:watch": "tsup --watch --silent --config tsup.config.ts",
43
44
  "lint": "eslint .",
44
45
  "coverage": "vitest run --coverage",
45
46
  "pretest": "node scripts/start-docker.js",
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": ["./tsconfig.json", "../../tsconfig.build.json"],
3
+ "compilerOptions": {
4
+ "outDir": "./dist",
5
+ "rootDir": "./src"
6
+ },
7
+ "include": ["src/**/*"],
8
+ "exclude": ["node_modules", "**/*.test.ts", "src/**/*.mock.ts"]
9
+ }
package/tsconfig.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "extends": "../../tsconfig.node.json",
3
- "include": ["src/**/*"],
3
+ "include": ["src/**/*", "tsup.config.ts"],
4
4
  "exclude": ["node_modules", "**/*.test.ts"]
5
5
  }
package/tsup.config.ts ADDED
@@ -0,0 +1,17 @@
1
+ import { generateTypes } from '@internal/types-builder';
2
+ import { defineConfig } from 'tsup';
3
+
4
+ export default defineConfig({
5
+ entry: ['src/index.ts'],
6
+ format: ['esm', 'cjs'],
7
+ clean: true,
8
+ dts: false,
9
+ splitting: true,
10
+ treeshake: {
11
+ preset: 'smallest',
12
+ },
13
+ sourcemap: true,
14
+ onSuccess: async () => {
15
+ await generateTypes(process.cwd());
16
+ },
17
+ });
@@ -1,80 +0,0 @@
1
- import type { Collection } from 'couchbase';
2
- import type { CreateIndexParams } from '@mastra/core/vector';
3
- import type { DeleteIndexParams } from '@mastra/core/vector';
4
- import type { DeleteVectorParams } from '@mastra/core/vector';
5
- import type { DescribeIndexParams } from '@mastra/core/vector';
6
- import type { IndexStats } from '@mastra/core/vector';
7
- import { MastraVector } from '@mastra/core/vector';
8
- import type { QueryResult } from '@mastra/core/vector';
9
- import type { QueryVectorParams } from '@mastra/core/vector';
10
- import type { UpdateVectorParams } from '@mastra/core/vector';
11
- import type { UpsertVectorParams } from '@mastra/core/vector';
12
-
13
- declare type CouchbaseMetric = 'cosine' | 'l2_norm' | 'dot_product';
14
-
15
- declare class CouchbaseVector extends MastraVector {
16
- private clusterPromise;
17
- private cluster;
18
- private bucketName;
19
- private collectionName;
20
- private scopeName;
21
- private collection;
22
- private bucket;
23
- private scope;
24
- private vector_dimension;
25
- constructor({ connectionString, username, password, bucketName, scopeName, collectionName }: CouchbaseVectorParams);
26
- getCollection(): Promise<Collection>;
27
- createIndex({ indexName, dimension, metric }: CreateIndexParams): Promise<void>;
28
- upsert({ vectors, metadata, ids }: UpsertVectorParams): Promise<string[]>;
29
- query({ indexName, queryVector, topK, includeVector }: QueryVectorParams): Promise<QueryResult[]>;
30
- listIndexes(): Promise<string[]>;
31
- /**
32
- * Retrieves statistics about a vector index.
33
- *
34
- * @param {string} indexName - The name of the index to describe
35
- * @returns A promise that resolves to the index statistics including dimension, count and metric
36
- */
37
- describeIndex({ indexName }: DescribeIndexParams): Promise<IndexStats>;
38
- deleteIndex({ indexName }: DeleteIndexParams): Promise<void>;
39
- /**
40
- * Updates a vector by its ID with the provided vector and/or metadata.
41
- * @param indexName - The name of the index containing the vector.
42
- * @param id - The ID of the vector to update.
43
- * @param update - An object containing the vector and/or metadata to update.
44
- * @param update.vector - An optional array of numbers representing the new vector.
45
- * @param update.metadata - An optional record containing the new metadata.
46
- * @returns A promise that resolves when the update is complete.
47
- * @throws Will throw an error if no updates are provided or if the update operation fails.
48
- */
49
- updateVector({ id, update }: UpdateVectorParams): Promise<void>;
50
- /**
51
- * Deletes a vector by its ID.
52
- * @param indexName - The name of the index containing the vector.
53
- * @param id - The ID of the vector to delete.
54
- * @returns A promise that resolves when the deletion is complete.
55
- * @throws Will throw an error if the deletion operation fails.
56
- */
57
- deleteVector({ id }: DeleteVectorParams): Promise<void>;
58
- disconnect(): Promise<void>;
59
- }
60
- export { CouchbaseVector }
61
- export { CouchbaseVector as CouchbaseVector_alias_1 }
62
-
63
- declare type CouchbaseVectorParams = {
64
- connectionString: string;
65
- username: string;
66
- password: string;
67
- bucketName: string;
68
- scopeName: string;
69
- collectionName: string;
70
- };
71
- export { CouchbaseVectorParams }
72
- export { CouchbaseVectorParams as CouchbaseVectorParams_alias_1 }
73
-
74
- declare const DISTANCE_MAPPING: Record<MastraMetric, CouchbaseMetric>;
75
- export { DISTANCE_MAPPING }
76
- export { DISTANCE_MAPPING as DISTANCE_MAPPING_alias_1 }
77
-
78
- declare type MastraMetric = 'cosine' | 'euclidean' | 'dotproduct';
79
-
80
- export { }
package/dist/index.d.cts DELETED
@@ -1,3 +0,0 @@
1
- export { DISTANCE_MAPPING } from './_tsup-dts-rollup.cjs';
2
- export { CouchbaseVectorParams } from './_tsup-dts-rollup.cjs';
3
- export { CouchbaseVector } from './_tsup-dts-rollup.cjs';