@mikro-orm/mssql 7.2.6-dev.40 → 7.2.6-dev.42
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/MsSqlPlatform.d.ts +2 -1
- package/MsSqlPlatform.js +5 -0
- package/MsSqlSchemaHelper.js +3 -3
- package/package.json +3 -3
package/MsSqlPlatform.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AbstractSqlPlatform, type EntityManager, type EntityMetadata, type IDatabaseDriver, type IPrimaryKey, type MikroORM, MsSqlNativeQueryBuilder, type Primary, QueryOrder, RawQueryFragment, Type } from '@mikro-orm/sql';
|
|
1
|
+
import { AbstractSqlPlatform, type EntityManager, type EntityMetadata, type IDatabaseDriver, type IPrimaryKey, type MikroORM, MsSqlNativeQueryBuilder, type Primary, QueryOrder, RawQueryFragment, type TransformContext, Type } from '@mikro-orm/sql';
|
|
2
2
|
import { MsSqlSchemaHelper } from './MsSqlSchemaHelper.js';
|
|
3
3
|
import { MsSqlExceptionConverter } from './MsSqlExceptionConverter.js';
|
|
4
4
|
import { MsSqlSchemaGenerator } from './MsSqlSchemaGenerator.js';
|
|
@@ -22,6 +22,7 @@ export declare class MsSqlPlatform extends AbstractSqlPlatform {
|
|
|
22
22
|
usesOutputStatement(): boolean;
|
|
23
23
|
convertDateToJSValue(value: string | Date): string;
|
|
24
24
|
convertsJsonAutomatically(): boolean;
|
|
25
|
+
convertJsonToDatabaseValue(value: unknown, context?: TransformContext): unknown;
|
|
25
26
|
indexForeignKeys(): boolean;
|
|
26
27
|
/** SQL Server identifier limit (sysname). */
|
|
27
28
|
getMaxIdentifierLength(): number;
|
package/MsSqlPlatform.js
CHANGED
|
@@ -55,6 +55,11 @@ export class MsSqlPlatform extends AbstractSqlPlatform {
|
|
|
55
55
|
convertsJsonAutomatically() {
|
|
56
56
|
return false;
|
|
57
57
|
}
|
|
58
|
+
convertJsonToDatabaseValue(value, context) {
|
|
59
|
+
const json = super.convertJsonToDatabaseValue(value, context);
|
|
60
|
+
// JSON is stored in `nvarchar(max)`, so write it as a Unicode literal, otherwise non-Latin characters are lost
|
|
61
|
+
return context?.mode === 'hydration' || context?.mode === 'discovery' ? json : new UnicodeString(json);
|
|
62
|
+
}
|
|
58
63
|
indexForeignKeys() {
|
|
59
64
|
return false;
|
|
60
65
|
}
|
package/MsSqlSchemaHelper.js
CHANGED
|
@@ -85,15 +85,15 @@ export class MsSqlSchemaHelper extends SchemaHelper {
|
|
|
85
85
|
return res.map(row => row.schema_name);
|
|
86
86
|
}
|
|
87
87
|
normalizeDefaultValue(defaultValue, length, defaultValues = {}, stripQuotes = false) {
|
|
88
|
-
let match = /^\((.*)\)
|
|
88
|
+
let match = /^\((.*)\)$/s.exec(defaultValue);
|
|
89
89
|
if (match) {
|
|
90
90
|
defaultValue = match[1];
|
|
91
91
|
}
|
|
92
|
-
match = /^\((.*)\)
|
|
92
|
+
match = /^\((.*)\)$/s.exec(defaultValue);
|
|
93
93
|
if (match) {
|
|
94
94
|
defaultValue = match[1];
|
|
95
95
|
}
|
|
96
|
-
match = /^'(.*)'
|
|
96
|
+
match = /^'(.*)'$/s.exec(defaultValue);
|
|
97
97
|
if (stripQuotes && match) {
|
|
98
98
|
defaultValue = match[1].replaceAll("''", "'");
|
|
99
99
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/mssql",
|
|
3
|
-
"version": "7.2.6-dev.
|
|
3
|
+
"version": "7.2.6-dev.42",
|
|
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.2.6-dev.
|
|
50
|
+
"@mikro-orm/sql": "7.2.6-dev.42",
|
|
51
51
|
"kysely": "0.29.7",
|
|
52
52
|
"tarn": "3.1.2",
|
|
53
53
|
"tedious": "20.3.8",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@mikro-orm/core": "^7.2.5"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"@mikro-orm/core": "7.2.6-dev.
|
|
60
|
+
"@mikro-orm/core": "7.2.6-dev.42"
|
|
61
61
|
},
|
|
62
62
|
"engines": {
|
|
63
63
|
"node": ">= 22.17.0"
|