@mikro-orm/mssql 7.0.5 → 7.0.6-dev.1

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/README.md CHANGED
@@ -133,7 +133,7 @@ const author = await em.findOneOrFail(Author, 1, {
133
133
  populate: ['books'],
134
134
  });
135
135
  author.name = 'Jon Snow II';
136
- author.books.getItems().forEach(book => (book.title += ' (2nd ed.)'));
136
+ author.books.getItems().forEach(book => book.title += ' (2nd ed.)');
137
137
  author.books.add(orm.em.create(Book, { title: 'New Book', author }));
138
138
 
139
139
  // Flush computes change sets and executes them in a single transaction
@@ -2,6 +2,6 @@ import type { Platform, EntityProperty } from '@mikro-orm/core';
2
2
  import { UnicodeStringType } from './UnicodeStringType.js';
3
3
  /** Custom type for MSSQL nchar (fixed-length Unicode character) columns. */
4
4
  export declare class UnicodeCharacterType extends UnicodeStringType {
5
- getColumnType(prop: EntityProperty, platform: Platform): string;
6
- getDefaultLength(platform: Platform): number;
5
+ getColumnType(prop: EntityProperty, platform: Platform): string;
6
+ getDefaultLength(platform: Platform): number;
7
7
  }
@@ -1,11 +1,11 @@
1
1
  import { UnicodeStringType } from './UnicodeStringType.js';
2
2
  /** Custom type for MSSQL nchar (fixed-length Unicode character) columns. */
3
3
  export class UnicodeCharacterType extends UnicodeStringType {
4
- getColumnType(prop, platform) {
5
- const length = prop.length === -1 ? 'max' : (prop.length ?? this.getDefaultLength(platform));
6
- return `nchar(${length})`;
7
- }
8
- getDefaultLength(platform) {
9
- return platform.getDefaultCharLength();
10
- }
4
+ getColumnType(prop, platform) {
5
+ const length = prop.length === -1 ? 'max' : (prop.length ?? this.getDefaultLength(platform));
6
+ return `nchar(${length})`;
7
+ }
8
+ getDefaultLength(platform) {
9
+ return platform.getDefaultCharLength();
10
+ }
11
11
  }
@@ -1,24 +1,21 @@
1
1
  import { type Platform, Type } from '@mikro-orm/core';
2
2
  /** Wrapper for string values that should be stored as Unicode (nvarchar) in MSSQL. */
3
3
  export declare class UnicodeString {
4
- readonly value: string;
5
- constructor(value: string);
6
- valueOf(): string;
7
- toString(): string;
8
- toJSON(): string;
9
- [Symbol.toPrimitive](): string;
4
+ readonly value: string;
5
+ constructor(value: string);
6
+ valueOf(): string;
7
+ toString(): string;
8
+ toJSON(): string;
9
+ [Symbol.toPrimitive](): string;
10
10
  }
11
11
  /** Custom type for MSSQL nvarchar columns with automatic Unicode string wrapping. */
12
12
  export declare class UnicodeStringType extends Type<string | null, string | null> {
13
- getColumnType(
14
- prop: {
15
- length?: number;
16
- },
17
- platform: Platform,
18
- ): string;
19
- convertToJSValue(value: string | null | UnicodeString): string | null;
20
- convertToDatabaseValue(value: string | null): string | null;
21
- get runtimeType(): string;
22
- toJSON(value: string | null | UnicodeString): string | null;
23
- getDefaultLength(platform: Platform): number;
13
+ getColumnType(prop: {
14
+ length?: number;
15
+ }, platform: Platform): string;
16
+ convertToJSValue(value: string | null | UnicodeString): string | null;
17
+ convertToDatabaseValue(value: string | null): string | null;
18
+ get runtimeType(): string;
19
+ toJSON(value: string | null | UnicodeString): string | null;
20
+ getDefaultLength(platform: Platform): number;
24
21
  }
@@ -1,49 +1,49 @@
1
1
  import { Type } from '@mikro-orm/core';
2
2
  /** Wrapper for string values that should be stored as Unicode (nvarchar) in MSSQL. */
