@mikro-orm/core 7.0.0-dev.83 → 7.0.0-dev.84

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,4 +1,3 @@
1
- import { inspect } from 'node:util';
2
1
  import { type Configuration } from './utils/Configuration.js';
3
2
  import { Cursor } from './utils/Cursor.js';
4
3
  import { EntityFactory } from './entity/EntityFactory.js';
@@ -553,8 +552,6 @@ export declare class EntityManager<Driver extends IDatabaseDriver = IDatabaseDri
553
552
  * if executed inside request context handler.
554
553
  */
555
554
  get id(): number;
556
- /** @ignore */
557
- [inspect.custom](): string;
558
555
  }
559
556
  export interface CreateOptions<Convert extends boolean> {
560
557
  /** creates a managed entity instance instead, bypassing the constructor call */
package/EntityManager.js CHANGED
@@ -1,4 +1,3 @@
1
- import { inspect } from 'node:util';
2
1
  import { getOnConflictReturningFields, getWhereCondition } from './utils/upsert-utils.js';
3
2
  import { Utils } from './utils/Utils.js';
4
3
  import { Cursor } from './utils/Cursor.js';
@@ -1840,7 +1839,7 @@ export class EntityManager {
1840
1839
  return this.getContext(false)._id;
1841
1840
  }
1842
1841
  /** @ignore */
1843
- [inspect.custom]() {
1842
+ [Symbol.for('nodejs.util.inspect.custom')]() {
1844
1843
  return `[EntityManager<${this.id}>]`;
1845
1844
  }
1846
1845
  }
@@ -1,4 +1,3 @@
1
- import { inspect } from 'node:util';
2
1
  import type { EntityDTO, EntityKey, EntityProperty, FilterQuery, IPrimaryKey, Loaded, LoadedCollection, Populate, Primary } from '../typings.js';
3
2
  import { Reference } from './Reference.js';
4
3
  import type { Transaction } from '../connections/Connection.js';
@@ -158,8 +157,6 @@ export declare class Collection<T extends object, O extends object = object> {
158
157
  protected propagateToOwningSide(item: T, method: 'add' | 'remove' | 'takeSnapshot'): void;
159
158
  protected shouldPropagateToCollection(collection: Collection<O, T>, method: 'add' | 'remove' | 'takeSnapshot'): boolean;
160
159
  protected incrementCount(value: number): void;
161
- /** @ignore */
162
- [inspect.custom](depth?: number): string;
163
160
  }
164
161
  export interface InitCollectionOptions<T, P extends string = never, F extends string = '*', E extends string = never> extends EntityLoaderOptions<T, F, E> {
165
162
  dataloader?: boolean;
@@ -1,10 +1,10 @@
1
- import { inspect } from 'node:util';
2
1
  import { Utils } from '../utils/Utils.js';
3
2
  import { MetadataError, ValidationError } from '../errors.js';
4
3
  import { DataloaderType, ReferenceKind } from '../enums.js';
5
4
  import { Reference } from './Reference.js';
6
5
  import { helper, wrap } from './wrap.js';
7
6
  import { QueryHelper } from '../utils/QueryHelper.js';
7
+ import { inspect } from '../logging/inspect.js';
8
8
  export class Collection {
9
9
  owner;
10
10
  items = new Set();
@@ -695,7 +695,7 @@ export class Collection {
695
695
  }
696
696
  }
697
697
  /** @ignore */
698
- [inspect.custom](depth = 2) {
698
+ [Symbol.for('nodejs.util.inspect.custom')](depth = 2) {
699
699
  const object = { ...this };
700
700
  const hidden = ['items', 'owner', '_property', '_count', 'snapshot', '_populated', '_lazyInitialized', '_em', 'readonly', 'partial'];
701
701
  hidden.forEach(k => delete object[k]);
@@ -1,4 +1,3 @@
1
- import { inspect } from 'node:util';
2
1
  import { Collection } from './Collection.js';
3
2
  import { Utils } from '../utils/Utils.js';
4
3
  import { Reference } from './Reference.js';
@@ -6,6 +5,7 @@ import { ReferenceKind, SCALAR_TYPES } from '../enums.js';
6
5
  import { validateProperty } from './validators.js';
7
6
  import { helper, wrap } from './wrap.js';
8
7
  import { EntityHelper } from './EntityHelper.js';
8
+ import { ValidationError } from '../errors.js';
9
9
  export class EntityAssigner {
10
10
  static assign(entity, data, options = {}) {
11
11
  let opts = options;
@@ -181,7 +181,7 @@ export class EntityAssigner {
181
181
  });
182
182
  if (invalid.length > 0) {
183
183
  const name = entity.constructor.name;
184
- throw new Error(`Invalid collection values provided for '${name}.${prop.name}' in ${name}.assign(): ${inspect(invalid)}`);
184
+ throw ValidationError.invalidCollectionValues(name, prop.name, invalid);
185
185
  }
186
186
  if (Array.isArray(value)) {
187
187
  collection.set(items);
@@ -1,4 +1,3 @@
1
- import { inspect } from 'node:util';
2
1
  import { EagerProps, EntityRepositoryType, HiddenProps, OptionalProps, PrimaryKeyProp, } from '../typings.js';
3
2
  import { EntityTransformer } from '../serialization/EntityTransformer.js';
4
3
  import { Reference } from './Reference.js';
@@ -6,6 +5,7 @@ import { Utils } from '../utils/Utils.js';
6
5
  import { WrappedEntity } from './WrappedEntity.js';
7
6
  import { ReferenceKind } from '../enums.js';
8
7
  import { helper } from './wrap.js';
8
+ import { inspect } from '../logging/inspect.js';
9
9
  /**
10
10
  * @internal
11
11
  */
@@ -110,7 +110,7 @@ export class EntityHelper {
110
110
  }
111
111
  static defineCustomInspect(meta) {
112
112
  // @ts-ignore
113
- meta.prototype[inspect.custom] ??= function (depth = 2) {
113
+ meta.prototype[Symbol.for('nodejs.util.inspect.custom')] ??= function (depth = 2) {
114
114
  const object = {};
115
115
  const keys = new Set(Utils.keys(this));
116
116
  for (const prop of meta.props) {
@@ -129,7 +129,7 @@ export class EntityHelper {
129
129
  .filter(prop => object[prop.name] === undefined)
130
130
  .forEach(prop => delete object[prop.name]);
131
131
  const ret = inspect(object, { depth });
132
- let name = (this).constructor.name;
132
+ let name = this.constructor.name;
133
133
  const showEM = ['true', 't', '1'].includes(process.env.MIKRO_ORM_LOG_EM_ID?.toString().toLowerCase() ?? '');
134
134
  if (showEM) {
135
135
  if (helper(this).__em) {
@@ -1,4 +1,3 @@
1
- import { inspect } from 'node:util';
2
1
  import type { AddEager, AddOptional, Dictionary, EntityClass, EntityKey, EntityProperty, Loaded, LoadedReference, Primary, Ref } from '../typings.js';
3
2
  import type { FindOneOptions, FindOneOrFailOptions } from '../drivers/IDatabaseDriver.js';
4
3
  export declare class Reference<T extends object> {
@@ -43,8 +42,6 @@ export declare class Reference<T extends object> {
43
42
  isInitialized(): boolean;
44
43
  populated(populated?: boolean): void;
45
44
  toJSON(...args: any[]): Dictionary;
46
- /** @ignore */
47
- [inspect.custom](depth?: number): string;
48
45
  }
49
46
  export declare class ScalarReference<Value> {
50
47
  private value?;
@@ -66,8 +63,6 @@ export declare class ScalarReference<Value> {
66
63
  bind<Entity extends object>(entity: Entity, property: EntityKey<Entity>): void;
67
64
  unwrap(): Value | undefined;
68
65
  isInitialized(): boolean;
69
- /** @ignore */
70
- [inspect.custom](): string;
71
66
  }
72
67
  export interface LoadReferenceOptions<T extends object, P extends string = never, F extends string = '*', E extends string = never> extends FindOneOptions<T, P, F, E> {
73
68
  dataloader?: boolean;
@@ -1,9 +1,9 @@
1
- import { inspect } from 'node:util';
2
1
  import { DataloaderType } from '../enums.js';
3
2
  import { helper, wrap } from './wrap.js';
4
3
  import { Utils } from '../utils/Utils.js';
5
4
  import { QueryHelper } from '../utils/QueryHelper.js';
6
5
  import { NotFoundError } from '../errors.js';
6
+ import { inspect } from '../logging/inspect.js';
7
7
  export class Reference {
8
8
  entity;
9
9
  property;
@@ -146,7 +146,7 @@ export class Reference {
146
146
  return wrap(this.entity).toJSON(...args);
147
147
  }
148
148
  /** @ignore */
149
- [inspect.custom](depth = 2) {
149
+ [Symbol.for('nodejs.util.inspect.custom')](depth = 2) {
150
150
  const object = { ...this };
151
151
  const hidden = ['meta', 'property'];
152
152
  hidden.forEach(k => delete object[k]);
@@ -192,9 +192,7 @@ export class ScalarReference {
192
192
  const wrapped = helper(this.entity);
193
193
  options.failHandler ??= wrapped.__em.config.get('findOneOrFailHandler');
194
194
  const entityName = this.entity.constructor.name;
195
- const where = wrapped.getPrimaryKey();
196
- const whereString = typeof where === 'object' ? inspect(where) : where;
197
- throw new NotFoundError(`${entityName} (${whereString}) failed to load property '${this.property}'`);
195
+ throw NotFoundError.failedToLoadProperty(entityName, this.property, wrapped.getPrimaryKey());
198
196
  }
199
197
  return ret;
200
198
  }
@@ -215,7 +213,7 @@ export class ScalarReference {
215
213
  }
216
214
  /** @ignore */
217
215
  /* v8 ignore next */
218
- [inspect.custom]() {
216
+ [Symbol.for('nodejs.util.inspect.custom')]() {
219
217
  return this.initialized ? `Ref<${inspect(this.value)}>` : `Ref<?>`;
220
218
  }
221
219
  }
@@ -1,5 +1,4 @@
1
1
  import type { PopulatePath } from '../enums.js';
2
- import { inspect } from 'node:util';
3
2
  import type { EntityManager } from '../EntityManager.js';
4
3
  import type { Dictionary, EntityData, EntityDictionary, EntityMetadata, IHydrator, EntityKey, PopulateOptions, Primary, AutoPath, Ref, AddEager, LoadedReference, EntityDTO, Loaded, FromEntityType, IsSubset, MergeSelected } from '../typings.js';
5
4
  import { Reference } from './Reference.js';
@@ -62,6 +61,4 @@ export declare class WrappedEntity<Entity extends object> {
62
61
  get __platform(): import("@mikro-orm/knex").Platform;
63
62
  get __config(): import("@mikro-orm/knex").Configuration<import("../drivers/IDatabaseDriver.js").IDatabaseDriver<import("@mikro-orm/knex").Connection>, EntityManager<import("../drivers/IDatabaseDriver.js").IDatabaseDriver<import("@mikro-orm/knex").Connection>>>;
64
63
  get __primaryKeys(): Primary<Entity>[];
65
- /** @ignore */
66
- [inspect.custom](): string;
67
64
  }
@@ -1,4 +1,3 @@
1
- import { inspect } from 'node:util';
2
1
  import { Reference } from './Reference.js';
3
2
  import { EntityTransformer } from '../serialization/EntityTransformer.js';
4
3
  import { EntityAssigner } from './EntityAssigner.js';
@@ -149,7 +148,7 @@ export class WrappedEntity {
149
148
  return Utils.getPrimaryKeyValues(this.entity, this.__meta);
150
149
  }
151
150
  /** @ignore */
152
- [inspect.custom]() {
151
+ [Symbol.for('nodejs.util.inspect.custom')]() {
153
152
  return `[WrappedEntity<${this.__meta.className}>]`;
154
153
  }
155
154
  }
package/errors.d.ts CHANGED
@@ -14,6 +14,8 @@ export declare class ValidationError<T extends AnyEntity = AnyEntity> extends Er
14
14
  static notEntity(owner: AnyEntity, prop: EntityProperty, data: any): ValidationError;
15
15
  static notDiscoveredEntity(data: any, meta?: EntityMetadata, action?: string): ValidationError;
16
16
  static invalidPropertyName(entityName: string, invalid: string): ValidationError;
17
+ static invalidCollectionValues(entityName: string, propName: string, invalid: unknown): ValidationError;
18
+ static invalidEnumArrayItems(entityName: string, invalid: unknown): ValidationError;
17
19
  static invalidType(type: Constructor<any>, value: any, mode: string): ValidationError;
18
20
  static propertyRequired(entity: AnyEntity, property: EntityProperty): ValidationError;
19
21
  static cannotModifyInverseCollection(owner: AnyEntity, property: EntityProperty): ValidationError;
@@ -25,6 +27,7 @@ export declare class ValidationError<T extends AnyEntity = AnyEntity> extends Er
25
27
  static cannotUseOperatorsInsideEmbeddables(className: string, propName: string, payload: unknown): ValidationError;
26
28
  static cannotUseGroupOperatorsInsideScalars(className: string, propName: string, payload: unknown): ValidationError;
27
29
  static invalidEmbeddableQuery(className: string, propName: string, embeddableType: string): ValidationError;
30
+ static invalidQueryCondition(cond: unknown): ValidationError;
28
31
  }
29
32
  export declare class CursorError<T extends AnyEntity = AnyEntity> extends ValidationError<T> {
30
33
  static entityNotPopulated(entity: AnyEntity, prop: string): ValidationError;
@@ -64,6 +67,7 @@ export declare class MetadataError<T extends AnyEntity = AnyEntity> extends Vali
64
67
  export declare class NotFoundError<T extends AnyEntity = AnyEntity> extends ValidationError<T> {
65
68
  static findOneFailed(name: string, where: Dictionary | IPrimaryKey): NotFoundError;
66
69
  static findExactlyOneFailed(name: string, where: Dictionary | IPrimaryKey): NotFoundError;
70
+ static failedToLoadProperty(name: string, propName: string, where: unknown): NotFoundError;
67
71
  }
68
72
  export declare class TransactionStateError extends ValidationError {
69
73
  static requiredTransactionNotFound(propagation: string): TransactionStateError;
package/errors.js CHANGED
@@ -1,4 +1,4 @@
1
- import { inspect } from 'node:util';
1
+ import { inspect } from './logging/inspect.js';
2
2
  export class ValidationError extends Error {
3
3
  entity;
4
4
  constructor(message, entity) {
@@ -48,6 +48,12 @@ export class ValidationError extends Error {
48
48
  static invalidPropertyName(entityName, invalid) {
49
49
  return new ValidationError(`Entity '${entityName}' does not have property '${invalid}'`);
50
50
  }
51
+ static invalidCollectionValues(entityName, propName, invalid) {
52
+ return new ValidationError(`Invalid collection values provided for '${entityName}.${propName}' in ${entityName}.assign(): ${inspect(invalid)}`);
53
+ }
54
+ static invalidEnumArrayItems(entityName, invalid) {
55
+ return new ValidationError(`Invalid enum array items provided in ${entityName}: ${inspect(invalid)}`);
56
+ }
51
57
  static invalidType(type, value, mode) {
52
58
  const valueType = Object.prototype.toString.call(value).match(/\[object (\w+)]/)[1].toLowerCase();
53
59
  if (value instanceof Date) {
@@ -95,6 +101,10 @@ export class ValidationError extends Error {
95
101
  static invalidEmbeddableQuery(className, propName, embeddableType) {
96
102
  return new ValidationError(`Invalid query for entity '${className}', property '${propName}' does not exist in embeddable '${embeddableType}'`);
97
103
  }
104
+ /* v8 ignore next */
105
+ static invalidQueryCondition(cond) {
106
+ return new ValidationError(`Invalid query condition: ${inspect(cond, { depth: 5 })}`);
107
+ }
98
108
  }
99
109
  export class CursorError extends ValidationError {
100
110
  static entityNotPopulated(entity, prop) {
@@ -213,6 +223,10 @@ export class NotFoundError extends ValidationError {
213
223
  static findExactlyOneFailed(name, where) {
214
224
  return new NotFoundError(`Wrong number of ${name} entities found for query ${inspect(where)}, expected exactly one`);
215
225
  }
226
+ static failedToLoadProperty(name, propName, where) {
227
+ const whereString = typeof where === 'object' ? inspect(where) : where;
228
+ return new NotFoundError(`${name} (${whereString}) failed to load property '${propName}'`);
229
+ }
216
230
  }
217
231
  export class TransactionStateError extends ValidationError {
218
232
  static requiredTransactionNotFound(propagation) {
@@ -60,6 +60,7 @@ export class DefaultLogger {
60
60
  if (namespace === 'deprecated') {
61
61
  const { ignoreDeprecations = false } = this.options;
62
62
  return Array.isArray(ignoreDeprecations)
63
+ /* v8 ignore next */
63
64
  ? !ignoreDeprecations.includes(context?.label ?? '')
64
65
  : !ignoreDeprecations;
65
66
  }
@@ -2,3 +2,4 @@ export * from './colors.js';
2
2
  export * from './Logger.js';
3
3
  export * from './DefaultLogger.js';
4
4
  export * from './SimpleLogger.js';
5
+ export * from './inspect.js';
package/logging/index.js CHANGED
@@ -2,3 +2,4 @@ export * from './colors.js';
2
2
  export * from './Logger.js';
3
3
  export * from './DefaultLogger.js';
4
4
  export * from './SimpleLogger.js';
5
+ export * from './inspect.js';
@@ -0,0 +1,2 @@
1
+ /** @internal */
2
+ export declare function inspect(value: unknown, options?: Record<string, any>): string;
@@ -0,0 +1,16 @@
1
+ let nodeInspect;
2
+ /** @internal */
3
+ export function inspect(value, options) {
4
+ if (nodeInspect === undefined) {
5
+ /* v8 ignore else */
6
+ if (globalThis.process?.getBuiltinModule) {
7
+ nodeInspect = globalThis.process.getBuiltinModule('node:util').inspect;
8
+ }
9
+ }
10
+ /* v8 ignore else */
11
+ if (nodeInspect) {
12
+ return nodeInspect(value, options);
13
+ }
14
+ /* v8 ignore next */
15
+ return JSON.stringify(value, null, 2);
16
+ }
@@ -6,13 +6,13 @@ export class MetadataProvider {
6
6
  }
7
7
  loadEntityMetadata(meta) {
8
8
  for (const prop of meta.props) {
9
+ /* v8 ignore next */
9
10
  if (typeof prop.entity === 'string') {
10
11
  prop.type = prop.entity;
11
12
  }
12
13
  else if (prop.entity) {
13
14
  const tmp = prop.entity();
14
15
  prop.type = Array.isArray(tmp) ? tmp.map(t => Utils.className(t)).sort().join(' | ') : Utils.className(tmp);
15
- /* v8 ignore next */
16
16
  }
17
17
  else if (!prop.type && !(prop.enum && (prop.items?.length ?? 0) > 0)) {
18
18
  throw new Error(`Please provide either 'type' or 'entity' attribute in ${meta.className}.${prop.name}.`);
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.83",
4
+ "version": "7.0.0-dev.84",
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",
@@ -1,4 +1,3 @@
1
- import { inspect } from 'node:util';
2
1
  import { EntityRepository } from '../entity/EntityRepository.js';
3
2
  import { type NamingStrategy } from '../naming-strategy/NamingStrategy.js';
4
3
  import type { Constructor, EntityMetadata, EntityProperty, IPrimaryKey, ISchemaGenerator, PopulateOptions, Primary, SimpleColumnMeta } from '../typings.js';
@@ -221,6 +220,4 @@ export declare abstract class Platform {
221
220
  * @internal
222
221
  */
223
222
  clone(): this;
224
- /** @ignore */
225
- [inspect.custom](): string;
226
223
  }
@@ -1,4 +1,3 @@
1
- import { inspect } from 'node:util';
2
1
  import { clone } from '../utils/clone.js';
3
2
  import { EntityRepository } from '../entity/EntityRepository.js';
4
3
  import { UnderscoreNamingStrategy } from '../naming-strategy/UnderscoreNamingStrategy.js';
@@ -499,7 +498,7 @@ export class Platform {
499
498
  }
500
499
  /** @ignore */
501
500
  /* v8 ignore next */
502
- [inspect.custom]() {
501
+ [Symbol.for('nodejs.util.inspect.custom')]() {
503
502
  return `[${this.constructor.name}]`;
504
503
  }
505
504
  }
@@ -1,4 +1,3 @@
1
- import { inspect } from 'node:util';
2
1
  import { ArrayType } from './ArrayType.js';
3
2
  import { ValidationError } from '../errors.js';
4
3
  function mapHydrator(items, hydrate) {
@@ -19,7 +18,7 @@ export class EnumArrayType extends ArrayType {
19
18
  if (Array.isArray(value) && Array.isArray(this.items)) {
20
19
  const invalid = value.filter(v => !this.items.includes(v));
21
20
  if (invalid.length > 0) {
22
- throw new ValidationError(`Invalid enum array items provided in ${this.owner}: ${inspect(invalid)}`);
21
+ throw ValidationError.invalidEnumArrayItems(this.owner, invalid);
23
22
  }
24
23
  }
25
24
  return super.convertToDatabaseValue(value, platform, context);
package/types/Type.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { inspect } from 'node:util';
2
1
  import type { Platform } from '../platforms/Platform.js';
3
2
  import type { Constructor, EntityMetadata, EntityProperty } from '../typings.js';
4
3
  export interface TransformContext {
@@ -79,6 +78,4 @@ export declare abstract class Type<JSType = string, DBType = JSType> {
79
78
  * Checks whether the argument is instance of `Type`.
80
79
  */
81
80
  static isMappedType(data: any): data is Type<any>;
82
- /** @ignore */
83
- [inspect.custom](depth?: number): string;
84
81
  }
package/types/Type.js CHANGED
@@ -1,4 +1,4 @@
1
- import { inspect } from 'node:util';
1
+ import { inspect } from '../logging/inspect.js';
2
2
  export class Type {
3
3
  static types = new Map();
4
4
  platform;
@@ -65,7 +65,7 @@ export class Type {
65
65
  return !!data?.__mappedType;
66
66
  }
67
67
  /** @ignore */
68
- [inspect.custom](depth = 2) {
68
+ [Symbol.for('nodejs.util.inspect.custom')](depth = 2) {
69
69
  const object = { ...this };
70
70
  const hidden = ['prop', 'platform', 'meta'];
71
71
  hidden.forEach(k => delete object[k]);
@@ -1,4 +1,3 @@
1
- import { inspect } from 'node:util';
2
1
  import type { EntityData, EntityMetadata, EntityDictionary, Primary } from '../typings.js';
3
2
  export declare class ChangeSet<T extends object> {
4
3
  entity: T;
@@ -10,8 +9,6 @@ export declare class ChangeSet<T extends object> {
10
9
  constructor(entity: T, type: ChangeSetType, payload: EntityDictionary<T>, meta: EntityMetadata<T>);
11
10
  getPrimaryKey(object?: boolean): Primary<T> | null;
12
11
  getSerializedPrimaryKey(): string | null;
13
- /** @ignore */
14
- [inspect.custom](depth?: number): string;
15
12
  }
16
13
  export interface ChangeSet<T> {
17
14
  name: string;
@@ -1,6 +1,6 @@
1
- import { inspect } from 'node:util';
2
1
  import { helper } from '../entity/wrap.js';
3
2
  import { Utils } from '../utils/Utils.js';
3
+ import { inspect } from '../logging/inspect.js';
4
4
  export class ChangeSet {
5
5
  entity;
6
6
  type;
@@ -46,7 +46,7 @@ export class ChangeSet {
46
46
  return this.serializedPrimaryKey;
47
47
  }
48
48
  /** @ignore */
49
- [inspect.custom](depth = 2) {
49
+ [Symbol.for('nodejs.util.inspect.custom')](depth = 2) {
50
50
  const object = { ...this };
51
51
  const hidden = ['meta', 'serializedPrimaryKey'];
52
52
  hidden.forEach(k => delete object[k]);
package/utils/Cursor.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { inspect } from 'node:util';
2
1
  import type { EntityMetadata, FilterObject, Loaded } from '../typings.js';
3
2
  import type { FindByCursorOptions, OrderDefinition } from '../drivers/IDatabaseDriver.js';
4
3
  import { type QueryOrder } from '../enums.js';
@@ -71,6 +70,4 @@ export declare class Cursor<Entity extends object, Hint extends string = never,
71
70
  static encode(value: unknown[]): string;
72
71
  static decode(value: string): unknown[];
73
72
  static getDefinition<Entity extends object>(meta: EntityMetadata<Entity>, orderBy: OrderDefinition<Entity>): [never, QueryOrder][];
74
- /** @ignore */
75
- [inspect.custom](): string;
76
73
  }
package/utils/Cursor.js CHANGED
@@ -1,10 +1,10 @@
1
- import { inspect } from 'node:util';
2
1
  import { Utils } from './Utils.js';
3
2
  import { ReferenceKind } from '../enums.js';
4
3
  import { Reference } from '../entity/Reference.js';
5
4
  import { helper } from '../entity/wrap.js';
6
5
  import { RawQueryFragment } from '../utils/RawQueryFragment.js';
7
6
  import { CursorError } from '../errors.js';
7
+ import { inspect } from '../logging/inspect.js';
8
8
  /**
9
9
  * As an alternative to the offset-based pagination with `limit` and `offset`, we can paginate based on a cursor.
10
10
  * A cursor is an opaque string that defines a specific place in ordered entity graph. You can use `em.findByCursor()`
@@ -164,7 +164,7 @@ export class Cursor {
164
164
  }
165
165
  /** @ignore */
166
166
  /* v8 ignore next */
167
- [inspect.custom]() {
167
+ [Symbol.for('nodejs.util.inspect.custom')]() {
168
168
  const type = this.items[0]?.constructor.name;
169
169
  const { items, startCursor, endCursor, hasPrevPage, hasNextPage, totalCount, length } = this;
170
170
  const options = inspect({ startCursor, endCursor, totalCount, hasPrevPage, hasNextPage, items, length }, { depth: 0 });
@@ -1,4 +1,3 @@
1
- import { inspect } from 'node:util';
2
1
  import type { AnyString, Dictionary, EntityKey } from '../typings.js';
3
2
  export declare class RawQueryFragment {
4
3
  #private;
@@ -19,14 +18,6 @@ export declare class RawQueryFragment {
19
18
  static isKnownFragment(key: string | RawQueryFragment): boolean;
20
19
  static getKnownFragment(key: string | RawQueryFragment, cleanup?: boolean): RawQueryFragment | undefined;
21
20
  static remove(key: string): void;
22
- /** @ignore */
23
- [inspect.custom](): {
24
- sql: string;
25
- params: unknown[];
26
- } | {
27
- sql: string;
28
- params?: undefined;
29
- };
30
21
  }
31
22
  export { RawQueryFragment as Raw };
32
23
  export declare function isRaw(value: unknown): value is RawQueryFragment;
@@ -1,5 +1,4 @@
1
1
  import { AsyncLocalStorage } from 'node:async_hooks';
2
- import { inspect } from 'node:util';
3
2
  import { Utils } from './Utils.js';
4
3
  export class RawQueryFragment {
5
4
  sql;
@@ -80,7 +79,7 @@ export class RawQueryFragment {
80
79
  }
81
80
  /** @ignore */
82
81
  /* v8 ignore next */
83
- [inspect.custom]() {
82
+ [Symbol.for('nodejs.util.inspect.custom')]() {
84
83
  if (this.params) {
85
84
  return { sql: this.sql, params: this.params };
86
85
  }