@mastra/oracledb 0.2.2-alpha.0 → 0.2.2

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/README.md CHANGED
@@ -8,27 +8,6 @@ Oracle Database provider for Mastra, providing storage and vector similarity sea
8
8
  npm install @mastra/oracledb
9
9
  ```
10
10
 
11
- ## Prerequisites
12
-
13
- - Oracle Database access through the Node.js `oracledb` driver
14
- - Oracle Database 23ai or later when using vector search
15
- - A database user with permission to create the Mastra tables and indexes, unless schema initialization is managed separately
16
-
17
- ## Driver Modes
18
-
19
- `@mastra/oracledb` uses node-oracledb Thin mode by default. Thin mode connects directly to Oracle Database and does not require a separate Oracle Client or Oracle Instant Client installation. No workspace configuration change is needed.
20
-
21
- To use Thick mode features, install compatible Oracle Client libraries and initialize node-oracledb before creating an `OracleStore`, an `OracleVector`, or any Oracle connection pool. Applications that import `oracledb` directly should declare it as a direct dependency using a version compatible with `@mastra/oracledb`.
22
-
23
- ```typescript
24
- import oracledb from 'oracledb';
25
-
26
- // macOS or Windows
27
- oracledb.initOracleClient({ libDir: '/path/to/oracle/instantclient' });
28
- ```
29
-
30
- On Linux, configure the system library search path and call `initOracleClient()` without `libDir`. All Oracle connections in a Node.js process use the same mode. See the [node-oracledb initialization guide](https://node-oracledb.readthedocs.io/en/v6.10.0/user_guide/initialization.html) for platform-specific setup.
31
-
32
11
  ## Usage
33
12
 
34
13
  ### Storage
@@ -77,322 +56,15 @@ const savedThread = await memory.getThreadById({ threadId: 'thread-123' });
77
56
  const { messages } = await memory.listMessages({ threadId: 'thread-123' });
78
57
  ```
79
58
 
