@mastra/oracledb 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/README.md +398 -0
- package/package.json +72 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# @mastra/oracledb
|
|
2
|
+
|
|
3
|
+
## 0.2.0-alpha.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added `@mastra/oracledb`, a storage and vector provider for Oracle Database 23ai+. ([#19650](https://github.com/mastra-ai/mastra/pull/19650))
|
|
8
|
+
|
|
9
|
+
**New package** with `OracleStore` (composite storage: memory, workflows, observability, scores, scorer definitions, MCP clients, agents) and `OracleVector` (Oracle 23ai+ `VECTOR` columns with exact search by default, optional IVF/HNSW indexes, and Mastra metadata filters over Oracle JSON).
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import { OracleStore, OracleVector } from '@mastra/oracledb';
|
|
13
|
+
|
|
14
|
+
const storage = new OracleStore({
|
|
15
|
+
id: 'oracle-store',
|
|
16
|
+
|
|
17
|
+
password: process.env.ORACLE_DATABASE_PASSWORD,
|
|
18
|
+
connectString: process.env.ORACLE_DATABASE_CONNECT_STRING,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const vector = new OracleVector({
|
|
22
|
+
id: 'oracle-vector',
|
|
23
|
+
|
|
24
|
+
password: process.env.ORACLE_DATABASE_PASSWORD,
|
|
25
|
+
connectString: process.env.ORACLE_DATABASE_CONNECT_STRING,
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Supersedes [#18011](https://github.com/mastra-ai/mastra/pull/18011).
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Updated dependencies [[`f59032a`](https://github.com/mastra-ai/mastra/commit/f59032a73699443555a08a479e7ac578975784f2), [`bf936e2`](https://github.com/mastra-ai/mastra/commit/bf936e2c89b2ff0dad5695b873ddc009ba96d41e)]:
|
|
34
|
+
- @mastra/core@1.58.0-alpha.6
|
|
35
|
+
|
|
36
|
+
## 0.1.0
|
|
37
|
+
|
|
38
|
+
- Added `OracleStore` with storage domains for memory, workflows, observability traces/logs, scores, scorer definitions, MCP clients, and agents.
|
|
39
|
+
- Added `OracleVector` with vector table management, metadata filtering, and Oracle vector index support.
|
|
40
|
+
- Added shared Oracle connection/pool management, migrations, schema export, identifier helpers, docs, and correctness tests.
|
package/README.md
ADDED
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
# @mastra/oracledb
|
|
2
|
+
|
|
3
|
+
Oracle Database provider for Mastra, providing storage and vector similarity search with Oracle JSON, Oracle `VECTOR`, connection pooling, and transaction support.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @mastra/oracledb
|
|
9
|
+
```
|
|
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
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
### Storage
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import { OracleStore } from '@mastra/oracledb';
|
|
38
|
+
|
|
39
|
+
const store = new OracleStore({
|
|
40
|
+
id: 'oracle-store',
|
|
41
|
+
user: process.env.ORACLE_DATABASE_USER,
|
|
42
|
+
password: process.env.ORACLE_DATABASE_PASSWORD,
|
|
43
|
+
connectString: process.env.ORACLE_DATABASE_CONNECT_STRING,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
await store.init();
|
|
47
|
+
const memory = await store.getStore('memory');
|
|
48
|
+
if (!memory) throw new Error('Oracle memory store is not available');
|
|
49
|
+
|
|
50
|
+
// Create a thread
|
|
51
|
+
await memory.saveThread({
|
|
52
|
+
thread: {
|
|
53
|
+
id: 'thread-123',
|
|
54
|
+
resourceId: 'resource-456',
|
|
55
|
+
title: 'My Thread',
|
|
56
|
+
metadata: { key: 'value' },
|
|
57
|
+
createdAt: new Date(),
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// Add messages to thread
|
|
62
|
+
await memory.saveMessages({
|
|
63
|
+
messages: [
|
|
64
|
+
{
|
|
65
|
+
id: 'msg-789',
|
|
66
|
+
threadId: 'thread-123',
|
|
67
|
+
role: 'user',
|
|
68
|
+
content: { content: 'Hello' },
|
|
69
|
+
resourceId: 'resource-456',
|
|
70
|
+
createdAt: new Date(),
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// Query threads and messages
|
|
76
|
+
const savedThread = await memory.getThreadById({ threadId: 'thread-123' });
|
|
77
|
+
const { messages } = await memory.listMessages({ threadId: 'thread-123' });
|
|
78
|
+
```
|
|
79
|
+
|
|
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
|
|
308
|
+
|
|
309
|
+
### Vector Store Methods
|
|
310
|
+
|
|
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
|
|
326
|
+
|
|
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
|
+
```
|
|
392
|
+
|
|
393
|
+
## Related Links
|
|
394
|
+
|
|
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)
|
package/package.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mastra/oracledb",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "Oracle Database provider for Mastra storage and vector retrieval",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"default": "./dist/index.cjs"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"./package.json": "./package.json"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build:lib": "tsup --silent --config tsup.config.ts",
|
|
23
|
+
"prepack": "tsx ../../scripts/generate-package-docs.ts",
|
|
24
|
+
"build:watch": "pnpm build:lib --watch",
|
|
25
|
+
"test": "pnpm test:unit",
|
|
26
|
+
"test:unit": "vitest run --exclude \"src/**/*.integration.test.ts\"",
|
|
27
|
+
"pretest:integration": "docker compose up -d --wait",
|
|
28
|
+
"test:integration": "pnpm test:storage-integration && pnpm test:vector-integration",
|
|
29
|
+
"posttest:integration": "docker compose down -v",
|
|
30
|
+
"typecheck": "tsc --noEmit",
|
|
31
|
+
"lint": "eslint .",
|
|
32
|
+
"test:vector-integration": "RUN_ORACLE_VECTOR_INTEGRATION=true vitest run src/vector/index.integration.test.ts",
|
|
33
|
+
"test:storage-integration": "RUN_ORACLE_STORAGE_INTEGRATION=true vitest run --fileParallelism=false src/storage/index.test.ts src/storage/index.integration.test.ts"
|
|
34
|
+
},
|
|
35
|
+
"license": "Apache-2.0",
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"oracledb": "^6.10.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@internal/lint": "workspace:*",
|
|
41
|
+
"@internal/types-builder": "workspace:*",
|
|
42
|
+
"@mastra/core": "workspace:*",
|
|
43
|
+
"@types/node": "22.19.15",
|
|
44
|
+
"@types/oracledb": "6.5.2",
|
|
45
|
+
"@vitest/coverage-v8": "catalog:",
|
|
46
|
+
"@vitest/ui": "catalog:",
|
|
47
|
+
"eslint": "^10.4.1",
|
|
48
|
+
"tsup": "^8.5.1",
|
|
49
|
+
"tsx": "catalog:",
|
|
50
|
+
"typescript": "catalog:",
|
|
51
|
+
"vitest": "catalog:"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"@mastra/core": ">=1.34.0-0 <2.0.0-0"
|
|
55
|
+
},
|
|
56
|
+
"files": [
|
|
57
|
+
"dist",
|
|
58
|
+
"CHANGELOG.md"
|
|
59
|
+
],
|
|
60
|
+
"homepage": "https://mastra.ai",
|
|
61
|
+
"repository": {
|
|
62
|
+
"type": "git",
|
|
63
|
+
"url": "git+https://github.com/mastra-ai/mastra.git",
|
|
64
|
+
"directory": "stores/oracledb"
|
|
65
|
+
},
|
|
66
|
+
"bugs": {
|
|
67
|
+
"url": "https://github.com/mastra-ai/mastra/issues"
|
|
68
|
+
},
|
|
69
|
+
"engines": {
|
|
70
|
+
"node": ">=22.13.0"
|
|
71
|
+
}
|
|
72
|
+
}
|