@mikro-orm/mssql 6.4.17-dev.9 → 6.4.17-dev.91

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,14 +1,7 @@
1
- import { AbstractSqlConnection, type IsolationLevel, type Knex, type TransactionEventBroadcaster } from '@mikro-orm/knex';
1
+ import { AbstractSqlConnection, type Knex } from '@mikro-orm/knex';
2
2
  export declare class MsSqlConnection extends AbstractSqlConnection {
3
3
  createKnex(): void;
4
4
  getDefaultClientUrl(): string;
5
5
  getConnectionOptions(): Knex.MsSqlConnectionConfig;
6
- begin(options?: {
7
- isolationLevel?: IsolationLevel;
8
- ctx?: Knex.Transaction;
9
- eventBroadcaster?: TransactionEventBroadcaster;
10
- }): Promise<Knex.Transaction>;
11
- commit(ctx: Knex.Transaction, eventBroadcaster?: TransactionEventBroadcaster): Promise<void>;
12
- rollback(ctx: Knex.Transaction, eventBroadcaster?: TransactionEventBroadcaster): Promise<void>;
13
6
  protected transformRawResult<T>(res: any, method: 'all' | 'get' | 'run'): T;
14
7
  }
@@ -30,25 +30,6 @@ class MsSqlConnection extends knex_1.AbstractSqlConnection {
30
30
  knex_1.Utils.mergeConfig(config, overrides);
31
31
  return config;
32
32
  }