80
- ### Vector Store
81
-
82
- ```typescript
83
- import { OracleVector } from '@mastra/oracledb';
84
-
85
- const vectorStore = new OracleVector({
86
- id: 'oracle-vector',
87
- user: process.env.ORACLE_DATABASE_USER,
88
- password: process.env.ORACLE_DATABASE_PASSWORD,
89
- connectString: process.env.ORACLE_DATABASE_CONNECT_STRING,
90
- });
91
-
92
- // Create a vector table
93
- await vectorStore.createIndex({
94
- indexName: 'my_vectors',
95
- dimension: 1536,
96
- metric: 'cosine',
97
- });
98
-
99
- // Add vectors
100
- const ids = await vectorStore.upsert({
101
- indexName: 'my_vectors',
102
- vectors: [[0.1, 0.2, ...], [0.3, 0.4, ...]],
103
- metadata: [{ text: 'doc1' }, { text: 'doc2' }],
104
- });
105
-
106
- // Query vectors
107
- const results = await vectorStore.query({
108
- indexName: 'my_vectors',
109
- queryVector: [0.1, 0.2, ...],
110
- topK: 10,
111
- filter: { text: { $eq: 'doc1' } },
112
- includeVector: false,
113
- });
114
- ```
115
-
116
- ### Shared Pool
117
-
118
- `OracleStore` and `OracleVector` can share the same Oracle connection pool.
119
-
120
- ```typescript
121
- const store = new OracleStore({
122
- id: 'oracle-store',
123
- user: process.env.ORACLE_DATABASE_USER,
124
- password: process.env.ORACLE_DATABASE_PASSWORD,
125
- connectString: process.env.ORACLE_DATABASE_CONNECT_STRING,
126
- });
127
-
128
- const vectorStore = new OracleVector({
129
- id: 'oracle-vector',
130
- poolManager: store.getPoolManager(),
131
- });
132
- ```
133
-
134
- ## Configuration
135
-
136
- Both `OracleStore` and `OracleVector` support:
137
-
138
- - Username/password connections
139
- - Autonomous Database wallet and mTLS configuration
140
- - External authentication
141
- - Existing Oracle pools through `OraclePoolManager`
142
- - Custom schema names
143
-
144
- ### Storage Options
145
-
146
- - `id`: Unique identifier for this store instance
147
- - `schemaName`: Oracle schema name to use for Mastra tables
148
- - `messageBatchSize`: Number of messages per batch insert
149
- - `skipDefaultIndexes`: Skip default storage indexes when DBAs manage indexes separately
150
- - `indexes`: Custom Oracle index definitions to create during initialization
151
- - `disableInit`: Disable automatic schema initialization
152
- - `migrationTableName`: Custom migration ledger table name
153
- - `vectorRegistryTableName`: Vector registry table used to clean semantic-recall rows when `OracleVector.registryTableName` is customized
154
-
155
- ### Vector Options
156
-
157
- - `id`: Unique identifier for this vector store instance
158
- - `schemaName`: Oracle schema name to use for vector tables
159
- - `tablePrefix`: Prefix for generated physical vector table names
160
- - `registryTableName`: Table used to map Mastra index names to Oracle vector tables
161
- - `defaultIndexConfig`: Default Oracle vector index configuration
162
- - `defaultMetadataIndexes`: Metadata fields to index by default
163
- - `defaultVectorFormat`: Vector format (`vector`, `bit`, or `int8`)
164
- - `upsertBatchSize`: Number of vectors per batch insert
165
-
166
- ## Features
167
-
168
- ### Storage Features
169
-
170
- - Thread, message, resource, working memory, and observational memory storage
171
- - Workflow snapshot persistence
172
- - Observability spans and logs
173
- - Scores and scorer definitions
174
- - Agent and MCP client registries
175
- - Oracle JSON support for metadata, payloads, snapshots, and versioned state
176
- - Repeatable schema migrations
177
- - Offline schema export
178
- - Shared connection pooling
179
-
180
- ### Vector Store Features
181
-
182
- - Oracle `VECTOR` storage
183
- - Vector similarity search with cosine, euclidean, dot product, hamming, and jaccard metrics
184
- - Exact search by default
185
- - Optional IVF and HNSW vector indexes
186
- - Metadata filtering with MongoDB-like query syntax
187
- - Dense, binary, and int8 vector formats
188
- - Automatic vector ID generation
189
- - Logical index registry for stable Mastra index names
190
-
191
- ## Supported Filter Operators
192
-
193
- The following metadata filter operators are supported:
194
-
195
- - Comparison: `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`
196
- - Logical: `$and`, `$or`, `$not`, `$nor`
197
- - Array: `$in`, `$nin`, `$all`, `$elemMatch`, `$size`
198
- - Text: `$contains`, `$regex`
199
- - Existence: `$exists`
200
-
201
- Example filter:
202
-
203
- ```typescript
204
- {
205
- $and: [{ resourceId: { $eq: 'resource-456' } }, { category: { $in: ['docs', 'memory'] } }];
206
- }
207
- ```
208
-
209
- ## Vector Indexes
210
-
211
- OracleVector uses exact search by default, which requires no vector index and is useful for local development, tests, and small datasets.
212
-
213
- Use IVF or HNSW when the dataset size and latency requirements justify approximate indexing:
214
-
215
- ```typescript
216
- await vectorStore.createIndex({
217
- indexName: 'my_vectors',
218
- dimension: 1536,
219
- metric: 'cosine',
220
- indexConfig: {
221
- type: 'ivf',
222
- accuracy: 95,
223
- ivf: {
224
- neighborPartitions: 16,
225
- },
226
- },
227
- });
228
- ```
229
-
230
- HNSW may require Oracle Vector Pool memory to be configured before index creation.
231
-
232
- ## Vector memory (HNSW only)
233
-
234
- Oracle's `VECTOR_MEMORY_SIZE` parameter sizes the shared "Vector Pool" used by **HNSW** indexes.
235
- Exact search (the `OracleVector` default) and **IVF** indexes do not use the Vector Pool at all —
236
- both work correctly with `VECTOR_MEMORY_SIZE = 0`, including against an empty, minimally-privileged
237
- database.
238
-
239
- ### Minimum grants
240
-
241
- A brand-new Oracle user needs nothing beyond what any other Mastra storage/vector consumer needs:
242
-
243
- ```sql
244
- CREATE USER mastra IDENTIFIED BY "<password>";
245
- GRANT CREATE SESSION, CREATE TABLE TO mastra;
246
- ALTER USER mastra QUOTA UNLIMITED ON USERS;
247
- ```
248
-
249
- This is enough for storage, exact vector search, and IVF indexes. No DBA-level grants or Vector
250
- Pool configuration are required unless you plan to build HNSW indexes.
251
-
252
- ### Local Docker container (this package's `docker-compose.yaml`)
253
-
254
- `scripts/configure-vector-memory.sql` runs during container init and persists
255
- `VECTOR_MEMORY_SIZE = 256M` at the CDB root via `SCOPE=SPFILE`. That value only takes effect after
256
- the instance restarts, so enabling HNSW locally is a one-time, two-step flow:
257
-
258
- ```bash
259
- docker compose up -d --wait
260
- docker compose restart db
261
- docker compose up --wait
262
- ```
263
-
264
- Skip the restart if you only need exact search or IVF — the container works fine with the Vector
265
- Pool left at 0, and this package's integration suite detects that case and skips HNSW-specific
266
- tests with a clear message instead of failing.
267
-
268
- ### Autonomous Database
269
-
270
- Oracle Autonomous Database manages Vector Pool memory automatically. `scripts/configure-vector-memory.sql`
271
- is specific to self-managed containers (like the local Docker setup above) and is unnecessary —
272
- and inapplicable — on Autonomous Database.
273
-
274
- ## Migrations and Schema Export
275
-
276
- `OracleStore.init()` runs repeatable migrations for the included storage domains.
277
-
278
- ```typescript
279
- await store.init();
280
- const migrations = await store.listMigrations();
281
- ```
282
-
283
- Use `exportSchemas()` to generate Oracle DDL for review or externally managed deployments:
284
-
285
- ```typescript
286
- import { exportSchemas } from '@mastra/oracledb';
287
-
288
- const ddl = exportSchemas({
289
- schemaName: 'APP_SCHEMA',
290
- domains: [
291
- 'migrations',
292
- 'memory',
293
- 'workflows',
294
- 'observability',
295
- 'scores',
296
- 'scorerDefinitions',
297
- 'mcpClients',
298
- 'agents',
299
- 'vector',
300
- ],
301
- vector: {
302
- indexes: [{ indexName: 'memory_messages', dimension: 1536 }],
303
- },
304
- });
305
- ```
306
-
307
- ## Methods
59
+ ## Documentation
308
60
 
