@mikro-orm/core
Advanced tools
Comparing version 6.4.5-dev.8 to 6.4.5-dev.9
@@ -7,3 +7,3 @@ import { inspect } from 'node:util'; | ||
import type { CountOptions, DeleteOptions, FindAllOptions, FindByCursorOptions, FindOneOptions, FindOneOrFailOptions, FindOptions, GetReferenceOptions, IDatabaseDriver, LockOptions, NativeInsertUpdateOptions, UpdateOptions, UpsertManyOptions, UpsertOptions } from './drivers'; | ||
import type { AnyEntity, AnyString, ArrayElement, AutoPath, ConnectionType, Dictionary, EntityData, EntityDictionary, EntityDTO, EntityMetadata, EntityName, FilterQuery, FromEntityType, GetRepository, IHydrator, IsSubset, Loaded, MaybePromise, MergeLoaded, MergeSelected, ObjectQuery, Primary, Ref, RequiredEntityData, UnboxArray, NoInfer } from './typings'; | ||
import type { AnyEntity, AnyString, ArrayElement, AutoPath, ConnectionType, Dictionary, EntityData, EntityDictionary, EntityDTO, EntityMetadata, EntityName, FilterQuery, FromEntityType, GetRepository, IHydrator, IsSubset, Loaded, MaybePromise, MergeLoaded, MergeSelected, NoInfer, ObjectQuery, Primary, Ref, RequiredEntityData, UnboxArray } from './typings'; | ||
import { FlushMode, LockMode, PopulatePath, type TransactionOptions } from './enums'; | ||
@@ -10,0 +10,0 @@ import type { MetadataStorage } from './metadata'; |
{ | ||
"name": "@mikro-orm/core", | ||
"version": "6.4.5-dev.8", | ||
"version": "6.4.5-dev.9", | ||
"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.", | ||
@@ -67,5 +67,5 @@ "main": "index.js", | ||
"globby": "11.1.0", | ||
"mikro-orm": "6.4.5-dev.8", | ||
"mikro-orm": "6.4.5-dev.9", | ||
"reflect-metadata": "0.2.2" | ||
} | ||
} |
@@ -16,2 +16,3 @@ import { inspect } from 'node:util'; | ||
clone(): RawQueryFragment; | ||
static run<T>(cb: (...args: any[]) => Promise<T>): Promise<T>; | ||
/** | ||
@@ -18,0 +19,0 @@ * @internal allows testing we don't leak memory, as the raw fragments cache needs to be cleared automatically |
@@ -7,2 +7,3 @@ "use strict"; | ||
exports.createSqlFunction = createSqlFunction; | ||
const node_async_hooks_1 = require("node:async_hooks"); | ||
const node_util_1 = require("node:util"); | ||
@@ -14,2 +15,3 @@ const Utils_1 = require("./Utils"); | ||
static #rawQueryCache = new Map(); | ||
static #storage = new node_async_hooks_1.AsyncLocalStorage(); | ||
static #index = 0n; | ||
@@ -50,2 +52,9 @@ static cloneRegistry; | ||
} | ||
static async run(cb) { | ||
const removeStack = new Set(); | ||
const res = await this.#storage.run(removeStack, cb); | ||
removeStack.forEach(key => RawQueryFragment.remove(key)); | ||
removeStack.clear(); | ||
return res; | ||
} | ||
/** | ||
@@ -80,3 +89,9 @@ * @internal allows testing we don't leak memory, as the raw fragments cache needs to be cleared automatically | ||
if (raw.#used <= 0) { | ||
this.#rawQueryCache.delete(key); | ||
const removeStack = this.#storage.getStore(); | ||
if (removeStack) { | ||
removeStack.add(key); | ||
} | ||
else { | ||
this.#rawQueryCache.delete(key); | ||
} | ||
} | ||
@@ -83,0 +98,0 @@ } |
Sorry, the diff of this file is too big to display
1097715
24312
+ Addedmikro-orm@6.4.5-dev.9(transitive)
- Removedmikro-orm@6.4.5-dev.8(transitive)
Updatedmikro-orm@6.4.5-dev.9