@mikro-orm/core 7.0.0-dev.86 → 7.0.0-dev.88

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.
package/MikroORM.js CHANGED
@@ -150,8 +150,8 @@ export class MikroORM {
150
150
  */
151
151
  async close(force = false) {
152
152
  await this.driver.close(force);
153
- await this.config.getMetadataCacheAdapter().close?.();
154
- await this.config.getResultCacheAdapter().close?.();
153
+ await this.config.getMetadataCacheAdapter()?.close?.();
154
+ await this.config.getResultCacheAdapter()?.close?.();
155
155
  }
156
156
  /**
157
157
  * Gets the `MetadataStorage` (without parameters) or `EntityMetadata` instance when provided with the `entityName` parameter.
@@ -1,6 +1,6 @@
1
1
  import type { EntityManager } from '../EntityManager.js';
2
2
  import type { ColumnType, PropertyOptions, ReferenceOptions, EnumOptions, EmbeddedOptions, ManyToOneOptions, OneToManyOptions, OneToOneOptions, ManyToManyOptions } from '../metadata/types.js';
3
- import type { AnyString, GeneratedColumnCallback, Constructor, CheckCallback, FilterQuery, EntityName, Dictionary, EntityMetadata, PrimaryKeyProp, Hidden, Opt, Primary, EntityClass, EntitySchemaWithMeta, InferEntity, MaybeReturnType, Ref } from '../typings.js';
3
+ import type { AnyString, GeneratedColumnCallback, Constructor, CheckCallback, FilterQuery, EntityName, Dictionary, EntityMetadata, PrimaryKeyProp, Hidden, Opt, Primary, EntityClass, EntitySchemaWithMeta, InferEntity, MaybeReturnType, Ref, IndexCallback } from '../typings.js';
4
4
  import type { ScalarReference } from './Reference.js';
5
5
  import type { SerializeOptions } from '../serialization/EntitySerializer.js';
6
6
  import type { Cascade, DeferMode, EmbeddedPrefixMode, EventType, LoadStrategy, QueryOrderMap } from '../enums.js';
@@ -409,14 +409,33 @@ declare const propertyBuilders: {
409
409
  interval: () => UniversalPropertyOptionsBuilder<string, EmptyOptions, IncludeKeysForProperty>;
410
410
  unknown: () => UniversalPropertyOptionsBuilder<{}, EmptyOptions, IncludeKeysForProperty>;
411
411
  };
412
- export declare function defineEntity<const TName extends string, const TTableName extends string, const TProperties extends Record<string, any>, const TPK extends (keyof TProperties)[] | undefined = undefined, const TBase = never>(meta: Omit<Partial<EntityMetadata<InferEntityFromProperties<TProperties, TPK>>>, 'properties' | 'extends' | 'primaryKeys' | 'hooks'> & {
412
+ export interface EntityMetadataWithProperties<TName extends string, TTableName extends string, TProperties extends Record<string, any>, TPK extends (keyof TProperties)[] | undefined = undefined, TBase = never> extends Omit<Partial<EntityMetadata<InferEntityFromProperties<TProperties, TPK>>>, 'properties' | 'extends' | 'primaryKeys' | 'hooks' | 'discriminatorColumn' | 'versionProperty' | 'concurrencyCheckKeys' | 'serializedPrimaryKey' | 'indexes' | 'uniques'> {
413
413
  name: TName;
414
414
  tableName?: TTableName;
415
415
  extends?: EntityName<TBase>;
416
416
  properties: TProperties | ((properties: typeof propertyBuilders) => TProperties);
417
417
  primaryKeys?: TPK & InferPrimaryKey<TProperties>[];
418
418
  hooks?: DefineEntityHooks<InferEntityFromProperties<TProperties, TPK>>;
419
- }): EntitySchemaWithMeta<TName, TTableName, InferEntityFromProperties<TProperties, TPK>, TBase, TProperties>;
419
+ discriminatorColumn?: keyof TProperties;
420
+ versionProperty?: keyof TProperties;
421
+ concurrencyCheckKeys?: Set<keyof TProperties>;
422
+ serializedPrimaryKey?: keyof TProperties;
423
+ indexes?: {
424
+ properties?: keyof TProperties | (keyof TProperties)[];
425
+ name?: string;
426
+ type?: string;
427
+ options?: Dictionary;
428
+ expression?: string | IndexCallback<InferEntityFromProperties<TProperties, TPK>>;
429
+ }[];
430
+ uniques?: {
431
+ properties?: keyof TProperties | (keyof TProperties)[];
432
+ name?: string;
433
+ options?: Dictionary;
434
+ expression?: string | IndexCallback<InferEntityFromProperties<TProperties, TPK>>;
435
+ deferMode?: DeferMode | `${DeferMode}`;
436
+ }[];
437
+ }
438
+ export declare function defineEntity<const TName extends string, const TTableName extends string, const TProperties extends Record<string, any>, const TPK extends (keyof TProperties)[] | undefined = undefined, const TBase = never>(meta: EntityMetadataWithProperties<TName, TTableName, TProperties, TPK, TBase>): EntitySchemaWithMeta<TName, TTableName, InferEntityFromProperties<TProperties, TPK>, TBase, TProperties>;
420
439
  export declare function defineEntity<const TEntity = any, const TProperties extends Record<string, any> = Record<string, any>, const TClassName extends string = string, const TTableName extends string = string, const TBase = never>(meta: Omit<Partial<EntityMetadata<TEntity>>, 'properties' | 'extends' | 'className' | 'tableName'> & {
421
440
  class: EntityClass<TEntity>;
422
441
  className?: TClassName;
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.86",
4
+ "version": "7.0.0-dev.88",
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",