33
- async begin(options = {}) {
34
- if (!options.ctx) {
35
- if (options.isolationLevel) {
36
- this.logQuery(`set transaction isolation level ${options.isolationLevel}`);
37
- }
38
- this.logQuery('begin');
39
- }
40
- return super.begin(options);
41
- }
42
- async commit(ctx, eventBroadcaster) {
43
- this.logQuery('commit');
44
- return super.commit(ctx, eventBroadcaster);
45
- }
46
- async rollback(ctx, eventBroadcaster) {
47
- if (eventBroadcaster?.isTopLevel()) {
48
- this.logQuery('rollback');
49
- }
50
- return super.rollback(ctx, eventBroadcaster);
51
- }
52
33
  transformRawResult(res, method) {
53
34
  if (method === 'get') {
54
35
  return res[0];
@@ -9,6 +9,8 @@ export declare class MsSqlPlatform extends AbstractSqlPlatform {
9
9
  lookupExtensions(orm: MikroORM): void;
10
10
  /** @inheritDoc */
11
11
  init(orm: MikroORM): void;
12
+ getRollbackToSavepointSQL(savepointName: string): string;
13
+ getSavepointSQL(savepointName: string): string;
12
14
  usesOutputStatement(): boolean;
13
15
  convertDateToJSValue(value: string | Date): string;
14
16
  convertsJsonAutomatically(): boolean;
@@ -50,7 +52,9 @@ export declare class MsSqlPlatform extends AbstractSqlPlatform {
50
52
  normalizePrimaryKey<T extends number | string = number | string>(data: Primary<T> | IPrimaryKey | string): T;
51
53
  supportsMultipleCascadePaths(): boolean;
52
54
  supportsMultipleStatements(): boolean;
53
- quoteIdentifier(id: string): string;
55
+ quoteIdentifier(id: string | {
56
+ toString: () => string;
57
+ }): string;
54
58
  escape(value: any): string;
55
59
  getSchemaGenerator(driver: IDatabaseDriver, em?: EntityManager): MsSqlSchemaGenerator;
56
60
  allowsComparingTuples(): boolean;
package/MsSqlPlatform.js CHANGED
@@ -25,6 +25,12 @@ class MsSqlPlatform extends knex_1.AbstractSqlPlatform {
25
25
  // do not double escape backslash inside strings
26
26
  tsqlstring_1.default.CHARS_GLOBAL_REGEXP = /[']/g;
27
27
  }
28
+ getRollbackToSavepointSQL(savepointName) {
29
+ return `rollback transaction ${this.quoteIdentifier(savepointName)}`;
30
+ }
31
+ getSavepointSQL(savepointName) {
32
+ return `save transaction ${this.quoteIdentifier(savepointName)}`;
33
+ }
28
34
  usesOutputStatement() {
29
35
  return true;
30
36
  }
@@ -165,7 +171,7 @@ class MsSqlPlatform extends knex_1.AbstractSqlPlatform {
165
171
  return true;
166
172
  }
167
173
  quoteIdentifier(id) {
168
- return `[${id.replace('.', `].[`)}]`;
174
+ return `[${id.toString().replace('.', `].[`)}]`;
169
175
  }
170
176
  escape(value) {
171
177
  if (value instanceof UnicodeStringType_1.UnicodeString) {
package/README.md CHANGED
@@ -11,7 +11,6 @@ TypeScript ORM for Node.js based on Data Mapper, [Unit of Work](https://mikro-or
11
11
  [![Chat on discord](https://img.shields.io/discord/1214904142443839538?label=discord&color=blue)](https://discord.gg/w8bjxFHS7X)
12
12
  [![Downloads](https://img.shields.io/npm/dm/@mikro-orm/core.svg)](https://www.npmjs.com/package/@mikro-orm/core)
13
13
  [![Coverage Status](https://img.shields.io/coveralls/mikro-orm/mikro-orm.svg)](https://coveralls.io/r/mikro-orm/mikro-orm?branch=master)
14
- [![Maintainability](https://api.codeclimate.com/v1/badges/27999651d3adc47cfa40/maintainability)](https://codeclimate.com/github/mikro-orm/mikro-orm/maintainability)
15
14
  [![Build Status](https://github.com/mikro-orm/mikro-orm/workflows/tests/badge.svg?branch=master)](https://github.com/mikro-orm/mikro-orm/actions?workflow=tests)
16
15
 
17
16
  ## 🤔 Unit of What?
@@ -141,7 +140,7 @@ There is also auto-generated [CHANGELOG.md](CHANGELOG.md) file based on commit m
141
140
  - [Composite and Foreign Keys as Primary Key](https://mikro-orm.io/docs/composite-keys)
142
141
  - [Filters](https://mikro-orm.io/docs/filters)
143
142
  - [Using `QueryBuilder`](https://mikro-orm.io/docs/query-builder)
144
- - [Preloading Deeply Nested Structures via populate](https://mikro-orm.io/docs/nested-populate)
143
+ - [Populating relations](https://mikro-orm.io/docs/populating-relations)
145
144
  - [Property Validation](https://mikro-orm.io/docs/property-validation)
146
145
  - [Lifecycle Hooks](https://mikro-orm.io/docs/events#hooks)
147
146
  - [Vanilla JS Support](https://mikro-orm.io/docs/usage-with-js)
package/index.mjs CHANGED
@@ -226,12 +226,16 @@ export const compareBuffers = mod.compareBuffers;
226
226
  export const compareObjects = mod.compareObjects;
227
227
  export const createSqlFunction = mod.createSqlFunction;
228
228
  export const defineConfig = mod.defineConfig;
229
+ export const defineEntity = mod.defineEntity;
229
230
  export const equals = mod.equals;
231
+ export const expandDotPaths = mod.expandDotPaths;
232
+ export const getLoadingStrategy = mod.getLoadingStrategy;
230
233
  export const getOnConflictFields = mod.getOnConflictFields;
231
234
  export const getOnConflictReturningFields = mod.getOnConflictReturningFields;
232
235
  export const helper = mod.helper;
233
236
  export const knex = mod.knex;
234
237
  export const parseJsonSafe = mod.parseJsonSafe;
238
+ export const quote = mod.quote;
235
239
  export const raw = mod.raw;
236
240
  export const ref = mod.ref;
237
241
  export const rel = mod.rel;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/mssql",
3
- "version": "6.4.17-dev.9",
3
+ "version": "6.4.17-dev.91",
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
  "main": "index.js",
6
6
  "module": "index.mjs",
@@ -58,7 +58,7 @@
58
58
  "access": "public"
59
59
  },
60
60
  "dependencies": {
61
- "@mikro-orm/knex": "6.4.17-dev.9",
61
+ "@mikro-orm/knex": "6.4.17-dev.91",
62
62
  "tedious": "19.0.0",
63
63
  "tsqlstring": "1.0.1"
64
64
  },
@@ -66,6 +66,6 @@
66
66
  "@mikro-orm/core": "^6.4.16"
67
67
  },
68
68
  "peerDependencies": {
69
- "@mikro-orm/core": "6.4.17-dev.9"
69
+ "@mikro-orm/core": "6.4.17-dev.91"
70
70
  }
71
71
  }