3
3
  export class UnicodeString {
4
- value;
5
- constructor(value) {
6
- this.value = value;
7
- }
8
- valueOf() {
9
- return this.value;
10
- }
11
- toString() {
12
- return this.value;
13
- }
14
- toJSON() {
15
- return this.value;
16
- }
17
- [Symbol.toPrimitive]() {
18
- return this.value;
19
- }
4
+ value;
5
+ constructor(value) {
6
+ this.value = value;
7
+ }
8
+ valueOf() {
9
+ return this.value;
10
+ }
11
+ toString() {
12
+ return this.value;
13
+ }
14
+ toJSON() {
15
+ return this.value;
16
+ }
17
+ [Symbol.toPrimitive]() {
18
+ return this.value;
19
+ }
20
20
  }
21
21
  /** Custom type for MSSQL nvarchar columns with automatic Unicode string wrapping. */
22
22
  export class UnicodeStringType extends Type {
23
- getColumnType(prop, platform) {
24
- const length = prop.length === -1 ? 'max' : (prop.length ?? this.getDefaultLength(platform));
25
- return `nvarchar(${length})`;
26
- }
27
- convertToJSValue(value) {
28
- /* v8 ignore next */
29
- if (value instanceof UnicodeString) {
30
- return value.value;
31
- }
32
- return value;
33
- }
34
- convertToDatabaseValue(value) {
35
- if (typeof value === 'string') {
36
- return new UnicodeString(value);
37
- }
38
- return value;
39
- }
40
- get runtimeType() {
41
- return 'string';
42
- }
43
- toJSON(value) {
44
- return this.convertToJSValue(value);
45
- }
46
- getDefaultLength(platform) {
47
- return platform.getDefaultVarcharLength();
48
- }
23
+ getColumnType(prop, platform) {
24
+ const length = prop.length === -1 ? 'max' : (prop.length ?? this.getDefaultLength(platform));
25
+ return `nvarchar(${length})`;
26
+ }
27
+ convertToJSValue(value) {
28
+ /* v8 ignore next */
29
+ if (value instanceof UnicodeString) {
30
+ return value.value;
31
+ }
32
+ return value;
33
+ }
34
+ convertToDatabaseValue(value) {
35
+ if (typeof value === 'string') {
36
+ return new UnicodeString(value);
37
+ }
38
+ return value;
39
+ }
40
+ get runtimeType() {
41
+ return 'string';
42
+ }
43
+ toJSON(value) {
44
+ return this.convertToJSValue(value);
45
+ }
46
+ getDefaultLength(platform) {
47
+ return platform.getDefaultVarcharLength();
48
+ }
49
49
  }
package/index.d.ts CHANGED
@@ -4,8 +4,4 @@ export * from './MsSqlDriver.js';
4
4
  export * from './MsSqlPlatform.js';
5
5
  export * from './MsSqlSchemaHelper.js';
6
6
  export * from './UnicodeStringType.js';
7
- export {
8
- MsSqlMikroORM as MikroORM,
9
- type MsSqlOptions as Options,
10
- defineMsSqlConfig as defineConfig,
11
- } from './MsSqlMikroORM.js';
7
+ export { MsSqlMikroORM as MikroORM, type MsSqlOptions as Options, defineMsSqlConfig as defineConfig, } from './MsSqlMikroORM.js';
package/index.js CHANGED
@@ -4,4 +4,4 @@ export * from './MsSqlDriver.js';
4
4
  export * from './MsSqlPlatform.js';
5
5
  export * from './MsSqlSchemaHelper.js';
6
6
  export * from './UnicodeStringType.js';
7
- export { MsSqlMikroORM as MikroORM, defineMsSqlConfig as defineConfig } from './MsSqlMikroORM.js';
7
+ export { MsSqlMikroORM as MikroORM, defineMsSqlConfig as defineConfig, } from './MsSqlMikroORM.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/mssql",
3
- "version": "7.0.5",
3
+ "version": "7.0.6-dev.1",
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.5",
50
+ "@mikro-orm/sql": "7.0.6-dev.1",
51
51
  "kysely": "0.28.14",
52
52
  "tarn": "3.0.2",
53
53
  "tedious": "19.2.1",
@@ -57,7 +57,7 @@
57
57
  "@mikro-orm/core": "^7.0.5"
58
58
  },
59
59
  "peerDependencies": {
60
- "@mikro-orm/core": "7.0.5"
60
+ "@mikro-orm/core": "7.0.6-dev.1"
61
61
  },
62
62
  "engines": {
63
63
  "node": ">= 22.17.0"