@mikro-orm/mssql 7.0.2-dev.13 → 7.0.2-dev.14

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,6 +1,7 @@
1
1
  import { AbstractSqlConnection, type TransactionEventBroadcaster } from '@mikro-orm/sql';
2
2
  import { type ControlledTransaction, MssqlDialect } from 'kysely';
3
3
  import type { ConnectionConfiguration } from 'tedious';
4
+ /** Microsoft SQL Server database connection using the `tedious` driver. */
4
5
  export declare class MsSqlConnection extends AbstractSqlConnection {
5
6
  createKyselyDialect(overrides: ConnectionConfiguration): MssqlDialect;
6
7
  private mapOptions;
@@ -2,6 +2,7 @@ import { AbstractSqlConnection, Utils } from '@mikro-orm/sql';
2
2
  import { MssqlDialect } from 'kysely';
3
3
  import * as Tedious from 'tedious';
4
4
  import * as Tarn from 'tarn';
5
+ /** Microsoft SQL Server database connection using the `tedious` driver. */
5
6
  export class MsSqlConnection extends AbstractSqlConnection {
6
7
  createKyselyDialect(overrides) {
7
8
  const options = this.mapOptions(overrides);
package/MsSqlDriver.d.ts CHANGED
@@ -3,6 +3,7 @@ import { AbstractSqlDriver, type SqlEntityManager } from '@mikro-orm/sql';
3
3
  import { MsSqlConnection } from './MsSqlConnection.js';
4
4
  import { MsSqlQueryBuilder } from './MsSqlQueryBuilder.js';
5
5
  import { MsSqlMikroORM } from './MsSqlMikroORM.js';
6
+ /** Database driver for Microsoft SQL Server. */
6
7
  export declare class MsSqlDriver extends AbstractSqlDriver<MsSqlConnection> {
7
8
  constructor(config: Configuration);
8
9
  nativeInsertMany<T extends AnyEntity<T>>(entityName: EntityName<T>, data: EntityDictionary<T>[], options?: NativeInsertUpdateManyOptions<T>): Promise<QueryResult<T>>;
package/MsSqlDriver.js CHANGED
@@ -4,6 +4,7 @@ import { MsSqlConnection } from './MsSqlConnection.js';
4
4
  import { MsSqlPlatform } from './MsSqlPlatform.js';
5
5
  import { MsSqlQueryBuilder } from './MsSqlQueryBuilder.js';
6
6
  import { MsSqlMikroORM } from './MsSqlMikroORM.js';
7
+ /** Database driver for Microsoft SQL Server. */
7
8
  export class MsSqlDriver extends AbstractSqlDriver {
8
9
  constructor(config) {
9
10
  super(config, new MsSqlPlatform(), MsSqlConnection, ['kysely', 'tedious']);
@@ -1,4 +1,5 @@
1
1
  import { ExceptionConverter, type Dictionary, type DriverException } from '@mikro-orm/core';
2
+ /** Converts MSSQL native errors into typed MikroORM driver exceptions. */
2
3
  export declare class MsSqlExceptionConverter extends ExceptionConverter {
3
4
  /**
4
5
  * @see https://docs.microsoft.com/en-us/sql/relational-databases/errors-events/mssqlserver-511-database-engine-error?view=sql-server-ver15
@@ -1,4 +1,5 @@
1
1
  import { ExceptionConverter, InvalidFieldNameException, NonUniqueFieldNameException, NotNullConstraintViolationException, SyntaxErrorException, TableExistsException, TableNotFoundException, UniqueConstraintViolationException, } from '@mikro-orm/core';
2
+ /** Converts MSSQL native errors into typed MikroORM driver exceptions. */
2
3
  export class MsSqlExceptionConverter extends ExceptionConverter {
3
4
  /**
4
5
  * @see https://docs.microsoft.com/en-us/sql/relational-databases/errors-events/mssqlserver-511-database-engine-error?view=sql-server-ver15
@@ -1,7 +1,9 @@
1
1
  import { type AnyEntity, type EntityClass, type EntitySchema, MikroORM, type Options, type IDatabaseDriver, type EntityManager, type EntityManagerType } from '@mikro-orm/core';
2
2
  import type { SqlEntityManager } from '@mikro-orm/sql';
3
3
  import { MsSqlDriver } from './MsSqlDriver.js';
4
+ /** Configuration options for the MSSQL driver. */
4
5
  export type MsSqlOptions<EM extends SqlEntityManager<MsSqlDriver> = SqlEntityManager<MsSqlDriver>, Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]> = Partial<Options<MsSqlDriver, EM, Entities>>;
6
+ /** Creates a type-safe configuration object for the MSSQL driver. */
5
7
  export declare function defineMsSqlConfig<EM extends SqlEntityManager<MsSqlDriver> = SqlEntityManager<MsSqlDriver>, Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]>(options: Partial<Options<MsSqlDriver, EM, Entities>>): Partial<Options<MsSqlDriver, EM, Entities>>;
6
8
  /**
7
9
  * @inheritDoc
package/MsSqlMikroORM.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { defineConfig, MikroORM, } from '@mikro-orm/core';
2
2
  import { MsSqlDriver } from './MsSqlDriver.js';
3
+ /** Creates a type-safe configuration object for the MSSQL driver. */
3
4
  export function defineMsSqlConfig(options) {
4
5
  return defineConfig({ driver: MsSqlDriver, ...options });
5
6
  }
@@ -3,6 +3,7 @@ import { MsSqlSchemaHelper } from './MsSqlSchemaHelper.js';
3
3
  import { MsSqlExceptionConverter } from './MsSqlExceptionConverter.js';
4
4
  import { MsSqlSchemaGenerator } from './MsSqlSchemaGenerator.js';
5
5
  import type { MsSqlDriver } from './MsSqlDriver.js';
6
+ /** Platform implementation for Microsoft SQL Server. */
6
7
  export declare class MsSqlPlatform extends AbstractSqlPlatform {
7
8
  #private;
8
9
  protected readonly schemaHelper: MsSqlSchemaHelper;
package/MsSqlPlatform.js CHANGED
@@ -6,6 +6,7 @@ import { MsSqlExceptionConverter } from './MsSqlExceptionConverter.js';
6
6
  import { MsSqlSchemaGenerator } from './MsSqlSchemaGenerator.js';
7
7
  import { UnicodeCharacterType } from './UnicodeCharacterType.js';
8
8
  import { UnicodeString, UnicodeStringType } from './UnicodeStringType.js';
9
+ /** Platform implementation for Microsoft SQL Server. */
9
10
  export class MsSqlPlatform extends AbstractSqlPlatform {
10
11
  schemaHelper = new MsSqlSchemaHelper(this);
11
12
  exceptionConverter = new MsSqlExceptionConverter();
@@ -1,5 +1,6 @@
1
1
  import { type AnyEntity, type RequiredEntityData } from '@mikro-orm/core';
2
2
  import { type InsertQueryBuilder, QueryBuilder } from '@mikro-orm/sql';
3
+ /** Query builder with MSSQL-specific behavior such as identity insert handling. */
3
4
  export declare class MsSqlQueryBuilder<Entity extends object = AnyEntity, RootAlias extends string = never, Hint extends string = never, Context extends object = never> extends QueryBuilder<Entity, RootAlias, Hint, Context> {
4
5
  insert(data: RequiredEntityData<Entity> | RequiredEntityData<Entity>[]): InsertQueryBuilder<Entity, RootAlias, Context>;
5
6
  private checkIdentityInsert;
@@ -1,5 +1,6 @@
1
1
  import { QueryFlag, Utils } from '@mikro-orm/core';
2
2
  import { QueryBuilder } from '@mikro-orm/sql';
3
+ /** Query builder with MSSQL-specific behavior such as identity insert handling. */
3
4
  export class MsSqlQueryBuilder extends QueryBuilder {
4
5
  insert(data) {
5
6
  this.checkIdentityInsert(data);
@@ -1,5 +1,6 @@
1
1
  import { type ClearDatabaseOptions, type DropSchemaOptions, type MikroORM, SchemaGenerator } from '@mikro-orm/sql';
2
2
  import type { MsSqlDriver } from './MsSqlDriver.js';
3
+ /** Schema generator with MSSQL-specific behavior for clearing and dropping schemas. */
3
4
  export declare class MsSqlSchemaGenerator extends SchemaGenerator {
4
5
  static register(orm: MikroORM<MsSqlDriver>): void;
5
6
  clear(options?: ClearDatabaseOptions): Promise<void>;
@@ -1,4 +1,5 @@
1
1
  import { SchemaGenerator } from '@mikro-orm/sql';
2
+ /** Schema generator with MSSQL-specific behavior for clearing and dropping schemas. */
2
3
  export class MsSqlSchemaGenerator extends SchemaGenerator {
3
4
  static register(orm) {
4
5
  orm.config.registerExtension('@mikro-orm/schema-generator', () => new MsSqlSchemaGenerator(orm.em));
@@ -1,4 +1,5 @@
1
1
  import { type AbstractSqlConnection, type CheckDef, type Column, type DatabaseSchema, type DatabaseTable, type Dictionary, type ForeignKey, type IndexDef, SchemaHelper, type Table, type TableDifference, type Type } from '@mikro-orm/sql';
2
+ /** Schema introspection helper for Microsoft SQL Server. */
2
3
  export declare class MsSqlSchemaHelper extends SchemaHelper {
3
4
  static readonly DEFAULT_VALUES: {
4
5
  true: string[];
@@ -1,5 +1,6 @@
1
1
  import { EnumType, SchemaHelper, StringType, TextType, Utils, } from '@mikro-orm/sql';
2
2
  import { UnicodeStringType } from './UnicodeStringType.js';
3
+ /** Schema introspection helper for Microsoft SQL Server. */
3
4
  export class MsSqlSchemaHelper extends SchemaHelper {
4
5
  static DEFAULT_VALUES = {
5
6
  true: ['1'],
@@ -1,5 +1,6 @@
1
1
  import type { Platform, EntityProperty } from '@mikro-orm/core';
2
2
  import { UnicodeStringType } from './UnicodeStringType.js';
3
+ /** Custom type for MSSQL nchar (fixed-length Unicode character) columns. */
3
4
  export declare class UnicodeCharacterType extends UnicodeStringType {
4
5
  getColumnType(prop: EntityProperty, platform: Platform): string;
5
6
  getDefaultLength(platform: Platform): number;
@@ -1,4 +1,5 @@
1
1
  import { UnicodeStringType } from './UnicodeStringType.js';
2
+ /** Custom type for MSSQL nchar (fixed-length Unicode character) columns. */
2
3
  export class UnicodeCharacterType extends UnicodeStringType {
3
4
  getColumnType(prop, platform) {
4
5
  const length = prop.length === -1 ? 'max' : (prop.length ?? this.getDefaultLength(platform));
@@ -1,4 +1,5 @@
1
1
  import { type Platform, Type } from '@mikro-orm/core';
2
+ /** Wrapper for string values that should be stored as Unicode (nvarchar) in MSSQL. */
2
3
  export declare class UnicodeString {
3
4
  readonly value: string;
4
5
  constructor(value: string);
@@ -7,6 +8,7 @@ export declare class UnicodeString {
7
8
  toJSON(): string;
8
9
  [Symbol.toPrimitive](): string;
9
10
  }
11
+ /** Custom type for MSSQL nvarchar columns with automatic Unicode string wrapping. */
10
12
  export declare class UnicodeStringType extends Type<string | null, string | null> {
11
13
  getColumnType(prop: {
12
14
  length?: number;
@@ -1,4 +1,5 @@
1
1
  import { Type } from '@mikro-orm/core';
2
+ /** Wrapper for string values that should be stored as Unicode (nvarchar) in MSSQL. */
2
3
  export class UnicodeString {
3
4
  value;
4
5
  constructor(value) {
@@ -17,6 +18,7 @@ export class UnicodeString {
17
18
  return this.value;
18
19
  }
19
20
  }
21
+ /** Custom type for MSSQL nvarchar columns with automatic Unicode string wrapping. */
20
22
  export class UnicodeStringType extends Type {
21
23
  getColumnType(prop, platform) {
22
24
  const length = prop.length === -1 ? 'max' : (prop.length ?? this.getDefaultLength(platform));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/mssql",
3
- "version": "7.0.2-dev.13",
3
+ "version": "7.0.2-dev.14",
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,7 +47,7 @@
47
47
  "copy": "node ../../scripts/copy.mjs"
48
48
  },
49
49
  "dependencies": {
50
- "@mikro-orm/sql": "7.0.2-dev.13",
50
+ "@mikro-orm/sql": "7.0.2-dev.14",
51
51
  "kysely": "0.28.11",
52
52
  "tarn": "3.0.2",
53
53
  "tedious": "19.2.1",
@@ -57,7 +57,7 @@
57
57
  "@mikro-orm/core": "^7.0.1"
58
58
  },
59
59
  "peerDependencies": {
60
- "@mikro-orm/core": "7.0.2-dev.13"
60
+ "@mikro-orm/core": "7.0.2-dev.14"
61
61
  },
62
62
  "engines": {
63
63
  "node": ">= 22.17.0"