@mikro-orm/core 7.0.0-dev.289 → 7.0.0-dev.290

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.
@@ -29,7 +29,27 @@ export class MetadataProvider {
29
29
  delete prop.items;
30
30
  }
31
31
  });
32
+ // Preserve function expressions from indexes/uniques — they can't survive JSON cache serialization
33
+ const expressionMap = new Map();
34
+ for (const arr of [meta.indexes, meta.uniques]) {
35
+ for (const idx of arr ?? []) {
36
+ if (typeof idx.expression === 'function' && idx.name) {
37
+ expressionMap.set(idx.name, idx.expression);
38
+ }
39
+ }
40
+ }
32
41
  Utils.mergeConfig(meta, cache);
42
+ // Restore function expressions that were lost during JSON serialization
43
+ if (expressionMap.size > 0) {
44
+ for (const arr of [meta.indexes, meta.uniques]) {
45
+ for (const idx of arr ?? []) {
46
+ const fn = idx.name && expressionMap.get(idx.name);
47
+ if (fn && typeof idx.expression !== 'function') {
48
+ idx.expression = fn;
49
+ }
50
+ }
51
+ }
52
+ }
33
53
  }
34
54
  static useCache() {
35
55
  return false;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
3
  "type": "module",
4
- "version": "7.0.0-dev.289",
4
+ "version": "7.0.0-dev.290",
5
5
  "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.",
6
6
  "exports": {
7
7
  "./package.json": "./package.json",
package/utils/Utils.js CHANGED
@@ -123,7 +123,7 @@ export function parseJsonSafe(value) {
123
123
  }
124
124
  export class Utils {
125
125
  static PK_SEPARATOR = '~~~';
126
- static #ORM_VERSION = '7.0.0-dev.289';
126
+ static #ORM_VERSION = '7.0.0-dev.290';
127
127
  /**
128
128
  * Checks if the argument is instance of `Object`. Returns false for arrays.
129
129
  */