@mikro-orm/mssql 7.1.0-dev.26 → 7.1.0-dev.28

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.
@@ -1,5 +1,5 @@
1
- import { type AnyEntity, type EntityClass, type EntitySchema, MikroORM, type Options, type IDatabaseDriver, type EntityManager, type EntityManagerType } from '@mikro-orm/core';
2
- import type { SqlEntityManager } from '@mikro-orm/sql';
1
+ import { type AnyEntity, type EntityClass, type EntitySchema, type MikroORM, type Options, type IDatabaseDriver, type EntityManager, type EntityManagerType } from '@mikro-orm/core';
2
+ import { SqlMikroORM, type SqlEntityManager } from '@mikro-orm/sql';
3
3
  import { MsSqlDriver } from './MsSqlDriver.js';
4
4
  /** Configuration options for the MSSQL driver. */
5
5
  export type MsSqlOptions<EM extends SqlEntityManager<MsSqlDriver> = SqlEntityManager<MsSqlDriver>, Entities extends readonly (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]> = Partial<Options<MsSqlDriver, EM, Entities>>;
@@ -8,7 +8,7 @@ export declare function defineMsSqlConfig<EM extends SqlEntityManager<MsSqlDrive
8
8
  /**
9
9
  * @inheritDoc
10
10
  */
11
- export declare class MsSqlMikroORM<EM extends SqlEntityManager<MsSqlDriver> = SqlEntityManager<MsSqlDriver>, Entities extends readonly (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]> extends MikroORM<MsSqlDriver, EM, Entities> {
11
+ export declare class MsSqlMikroORM<EM extends SqlEntityManager<MsSqlDriver> = SqlEntityManager<MsSqlDriver>, Entities extends readonly (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]> extends SqlMikroORM<MsSqlDriver, EM, Entities> {
12
12
  /**
13
13
  * @inheritDoc
14
14
  */
package/MsSqlMikroORM.js CHANGED
@@ -1,4 +1,5 @@
1
- import { defineConfig, MikroORM, } from '@mikro-orm/core';
1
+ import { defineConfig, } from '@mikro-orm/core';
2
+ import { SqlMikroORM } from '@mikro-orm/sql';
2
3
  import { MsSqlDriver } from './MsSqlDriver.js';
3
4
  /** Creates a type-safe configuration object for the MSSQL driver. */
4
5
  export function defineMsSqlConfig(options) {
@@ -7,7 +8,7 @@ export function defineMsSqlConfig(options) {
7
8
  /**
8
9
  * @inheritDoc
9
10
  */
10
- export class MsSqlMikroORM extends MikroORM {
11
+ export class MsSqlMikroORM extends SqlMikroORM {
11
12
  /**
12
13
  * @inheritDoc
13
14
  */
package/MsSqlPlatform.js CHANGED
@@ -154,16 +154,17 @@ export class MsSqlPlatform extends AbstractSqlPlatform {
154
154
  getSearchJsonPropertyKey(path, type, aliased, value) {
155
155
  const [a, ...b] = path;
156
156
  /* v8 ignore next */
157
- const root = this.quoteIdentifier(aliased ? `${ALIAS_REPLACEMENT}.${a}` : a);
157
+ const root = aliased ? `[${ALIAS_REPLACEMENT}].${this.quoteIdentifier(a)}` : this.quoteIdentifier(a);
158
158
  const types = {
159
159
  boolean: 'bit',
160
160
  };
161
161
  const cast = (key) => raw(type in types ? `cast(${key} as ${types[type]})` : key);
162
+ const jsonPath = this.quoteValue(`$.${b.map(this.quoteJsonKey).join('.')}`);
162
163
  /* v8 ignore next */
163
164
  if (path.length === 0) {
164
- return cast(`json_value(${root}, '$.${b.map(this.quoteJsonKey).join('.')}')`);
165
+ return cast(`json_value(${root}, ${jsonPath})`);
165
166
  }
166
- return cast(`json_value(${root}, '$.${b.map(this.quoteJsonKey).join('.')}')`);
167
+ return cast(`json_value(${root}, ${jsonPath})`);
167
168
  }
168
169
  getJsonArrayFromSQL(column, alias, properties) {
169
170
  const columns = properties
@@ -191,7 +192,7 @@ export class MsSqlPlatform extends AbstractSqlPlatform {
191
192
  if (RawQueryFragment.isKnownFragment(id)) {
192
193
  return super.quoteIdentifier(id);
193
194
  }
194
- return `[${id.toString().replace('.', `].[`)}]`;
195
+ return `[${id.toString().replaceAll(']', ']]').replace('.', `].[`)}]`;
195
196
  }
196
197
  escape(value) {
197
198
  if (value instanceof UnicodeString) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/mssql",
3
- "version": "7.1.0-dev.26",
3
+ "version": "7.1.0-dev.28",
4
4
  "description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
5
5
  "keywords": [
6
6
  "data-mapper",
@@ -47,17 +47,17 @@
47
47
  "copy": "node ../../scripts/copy.mjs"
48
48
  },
49
49
  "dependencies": {
50
- "@mikro-orm/sql": "7.1.0-dev.26",
51
- "kysely": "0.28.16",
50
+ "@mikro-orm/sql": "7.1.0-dev.28",
51
+ "kysely": "0.28.17",
52
52
  "tarn": "3.0.2",
53
53
  "tedious": "19.2.1",
54
54
  "tsqlstring": "1.0.1"
55
55
  },
56
56
  "devDependencies": {
57
- "@mikro-orm/core": "^7.0.13"
57
+ "@mikro-orm/core": "^7.0.14"
58
58
  },
59
59
  "peerDependencies": {
60
- "@mikro-orm/core": "7.1.0-dev.26"
60
+ "@mikro-orm/core": "7.1.0-dev.28"
61
61
  },
62
62
  "engines": {
63
63
  "node": ">= 22.17.0"