309
- ### Vector Store Methods
61
+ - [Oracle Database integration guide](https://mastra.ai/integrations/databases/oracledb)
62
+ - [Oracle Database vector reference](https://mastra.ai/reference/vectors/oracledb)
310
63
 
311
- - `createIndex({ indexName, dimension, metric?, indexConfig?, vectorFormat? })`: Create a vector table
312
- - `upsert({ indexName, vectors, metadata?, ids? })`: Add or update vectors
313
- - `query({ indexName, queryVector, topK?, filter?, includeVector?, minScore? })`: Search for similar vectors
314
- - `updateVector({ indexName, id?, filter?, update })`: Update a vector by ID or metadata filter
315
- - `deleteVector({ indexName, id })`: Delete a vector by ID
316
- - `deleteVectors({ indexName, ids?, filter? })`: Delete vectors by IDs or metadata filter
317
- - `listIndexes()`: List vector indexes
318
- - `describeIndex({ indexName })`: Get vector index statistics
319
- - `deleteIndex({ indexName })`: Delete a vector index and its table
320
- - `buildIndex({ indexName, metric?, indexConfig? })`: Build an Oracle vector index
321
- - `rebuildIndex({ indexName, metric?, indexConfig? })`: Rebuild an Oracle vector index
322
- - `configureVectorMemory({ size, scope? })`: Configure Oracle Vector Pool memory
323
- - `getIndexStatus({ indexName, ownerName? })`: Read Oracle vector index status
324
- - `indexAccuracyQuery({ indexName, queryVector, topK?, targetAccuracy? })`: Estimate Oracle vector index accuracy
325
- - `disconnect()`: Close the Oracle connection pool owned by the provider
64
+ ## Changelog
326
65
 
327
- ### Storage Methods
328
-
329
- `OracleStore` implements Mastra composite storage and exposes the standard storage methods for supported domains, including memory, workflows, observability, scores, scorer definitions, agents, and MCP clients.
330
-
331
- It also provides:
332
-
333
- - `init()`: Initialize storage schema
334
- - `migrate()`: Run repeatable storage migrations
335
- - `listMigrations()`: List migration ledger records
336
- - `getPoolManager()`: Access the shared Oracle pool manager
337
- - `disconnect()`: Close the Oracle connection pool owned by the provider
338
-
339
- ## Testing
340
-
341
- ### Monorepo setup notes
342
-
343
- **1. Use the default Thin mode** — The monorepo keeps the optional `oracledb` install lifecycle disabled. Unit and integration tests use Thin mode, so `pnpm install` and the OracleDB test commands do not require a manual `pnpm-workspace.yaml` change or an Oracle Client installation.
344
-
345
- **2. Build workspace dependencies first** — The integration tests depend on built artifacts from `@mastra/core`. Run this from the monorepo root before the first test run:
346
-
347
- ```bash
348
- pnpm build:core
349
- ```
350
-
351
- You will get cryptic `Cannot find module` errors if this is missing.
352
-
353
- **3. Docker setup** — Docker Compose requires the Docker daemon to be running. On a fresh Linux install you may need:
354
-
355
- ```bash
356
- sudo systemctl start docker
357
- ```
358
-
359
- For local development, create `stores/oracledb/.env` from the Mastra monorepo root. The file is gitignored and is loaded by Vitest and Docker Compose:
360
-
361
- ```dotenv
362
- ORACLE_DATABASE_USER=mastra
363
- ORACLE_DATABASE_PASSWORD=<your-local-test-password>
364
- ORACLE_DATABASE_CONNECT_STRING=localhost:1521/FREEPDB1
365
- ```
366
-
367
- Run unit tests and type checks from the monorepo root:
368
-
369
- ```bash
370
- pnpm --filter @mastra/oracledb test
371
- pnpm --filter @mastra/oracledb typecheck
372
- ```
373
-
374
- Live Oracle integration tests are opt-in because they require Docker or Oracle Database credentials:
375
-
376
- ```bash
377
- pnpm --filter @mastra/oracledb test:integration
378
- ```
379
-
380
- The integration script starts an Oracle Database Free container with Docker Compose, creates the configured test user on the `USERS` tablespace, runs the shared storage and vector integration suites, and tears the container down afterward.
381
-
382
- To use an existing Oracle database instead of the Docker Compose container, provide your own connection values and run the integration suites directly:
383
-
384
- ```bash
385
- export ORACLE_DATABASE_USER=...
386
- export ORACLE_DATABASE_CONNECT_STRING=...
387
- # Load ORACLE_DATABASE_PASSWORD from your environment or secret manager.
388
-
389
- pnpm --filter @mastra/oracledb test:storage-integration
390
- pnpm --filter @mastra/oracledb test:vector-integration
391
- ```
66
+ See the [package changelog](https://github.com/mastra-ai/mastra/blob/main/stores/oracledb/CHANGELOG.md) for version history and release notes.
392
67
 
393
- ## Related Links
68
+ ## Support
394
69
 
395
- - [Oracle AI Vector Search](https://docs.oracle.com/en/database/oracle/oracle-database/23/vecse/)
396
- - [Oracle Database Node.js Driver](https://node-oracledb.readthedocs.io/)
397
- - [Mastra Storage Documentation](https://mastra.ai/en/docs/memory/storage)
398
- - [Mastra Vector Database Documentation](https://mastra.ai/en/docs/rag/vector-databases)
70
+ We have an [open community Discord](https://discord.gg/mastra-ai). Come and say hello and let us know if you have any questions or need any help getting things running.
@@ -3,7 +3,7 @@ name: mastra-oracledb
3
3
  description: Documentation for @mastra/oracledb. Use when working with @mastra/oracledb APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/oracledb"
6
- version: "0.2.2-alpha.0"
6
+ version: "0.2.2"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.2.2-alpha.0",
2
+ "version": "0.2.2",
3
3
  "package": "@mastra/oracledb",
4
4
  "exports": {},
5
5
  "modules": {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/oracledb",
3
- "version": "0.2.2-alpha.0",
3
+ "version": "0.2.2",
4
4
  "description": "Oracle Database provider for Mastra storage and vector retrieval",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -32,9 +32,9 @@
32
32
  "tsx": "^4.23.1",
33
33
  "typescript": "^7.0.2",
34
34
  "vitest": "4.1.10",
35
- "@internal/types-builder": "0.0.104",
36
- "@internal/lint": "0.0.129",
37
- "@mastra/core": "1.64.0-alpha.2"
35
+ "@internal/types-builder": "0.0.105",
36
+ "@mastra/core": "1.64.0",
37
+ "@internal/lint": "0.0.130"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "@mastra/core": ">=1.61.0-0 <2.0.0-0"