@mikro-orm/oracledb 7.0.0-dev.335 → 7.0.0-dev.336

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.
@@ -3,6 +3,7 @@ import { OracleSchemaHelper } from './OracleSchemaHelper.js';
3
3
  import { OracleExceptionConverter } from './OracleExceptionConverter.js';
4
4
  import { OracleSchemaGenerator } from './OracleSchemaGenerator.js';
5
5
  export declare class OraclePlatform extends AbstractSqlPlatform {
6
+ #private;
6
7
  protected readonly schemaHelper: OracleSchemaHelper;
7
8
  protected readonly exceptionConverter: OracleExceptionConverter;
8
9
  /** @inheritDoc */
@@ -103,6 +104,10 @@ export declare class OraclePlatform extends AbstractSqlPlatform {
103
104
  usesCascadeStatement(): boolean;
104
105
  getSearchJsonPropertyKey(path: string[], type: string, aliased: boolean, value?: unknown): string;
105
106
  processJsonCondition<T extends object>(o: FilterQuery<T>, value: EntityValue<T>, path: EntityKey<T>[], alias: boolean): FilterQuery<T>;
107
+ getJsonArrayFromSQL(column: string, alias: string, properties: {
108
+ name: string;
109
+ type: string;
110
+ }[]): string;
106
111
  usesEnumCheckConstraints(): boolean;
107
112
  supportsMultipleCascadePaths(): boolean;
108
113
  /** @inheritDoc */
package/OraclePlatform.js CHANGED
@@ -15,6 +15,12 @@ const ORACLE_TYPE_MAP = {
15
15
  export class OraclePlatform extends AbstractSqlPlatform {
16
16
  schemaHelper = new OracleSchemaHelper(this);
17
17
  exceptionConverter = new OracleExceptionConverter();
18
+ #jsonTypeCasts = {
19
+ string: 'varchar2(4000)',
20
+ number: 'number',
21
+ bigint: 'number',
22
+ boolean: 'number',
23
+ };
18
24
  /** @inheritDoc */
19
25
  lookupExtensions(orm) {
20
26
  OracleSchemaGenerator.register(orm);
@@ -196,9 +202,7 @@ export class OraclePlatform extends AbstractSqlPlatform {
196
202
  if (b.length === 0) {
197
203
  return raw(`json_equal(${root}, json(?))`, [value]);
198
204
  }
199
- /* v8 ignore next: special-char JSON key quoting */
200
- const quoteKey = (key) => (/^[a-z]\w*$/i.exec(key) ? key : `"${key}"`);
201
- return raw(`json_value(${root}, '$.${b.map(quoteKey).join('.')}')`);
205
+ return raw(`json_value(${root}, '$.${b.map(this.quoteJsonKey).join('.')}')`);
202
206
  }
203
207
  processJsonCondition(o, value, path, alias) {
204
208
  if (Utils.isPlainObject(value) && !Object.keys(value).some(k => Utils.isOperator(k))) {
@@ -216,6 +220,12 @@ export class OraclePlatform extends AbstractSqlPlatform {
216
220
  o[k] = path.length > 1 ? value : [];
217
221
  return o;
218
222
  }
223
+ getJsonArrayFromSQL(column, alias, properties) {
224
+ const columns = properties
225
+ .map(p => `${this.quoteIdentifier(p.name)} ${this.#jsonTypeCasts[p.type] ?? 'varchar2(4000)'} path '$.${this.quoteJsonKey(p.name)}'`)
226
+ .join(', ');
227
+ return `json_table(${column}, '$[*]' columns (${columns})) ${this.quoteIdentifier(alias)}`;
228
+ }
219
229
  usesEnumCheckConstraints() {
220
230
  return true;
221
231
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/oracledb",
3
- "version": "7.0.0-dev.335",
3
+ "version": "7.0.0-dev.336",
4
4
  "description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, MariaDB, PostgreSQL, SQLite, MSSQL and Oracle databases.",
5
5
  "keywords": [
6
6
  "data-mapper",
@@ -42,7 +42,7 @@
42
42
  "copy": "node ../../scripts/copy.mjs"
43
43
  },
44
44
  "dependencies": {
45
- "@mikro-orm/sql": "7.0.0-dev.335",
45
+ "@mikro-orm/sql": "7.0.0-dev.336",
46
46
  "kysely": "0.28.11",
47
47
  "oracledb": "6.10.0"
48
48
  },
@@ -50,7 +50,7 @@
50
50
  "@mikro-orm/core": "^6.6.9"
51
51
  },
52
52
  "peerDependencies": {
53
- "@mikro-orm/core": "7.0.0-dev.335"
53
+ "@mikro-orm/core": "7.0.0-dev.336"
54
54
  },
55
55
  "engines": {
56
56
  "node": ">= 22.17.0"