Skip to content

Commit 3aa0b42

Browse files
feat(spec,driver-sql,service-datasource): Oracle Database as a federation dialect — read live, write behind both opt-ins, never managed (#31351)
<!-- claude-projects-attribution: {"github_login":"marchtian"} --> _Requested by **田騏** · [project thread](https://claude.ai/code/project/chan_01VmuUhXU9SSUzqJYyXSmYSi?thread=cmsg_01VmuUhXU9SSUzqJYyXSmYSiCoB7HoenXh7jmQHqPgnxH8)_ Fixes #31328 ## What changes Oracle Database becomes a **federation dialect** of `driver-sql`. An external datasource over Oracle reads live, and writes when both write opt-ins are on. It is never managed. **`@objectstack/spec`** - The `oracle` driver row (alias `oracledb`) is federation-only. It is `hasLocalDefault: false` and never a boot selection. A `managed` oracle datasource, including the default mode, is refused at `defineStack` at path `schemaMode`, and the message names the scope and the fix. - `OracleConfigSchema` (`driver/oracle.zod.ts`): `connectString`, or `host` / `port` (default 1521) / `serviceName`, plus `username`. `password`, `url` and the TLS keys are refused by name, each with the spelling that works. - A datasource `ssl` block that asks for TLS is refused on oracle. Thin mode takes TLS from a `tcps://` connect string and the factory never hands the block to the driver, so the block would be dropped. A private certificate authority is reached through a PEM wallet the connect string names (`?wallet_location=DIR` holding `ewallet.pem`, or `(SECURITY=(MY_WALLET_DIRECTORY=DIR))` in a descriptor); the connect string reaches the driver verbatim. That route follows node-oracledb 6.10's Thin-mode source and has not been run against a live TLS listener. - Type-compat `SqlDialect` gains `'oracle'`, with `DIALECT_ALIASES.oracle` and parameterised `NUMBER(p,s)` / `RAW(16)` handling. On oracle every field pairing over a `RAW(16)` uuid column (`lookup` included) is `'lossy'`, so a draft carries a review marker until #31390 binds the uuid string back to RAW. - ADR-0015 §4.6 lists Oracle, and §5.1 names the DDL gate's federation-only arm. This is governed and owes a CONTRACT_REVIEW_TIER review. **`@objectstack/driver-sql`** - `client: 'oracledb'` uses a knex client subclass over node-oracledb **Thin** mode. `oracledb` is an optional peer. - Paging uses `OFFSET … ROWS FETCH NEXT … ROWS ONLY`, so the minimum version is **Oracle 12c R1**. - Identifiers are quoted as the catalog folds them (UPPER). - `LIKE` gets a bound `ESCAPE`. `$contains` is case-exact, and `$icontains` folds ASCII only through `translate()`. - A `NUMBER(1)` flag reads as a boolean, and a boolean writes 1 / 0. `BOOLEAN` is native on 23ai. - Temporal values: datetime and date comparands and writes bind as instants (`TIMESTAMP WITH TIME ZONE`) on a UTC session. The fetch path repairs Thin's local-clock decode of `DATE` / `TIMESTAMP`. `RAW(16)` reads as a UUID string. Date buckets use `to_char(sys_extract_utc(…))`. - Introspection runs four catalog reads, scoped to `SYS_CONTEXT('USERENV','CURRENT_SCHEMA')`: ALL_TABLES, ALL_TAB_COLUMNS, and PK/unique and FK from ALL_CONSTRAINTS. A cross-schema FK parent carries `referencedSchema`. - Refusals: - every DDL operation: `UnsupportedDialectEmissionError`, reason `federation-only`; - a `''` comparand on `= $eq $ne $in $nin $gt $gte $lt $lte $between`: `INVALID_FILTER`, withheld subtree. Oracle stores `''` as NULL, so the comparison would silently mean IS NULL; - JSON-array membership: `INVALID_FILTER`; - upsert: `NOT_IMPLEMENTED` / 501. No MERGE is emitted, and the docs state this. - **Arms found only on the live server**, not in the card. Each has a compile pin and a live pin: - `$empty` on a text column compiles as IS NULL / IS NOT NULL. `= ''` / `<> ''` compare against NULL there, so `$empty: false` answered no rows. - A `Date` comparand against a NON-temporal column binds as its canonical ISO text. Bound as a TIMESTAMP, it made Oracle convert the text column, which raised on every non-timestamp row. **`@objectstack/service-datasource`** - The shared factory has an oracle arm. It composes `host:port/serviceName` or passes `connectString` verbatim, and the password is the bound secret. A legacy stored `ssl` block is refused at this last door too. - `oracledb` joins `OPTIONAL_DRIVER_CLIENT_PACKAGES`, so a missing package is answered with its install. This is pinned through the real factory and boot path. **Docs:** `external-datasources.mdx` gains an Oracle section covering the config shape, minimum version, Thin mode, TLS, value mapping, introspection scope, and every refusal including the upsert 501. ## Pre-existing defects found here: ported separately, now on main Oracle made three defects visible that exist on **every dialect**, because every Oracle table is bound through `external.columnMap` (its columns are UPPER-case): `aggregate()` / `distinct()` and `update()` / `delete()` / `bulkDelete()` named the field instead of the mapped column, and a paged read got no unique tie-breaker. They were carried here as temporary commits and ported to `main` through #31340 and #31342. Both have landed, and main is merged, so none of those commits or changesets remain in this PR's diff. ## Why #31328: federation over the Oracle estates that customers already run, with no ETL. ## Verification - **Live conformance:** `sql-driver-oracle-federation-conformance.test.ts` runs against gvenzl/oracle-free 23ai: **261/261 pass**, under `TZ=America/New_York` and again under `TZ=Asia/Shanghai`. The same harness runs on SQLite as a control: raw remote DDL, `columnMap`, external mode, rows written through `create()`. - Case-sets run: `FILTER_LOGIC_CASES`, `FILTER_TEXT_CASES`, `PAGINATION_CASES`, `PAGINATION_UNORDERED_CASES`, `PAGINATION_ZERO_LIMIT_CASES`, `FILTER_COMPARAND_TYPE_CASES` (the executed half; the door-refusal half is dialect-free and pinned elsewhere), `AGGREGATION_CASES`, `TEMPORAL_CASES`. - Not run, each with its reason: - `TEMPORAL_TIME_CASES`: Oracle has no TIME type, so a remote time-of-day column has no single storage form to hold the set to. - `VALUE_ROUNDTRIP_CASES`, `READABLE_IDS_CASES`, `UNIQUE_NULL_DISTINCT_CASES`: they pin the driver's OWN managed storage forms and indexes, which a federation-only dialect never creates. - `BULK_WRITE_HOOK`: an engine-layer contract, not a dialect one. - **CI does not provision Oracle.** Without `OS_TEST_ORACLE_URL` the Oracle cell is a **named skip** ("is provisioned — set OS_TEST_ORACLE_URL…"), never a pass. `OS_EXPECT_LIVE_ORACLE=1` turns that skip into a failure. The cell lives in `live-dialect-matrix.testkit.ts` as `ORACLE_CELL`, outside `DIALECT_CELLS`, and `OS_EXPECT_LIVE_DIALECT_MATRIX` does not apply to it. - **Compile-level pins:** 41 in `sql-driver-oracle-dialect.test.ts`, covering every emitter arm and refusal. The two new builders have refusal-seam rows. - **Also verified live** beyond the conformance file: create (with and without id; a RAW(16) default reads back as a uuid), update, updateMany, delete, bulkCreate, deleteMany, introspection (PK, composite PK, single-column unique, FK, types), BOOLEAN / NUMBER(1) / CLOB reads. - **Suites at cdd0a22:** driver-sql 4066 passed / 219 skipped; the live Oracle conformance file 261/261. service-datasource 1285 passed. spec `src/data` 6051 passed. `check:generated` fresh, and `check:test-typecheck` OK with an 8 GB heap. - Dispatch gates: posted in the os-dev-report comment. **Known limitations (in the docs):** - During a DST spring-forward gap hour in a non-UTC server process, the read repair is off by the gap. Running with `TZ=UTC` removes the gap. - A `NUMBER` above 2^53 loses precision. - Filtering or writing a `RAW(16)` column by its uuid string is unsupported; the type matrix flags those pairings `'lossy'`. `HEXTORAW` binding: #31390. - Introspection lists the current schema only. Another owner's table is bound by `remoteName: 'OWNER.TABLE'`. - Oracle is not yet offered in the Studio driver catalog's connection form: #31389. Clause-②: yes (widening) Metadata-protocol: added Changed lines: 2851 (+2765 / -86), under the 3000 threshold. ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; `pnpm lint` passes. - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: its generated artifacts are regenerated and committed. - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. - [x] The *Before Submitting* list in CONTRIBUTING.md is done. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_017ihL2cVRvyiEh4PJ1FTQGi <!-- signed: epic:#27261#1 · marchtian · session_017ihL2cVRvyiEh4PJ1FTQGi --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 9728ab1 commit 3aa0b42

58 files changed

Lines changed: 2765 additions & 86 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
'@objectstack/spec': minor
3+
'@objectstack/driver-sql': minor
4+
'@objectstack/service-datasource': minor
5+
---
6+
7+
feat(spec,driver-sql,service-datasource): Oracle Database as a federation dialect: read live, write behind both opt-ins, never managed
8+
9+
Clause-②: yes (widening)
10+
Metadata-protocol: added
11+
12+
- **`@objectstack/spec`**: a datasource may name `driver: 'oracle'` (alias `oracledb`), with `OracleConfigSchema` as its `config` contract: `connectString`, or `host` / `port` (default 1521) / `serviceName`, and `username`. `password` (the credential is the bound secret), `url`, and the TLS keys are refused by name with the spelling that works. The row is federation-only (`FEDERATION_ONLY_DRIVER_IDS`, `isFederationOnlyDriver`) with no local default. It is never a boot selection, and a `managed` oracle datasource, including the default mode, is refused at `defineStack` with the scope and the fix named. A datasource `ssl` block that asks for TLS is refused on oracle too, because Thin mode takes TLS from a `tcps://` connect string and would drop the block. A private certificate authority is reached through a PEM wallet the connect string names (`?wallet_location=DIR`, or `MY_WALLET_DIRECTORY` in a descriptor). Two published types narrow with no runtime change: `resolveDatabaseDriverId()` now returns `DatabaseSelectionDriverId | undefined` and `DATABASE_DRIVER_SELECTION_IDS` is `readonly DatabaseSelectionDriverId[]` (new types `DatabaseSelectionDriverId` and `FederationOnlyDriverId`), because no selection spelling resolves to a federation-only id. A consumer that asks `DATABASE_DRIVER_SELECTION_IDS.includes(id)` with a wider `BuiltinDriverId` widens the list first: `(DATABASE_DRIVER_SELECTION_IDS as readonly string[]).includes(id)`. The type-compatibility matrix gains `'oracle'` (`DIALECT_ALIASES.oracle`, `NUMBER(p,s)` / `RAW(16)` parameterised), and ADR-0015 §4.6 lists it. On oracle, `isCompatible` answers `'lossy'` for every field over a `RAW(16)` uuid column, `lookup` included, because the driver cannot yet filter or write it by its UUID string.
13+
- **`@objectstack/driver-sql`**: `client: 'oracledb'` speaks Oracle over node-oracledb in Thin mode, with no Oracle Client libraries. `oracledb` is an optional peer. Minimum Oracle 12c Release 1. Paging uses `OFFSET … ROWS FETCH NEXT … ROWS ONLY`. Identifiers are quoted as the catalog folds them (UPPER). `LIKE` gets a bound `ESCAPE`, and the `$icontains` fold is ASCII-only. A NUMBER(1) flag reads as a boolean. Datetime and date comparands and writes bind as instants on a UTC session, and DATE / TIMESTAMP reads are repaired from Thin's local-clock decode. RAW(16) reads as a UUID string. `$empty` on a text column is its NULL row. Catalog introspection covers the current schema: ALL_TABLES, ALL_TAB_COLUMNS, and PK/unique/FK from ALL_CONSTRAINTS. Refusals: every DDL operation (`UnsupportedDialectEmissionError`, reason `federation-only`); a `''` equality or range comparand (`INVALID_FILTER`, because Oracle stores `''` as NULL and would answer IS NULL); JSON-array membership (`INVALID_FILTER`); and upsert (`NOT_IMPLEMENTED`, 501, because no MERGE is emitted).
14+
- **`@objectstack/service-datasource`**: the shared driver factory builds the oracle arm. It composes `host:port/serviceName` or passes `connectString` verbatim, and the password is the bound secret. A missing `oracledb` package is answered with that package's install.
15+
16+
Held to the shared conformance case-sets over a live Oracle 23ai (`OS_TEST_ORACLE_URL`, declared skip without it, `OS_EXPECT_LIVE_ORACLE=1` to require it). The Oracle section of the external-datasources guide states the minimum version, the config shape, and each refusal.

‎content/docs/data-modeling/drivers.mdx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ libSQL data stayed untouched. Pass the token with `--database-auth-token`
8080
| **MongoDB** | `@objectstack/driver-mongodb` | `MongoDBDriver` | `mongodb` (single-tenant only — see [below](#multi-tenancy-not-supported)) |
8181
| **Turso / libSQL** | `@objectstack/driver-turso` (optional install — see the callout above) | `TursoDriver` | `turso` \| `libsql` |
8282
| **Memory** | `@objectstack/driver-memory` | `InMemoryDriver` | none — not a boot store (see [Memory Driver](#memory-driver)) |
83+
| **Oracle Database** | `@objectstack/driver-sql` (peer: `oracledb`, Thin mode) | `SqlDriver` | none — federation only, an external datasource (see [External datasources](/docs/data-modeling/external-datasources#7-oracle-database)) |
8384

8485
> All SQL flavours (PostgreSQL / MySQL / SQLite) are served by a single
8586
> `@objectstack/driver-sql` package — there is no separate
@@ -102,6 +103,7 @@ driver ships that contract as a zod schema, exported from `@objectstack/spec/dat
102103
| `sqlite-wasm` \| `wasm-sqlite` | `SqliteWasmConfigSchema` | `filename`, `persist` |
103104
| `mongodb` | `MongoConfigSchema` | `url`, `host`, `port`, `database`, `username`, `password`, `authSource`, `options` |
104105
| `memory` \| `in-memory` \| `mingo` | `MemoryConfigSchema` | `initialData`, `strictMode`, `persistence` |
106+
| `oracle` \| `oracledb` | `OracleConfigSchema` | `connectString`, `host`, `port`, `serviceName`, `username` (federation only; TLS by a `tcps://` connect string) |
105107

106108
`mongo` was a second spelling of `mongodb` until 18. It is retired: an authored
107109
`driver: 'mongo'` is refused with the prescription naming `mongodb`, and
@@ -125,15 +127,15 @@ Two things live **outside** `config`, because they are not driver-specific:
125127

126128
- **Pool sizing** — the `pool` block on the datasource (`min`, `max`,
127129
`idleTimeoutMillis`, `connectionTimeoutMillis`), honoured by the pooled
128-
drivers: `postgres` and `mysql` pass all four to Knex, and `mongodb` maps
130+
drivers: `postgres`, `mysql` and `oracle` pass all four to Knex, and `mongodb` maps
129131
`min` / `max` — and only those two — onto the client's `minPoolSize` /
130132
`maxPoolSize`. Everywhere else the block is an **authoring error**, rejected by
131133
the Setup wizard when you save and by the boot when a declared datasource
132134
carries one, rather than dropped:
133135

134136
| Driver | Verdict on `pool` |
135137
| --- | --- |
136-
| `postgres`, `mysql` | all four keys honoured |
138+
| `postgres`, `mysql`, `oracle` | all four keys honoured |
137139
| `mongodb` | `min` / `max` honoured; `idleTimeoutMillis` and `connectionTimeoutMillis` **rejected by name** |
138140
| `sqlite`, `sqlite-wasm` | whole block **rejected** |
139141
| `memory` | whole block **rejected** |

‎content/docs/data-modeling/external-datasources.mdx‎

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,109 @@ remote table/columns: the analytics layer routes such queries through the driver
480480
physical-table resolution (honoring `remoteName` / `remoteSchema`) rather than the
481481
object name, so they never hit the wrong table.
482482

483+
## 7. Oracle Database
484+
485+
Oracle is a **federation-only** dialect. ObjectStack reads an existing Oracle schema
486+
live and writes to it when both write gates are on, but it never owns one. A
487+
`managed` Oracle datasource, including one that leaves `schemaMode` at its default,
488+
is refused when the stack is defined. Every DDL operation is refused by the driver
489+
too.
490+
491+
{/* os:check */}
492+
```typescript
493+
import { defineDatasource } from '@objectstack/spec/data';
494+
495+
export const Erp = defineDatasource({
496+
name: 'erp',
497+
label: 'ERP (Oracle)',
498+
driver: 'oracle', // alias: 'oracledb'
499+
schemaMode: 'external', // required: 'external' or 'validate-only'
500+
config: { host: 'erp-db.internal', port: 1521, serviceName: 'ERPPDB1', username: 'erp_ro' },
501+
external: {
502+
allowWrites: false,
503+
credentialsRef: 'sys_secret:4b1e…', // the password is the bound secret, never inline
504+
},
505+
});
506+
```
507+
508+
**Requirements**
509+
510+
- **Oracle Database 12c Release 1 or later.** Pages are read with
511+
`OFFSET … ROWS FETCH NEXT … ROWS ONLY`, which 12c introduced. Verified live on
512+
Oracle Database 23ai Free.
513+
- **The `oracledb` package.** It is an optional install of `@objectstack/driver-sql`
514+
(`npm install oracledb`). It runs in **Thin mode**, which is pure JavaScript and
515+
needs no Oracle Client libraries. Without the package, the datasource's connect
516+
fails with an error that names that install.
517+
518+
**The `config` block**
519+
520+
| Key | Meaning |
521+
| --- | --- |
522+
| `connectString` | An Easy Connect string (`host:port/service_name`), a `tcps://…` string, or a TNS descriptor. Wins over the keys below when set. |
523+
| `host` / `port` / `serviceName` | Composed into `host:port/serviceName` when there is no `connectString`. `port` defaults to 1521. |
524+
| `username` | The database user. Its schema is the one the Tables tab lists. |
525+
526+
`password` and `url` are refused by name. The password is the bound secret, and an
527+
Oracle connect string is not a URL.
528+
529+
**TLS** is chosen by the connect string: `connectString: 'tcps://erp-db.internal:2484/ERPPDB1'`.
530+
The server is verified against the host's trusted certificate authorities. If the
531+
database's certificate comes from a private certificate authority, put that CA in a
532+
PEM wallet (a directory holding `ewallet.pem`) on the host and name the directory in
533+
the connect string, which reaches the driver unchanged:
534+
`'tcps://erp-db.internal:2484/ERPPDB1?wallet_location=/etc/oracle/wallet'`, or
535+
`(SECURITY=(MY_WALLET_DIRECTORY=/etc/oracle/wallet))` inside a descriptor. This route
536+
follows node-oracledb's Thin-mode connect-string handling and has not been tested
537+
against a live TLS listener here. A datasource `ssl` block and `ca`, `cert`, `key` or
538+
`rejectUnauthorized` config keys are refused rather than silently dropped, because
539+
the driver reads TLS only from the connect string.
540+
541+
**Binding tables.** Oracle stores an unquoted identifier in UPPER case, so an
542+
imported table's columns are `CUST_NO`, `FULL_NAME`, and so on. The Tables tab and
543+
`import_object` map each one to a lower-case field through `external.columnMap`. The
544+
driver quotes the catalog spelling back in every statement. The Tables tab lists the
545+
tables of the connecting user's current schema. Reach another owner's table with an
546+
object whose `remoteName` is `OWNER.TABLE`.
547+
548+
**How values read and compare**
549+
550+
| Remote column | Field | Notes |
551+
| --- | --- | --- |
552+
| `BOOLEAN` (23ai) | `boolean` | Exact. |
553+
| `NUMBER(1)` flag | `boolean` | Judged lossy by the type matrix: it is an integer column. It reads as `true` / `false`, and a write sends `1` / `0`. |
554+
| `CHAR(1)` flag (`'Y'` / `'N'`) | `text` | Judged incompatible with a `boolean` field, so bind it as text. A boolean binding would read every non-NULL letter as `true`. |
555+
| `DATE` | `datetime` | An Oracle `DATE` carries a time of day. A `date` field over it is judged lossy: the time is dropped. |
556+
| `TIMESTAMP WITH TIME ZONE` | `datetime` | Compared and returned as UTC instants. |
557+
| `CLOB` | `textarea` | |
558+
| `RAW(16)` | `text` | Read as a lower-case UUID string. Every field pairing over it is judged lossy, so a draft marks it for review: it cannot be filtered or written by that string yet (see below). |
559+
560+
The driver pins every session to UTC. Thin mode decodes `DATE` and `TIMESTAMP`
561+
values with the server process's local clock, and the driver repairs that on read.
562+
The repair is exact except during the hour a daylight-saving spring-forward skips in
563+
the process's own time zone. Run the server with `TZ=UTC` and there is no such hour.
564+
565+
**What Oracle answers differently**
566+
567+
- **`''` is NULL in Oracle.** A filter that compares against an empty string
568+
(`= ''`, `$ne: ''`, `$in: ['']`, a range bound of `''`) is refused with
569+
`INVALID_FILTER`, because Oracle would answer it as a comparison with NULL rather
570+
than as written. Use `$null` / `$empty` instead. `$empty` on a text column matches
571+
exactly the NULL rows there.
572+
- **Upsert is refused** with `NOT_IMPLEMENTED` (HTTP 501). The driver emits no
573+
`MERGE`. Use create and update.
574+
- **JSON-array membership** (`$contains` on a multi-value field) is refused. There is
575+
no Oracle construct modelled for it.
576+
- **Filtering or writing a `RAW(16)` column by its UUID string is not supported.**
577+
The driver presents the value as a string on read, but it does not convert the
578+
string back to `RAW` for a comparison or a write. This includes a `lookup` keyed
579+
by a `SYS_GUID()` column. Binding through `HEXTORAW` is tracked in
580+
[#31390](https://github.com/objectstack-ai/objectstack/issues/31390).
581+
- A `NUMBER` beyond 2^53 is read as a JavaScript number and loses precision.
582+
- **Paged reads are stable when the object's `columnMap` maps a column to `id`.**
583+
That column breaks ties after the caller's own sort. Without a mapped key, a paged
584+
read has no unique order, and the server logs a warning once per object.
585+
483586
## Multi-tenant hosts
484587

485588
A self-hosted single-environment runtime connects external datasources out of the
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
title: Driver Oracle schema — Data Protocol reference
3+
navTitle: Driver Oracle
4+
description: "Oracle Database driver configuration — the config slot of a datasource whose driver resolves to oracle (oracledb)."
5+
---
6+
7+
{/* ⚠️ AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs live in the module folders under content/docs/. */}
8+
9+
Oracle Database driver configuration — the `config` slot of a `datasource`
10+
whose `driver` resolves to `oracle` (`oracledb`).
11+
12+
Oracle is a FEDERATION-ONLY driver (ADR-0015 §4.6): the datasource must
13+
declare `schemaMode: 'external'` (or `'validate-only'`), and a managed one is
14+
refused at authoring. The platform reads the tables an Oracle system already
15+
owns; it never creates or alters one there.
16+
17+
Every key here is read by `createDefaultDatasourceDriverFactory`
18+
(→ `SqlDriver`, knex `oracledb`, node-oracledb in Thin mode — pure
19+
JavaScript, no Oracle Client libraries on the host). The connection is
20+
opened from an Oracle connect string: either `connectString` verbatim, or
21+
the Easy Connect string `host:port/serviceName` the factory composes from
22+
the discrete keys. Oracle has no `scheme://` URL of its own, so there is no
23+
`url` key to accept here.
24+
25+
Deliberately absent, each because the factory would drop it:
26+
- `autoMigrate` — a managed-schema self-heal, and Oracle is never managed.
27+
- `ssl` (and `ca` / `cert` / `key` / `rejectUnauthorized`) — Thin mode
28+
negotiates TLS from the connect string itself
29+
(`tcps://host:2484/service`), and reads a private CA from the PEM wallet
30+
the connect string names (`?wallet_location=DIR`), not from a key beside
31+
it; the datasource `ssl` block is refused on an oracle datasource for the
32+
same reason.
33+
- `sid` — a SID names an instance, not a service; Thin mode reaches a
34+
SID-only listener through a full descriptor in `connectString`.
35+
36+
<Callout type="info">
37+
**Source:** `packages/spec/src/data/driver/oracle.zod.ts`
38+
</Callout>
39+
40+
## TypeScript Usage
41+
42+
```typescript
43+
import { OracleConfigSchema } from '@objectstack/spec/data';
44+
import type { OracleConfig } from '@objectstack/spec/data';
45+
46+
// Validate data
47+
const result = OracleConfigSchema.parse(data);
48+
```
49+
50+
---
51+
52+
## OracleConfig
53+
54+
Oracle Database connection configuration (federation only)
55+
56+
### Properties
57+
58+
| Property | Type | Required | Description |
59+
| :--- | :--- | :--- | :--- |
60+
| **connectString** | `string` | optional | Oracle connect string — Easy Connect or a full descriptor (supersedes host/port/serviceName) |
61+
| **host** | `string` | optional | Listener host address |
62+
| **port** | `integer` | optional (default: `1521`) | Listener port |
63+
| **serviceName** | `string` | optional | Database service name |
64+
| **username** | `string` | optional | Authentication user (also the default schema) |
65+
| **password** | `never` | optional | Set through the connection form's secret field or `external.credentialsRef` — encrypted into `sys_secret`, never stored in `config`. A datasource defined in code (`defineDatasource`) leaves the credential out of the declaration: it is read at connect time from the runtime environment variable derived from the datasource name (`OS_DATASOURCE_WAREHOUSE_PASSWORD` for a datasource named `warehouse`), which `os serve` / `os start` honour by default (`OS_DATASOURCE_ENV_CREDENTIALS=on`). |
66+
67+
68+
---
69+

‎content/docs/references/data/index.mdx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Data Protocol — complete schema reference
33
navTitle: Data Protocol
4-
description: "The ObjectStack Data Protocol in 32 reference pages: every schema in @objectstack/spec with its properties, types, defaults and a TypeScript example."
4+
description: "The ObjectStack Data Protocol in 33 reference pages: every schema in @objectstack/spec with its properties, types, defaults and a TypeScript example."
55
---
66

77
{/* ⚠️ AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs live in the module folders under content/docs/. */}
@@ -21,6 +21,7 @@ This section contains all protocol schemas for the data layer of ObjectStack.
2121
<Card href="/docs/references/data/driver-mongo" title="Driver Mongo" description="Source: packages/spec/src/data/driver/mongo.zod.ts" />
2222
<Card href="/docs/references/data/driver-mysql" title="Driver Mysql" description="Source: packages/spec/src/data/driver/mysql.zod.ts" />
2323
<Card href="/docs/references/data/driver-nosql" title="Driver Nosql" description="Source: packages/spec/src/data/driver-nosql.zod.ts" />
24+
<Card href="/docs/references/data/driver-oracle" title="Driver Oracle" description="Source: packages/spec/src/data/driver/oracle.zod.ts" />
2425
<Card href="/docs/references/data/driver-postgres" title="Driver Postgres" description="Source: packages/spec/src/data/driver/postgres.zod.ts" />
2526
<Card href="/docs/references/data/driver-sql" title="Driver Sql" description="Source: packages/spec/src/data/driver-sql.zod.ts" />
2627
<Card href="/docs/references/data/driver-sqlite" title="Driver Sqlite" description="Source: packages/spec/src/data/driver/sqlite.zod.ts" />

‎content/docs/references/data/meta.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"driver-memory",
3232
"driver-mongo",
3333
"driver-mysql",
34+
"driver-oracle",
3435
"driver-postgres",
3536
"driver-sqlite",
3637
"driver-turso",

0 commit comments

Comments
 (0)