@mikro-orm/sql
Advanced tools
+2
-2
| { | ||
| "name": "@mikro-orm/sql", | ||
| "version": "7.1.0-dev.34", | ||
| "version": "7.1.0-dev.35", | ||
| "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.", | ||
@@ -56,3 +56,3 @@ "keywords": [ | ||
| "peerDependencies": { | ||
| "@mikro-orm/core": "7.1.0-dev.34" | ||
| "@mikro-orm/core": "7.1.0-dev.35" | ||
| }, | ||
@@ -59,0 +59,0 @@ "engines": { |
@@ -34,3 +34,24 @@ import { type AbortQueryOptions, type EntitySchemaWithMeta, EntityManager, type AnyEntity, type ConnectionType, type CountByOptions, type Dictionary, type EntityData, type EntityKey, type EntityName, type EntityRepository, type FilterQuery, type GetRepository, type LoggingOptions, type QueryResult, type RawQueryFragment } from '@mikro-orm/core'; | ||
| /** | ||
| * Returns configured Kysely instance. | ||
| * Returns a configured Kysely instance bound to this EntityManager. | ||
| * | ||
| * When the EntityManager is inside a transaction (e.g. within `em.transactional(...)`, or after | ||
| * `em.begin()`), the returned Kysely instance automatically uses the transaction context, so any | ||
| * queries executed via Kysely's own `.execute()` / `.executeTakeFirst*()` participate in the | ||
| * current transaction. | ||
| * | ||
| * If you need a Kysely instance that is **not** bound to the current transaction (e.g. to perform | ||
| * a side query against the pool while inside a transactional block), fork the EntityManager first: | ||
| * | ||
| * ```ts | ||
| * await em.transactional(async em => { | ||
| * // bound to the current transaction | ||
| * await em.getKysely().selectFrom('user').selectAll().execute(); | ||
| * | ||
| * // bound to the pool, runs outside the transaction | ||
| * await em.fork().getKysely().selectFrom('audit_log').selectAll().execute(); | ||
| * }); | ||
| * ``` | ||
| * | ||
| * The `options.type` (`'read'` / `'write'`) is only honored outside a transaction — inside a | ||
| * transaction the connection is already pinned. | ||
| */ | ||
@@ -37,0 +58,0 @@ getKysely<TDB = undefined, TOptions extends GetKyselyOptions = GetKyselyOptions>(options?: TOptions): Kysely<TDB extends undefined ? InferKyselyDB<EntitiesFromManager<this>, TOptions> & InferClassEntityDB<AllEntitiesFromManager<this>, TOptions> : TDB>; |
+25
-2
@@ -23,6 +23,29 @@ import { EntityManager, raw, Utils, } from '@mikro-orm/core'; | ||
| /** | ||
| * Returns configured Kysely instance. | ||
| * Returns a configured Kysely instance bound to this EntityManager. | ||
| * | ||
| * When the EntityManager is inside a transaction (e.g. within `em.transactional(...)`, or after | ||
| * `em.begin()`), the returned Kysely instance automatically uses the transaction context, so any | ||
| * queries executed via Kysely's own `.execute()` / `.executeTakeFirst*()` participate in the | ||
| * current transaction. | ||
| * | ||
| * If you need a Kysely instance that is **not** bound to the current transaction (e.g. to perform | ||
| * a side query against the pool while inside a transactional block), fork the EntityManager first: | ||
| * | ||
| * ```ts | ||
| * await em.transactional(async em => { | ||
| * // bound to the current transaction | ||
| * await em.getKysely().selectFrom('user').selectAll().execute(); | ||
| * | ||
| * // bound to the pool, runs outside the transaction | ||
| * await em.fork().getKysely().selectFrom('audit_log').selectAll().execute(); | ||
| * }); | ||
| * ``` | ||
| * | ||
| * The `options.type` (`'read'` / `'write'`) is only honored outside a transaction — inside a | ||
| * transaction the connection is already pinned. | ||
| */ | ||
| getKysely(options = {}) { | ||
| let kysely = this.getConnection(options.type).getClient(); | ||
| const context = this.getContext(false); | ||
| const ctx = context.getTransactionContext(); | ||
| let kysely = ctx ?? this.getConnection(options.type).getClient(); | ||
| if (options.columnNamingStrategy != null || | ||
@@ -29,0 +52,0 @@ options.tableNamingStrategy != null || |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
998257
0.23%21012
0.21%143
0.7%