@nest-boot/mikro-orm 7.3.0 → 7.3.2
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/dist/interfaces/id-entity.interface.d.ts +2 -0
- package/dist/interfaces/mikro-orm-module-options.interface.d.ts +1 -0
- package/dist/mikro-orm.module-definition.d.ts +1 -1
- package/dist/mikro-orm.module-definition.js +2 -2
- package/dist/mikro-orm.module-definition.js.map +1 -1
- package/dist/mikro-orm.module.d.ts +41 -4
- package/dist/mikro-orm.module.js +41 -0
- package/dist/mikro-orm.module.js.map +1 -1
- package/dist/property-types/vector.type.d.ts +16 -0
- package/dist/property-types/vector.type.js +16 -0
- package/dist/property-types/vector.type.js.map +1 -1
- package/dist/services/entity.service.d.ts +68 -0
- package/dist/services/entity.service.js +73 -7
- package/dist/services/entity.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/chunk-by-id-options.type.d.ts +1 -0
- package/dist/types/id-or-entity.type.d.ts +1 -0
- package/dist/utils/load-config-from-env.util.d.ts +30 -5
- package/dist/utils/load-config-from-env.util.js +30 -20
- package/dist/utils/load-config-from-env.util.js.map +1 -1
- package/package.json +11 -6
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { MikroOrmModuleOptions as BaseMikroOrmModuleOptions } from "@mikro-orm/nestjs";
|
|
2
|
+
/** Configuration options for the MikroORM module (excludes context management handled internally). */
|
|
2
3
|
export type MikroOrmModuleOptions = Omit<BaseMikroOrmModuleOptions, "registerRequestContext" | "context">;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { MikroOrmModuleOptions } from "./interfaces/mikro-orm-module-options.interface";
|
|
2
2
|
export declare const MODULE_OPTIONS_TOKEN: unique symbol;
|
|
3
|
-
export declare const ConfigurableModuleClass: import("@nestjs/common").ConfigurableModuleCls<MikroOrmModuleOptions, "forRoot", "create", {}>, BASE_MODULE_OPTIONS_TOKEN: string | symbol
|
|
3
|
+
export declare const ConfigurableModuleClass: import("@nestjs/common").ConfigurableModuleCls<MikroOrmModuleOptions, "forRoot", "create", {}>, BASE_MODULE_OPTIONS_TOKEN: string | symbol, OPTIONS_TYPE: MikroOrmModuleOptions & Partial<{}>, ASYNC_OPTIONS_TYPE: import("@nestjs/common").ConfigurableModuleAsyncOptions<MikroOrmModuleOptions, "create"> & Partial<{}>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.BASE_MODULE_OPTIONS_TOKEN = exports.ConfigurableModuleClass = exports.MODULE_OPTIONS_TOKEN = void 0;
|
|
4
|
+
exports.ASYNC_OPTIONS_TYPE = exports.OPTIONS_TYPE = exports.BASE_MODULE_OPTIONS_TOKEN = exports.ConfigurableModuleClass = exports.MODULE_OPTIONS_TOKEN = void 0;
|
|
5
5
|
const common_1 = require("@nestjs/common");
|
|
6
6
|
exports.MODULE_OPTIONS_TOKEN = Symbol("MikroOrmModuleOptions");
|
|
7
7
|
_a = new common_1.ConfigurableModuleBuilder()
|
|
8
8
|
.setClassMethodName("forRoot")
|
|
9
|
-
.build(), exports.ConfigurableModuleClass = _a.ConfigurableModuleClass, exports.BASE_MODULE_OPTIONS_TOKEN = _a.MODULE_OPTIONS_TOKEN;
|
|
9
|
+
.build(), exports.ConfigurableModuleClass = _a.ConfigurableModuleClass, exports.BASE_MODULE_OPTIONS_TOKEN = _a.MODULE_OPTIONS_TOKEN, exports.OPTIONS_TYPE = _a.OPTIONS_TYPE, exports.ASYNC_OPTIONS_TYPE = _a.ASYNC_OPTIONS_TYPE;
|
|
10
10
|
//# sourceMappingURL=mikro-orm.module-definition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mikro-orm.module-definition.js","sourceRoot":"","sources":["../src/mikro-orm.module-definition.ts"],"names":[],"mappings":";;;;AAAA,2CAA2D;AAI9C,QAAA,oBAAoB,GAAG,MAAM,CAAC,uBAAuB,CAAC,CAAC;AAEvD,
|
|
1
|
+
{"version":3,"file":"mikro-orm.module-definition.js","sourceRoot":"","sources":["../src/mikro-orm.module-definition.ts"],"names":[],"mappings":";;;;AAAA,2CAA2D;AAI9C,QAAA,oBAAoB,GAAG,MAAM,CAAC,uBAAuB,CAAC,CAAC;AAEvD,KAKT,IAAI,kCAAyB,EAAyB;KACvD,kBAAkB,CAAC,SAAS,CAAC;KAC7B,KAAK,EAAE,EANR,+BAAuB,+BACD,iCAAyB,4BAC/C,oBAAY,oBACZ,0BAAkB,yBAGT"}
|
|
@@ -1,12 +1,49 @@
|
|
|
1
1
|
import { MikroORM } from "@mikro-orm/core";
|
|
2
2
|
import { MikroOrmModule as BaseMikroOrmModule } from "@mikro-orm/nestjs";
|
|
3
|
-
import { OnModuleInit } from "@nestjs/common";
|
|
4
|
-
import { ConfigurableModuleClass } from "./mikro-orm.module-definition";
|
|
3
|
+
import { type DynamicModule, OnModuleInit } from "@nestjs/common";
|
|
4
|
+
import { ASYNC_OPTIONS_TYPE, ConfigurableModuleClass, OPTIONS_TYPE } from "./mikro-orm.module-definition";
|
|
5
|
+
/**
|
|
6
|
+
* MikroORM integration module with request-scoped entity manager.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Wraps `@mikro-orm/nestjs` with automatic environment-based configuration
|
|
10
|
+
* and request context integration for per-request entity manager forking.
|
|
11
|
+
*/
|
|
5
12
|
export declare class MikroOrmModule extends ConfigurableModuleClass implements OnModuleInit {
|
|
6
13
|
private readonly orm;
|
|
14
|
+
/**
|
|
15
|
+
* Registers the MikroOrmModule with the given options.
|
|
16
|
+
* @param options - MikroORM configuration options
|
|
17
|
+
* @returns Dynamic module configuration
|
|
18
|
+
*/
|
|
19
|
+
static forRoot(options: typeof OPTIONS_TYPE): DynamicModule;
|
|
20
|
+
/**
|
|
21
|
+
* Registers the MikroOrmModule asynchronously with factory functions.
|
|
22
|
+
* @param options - Async configuration options
|
|
23
|
+
* @returns Dynamic module configuration
|
|
24
|
+
*/
|
|
25
|
+
static forRootAsync(options: typeof ASYNC_OPTIONS_TYPE): DynamicModule;
|
|
26
|
+
/** Creates a new MikroOrmModule instance.
|
|
27
|
+
* @param orm - The MikroORM instance
|
|
28
|
+
*/
|
|
7
29
|
constructor(orm: MikroORM);
|
|
8
|
-
|
|
9
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Registers entity classes for use in the given module scope.
|
|
32
|
+
* @param args - forFeature arguments (entity classes, options)
|
|
33
|
+
* @returns Dynamic module configuration
|
|
34
|
+
*/
|
|
35
|
+
static forFeature(...args: Parameters<typeof BaseMikroOrmModule.forFeature>): DynamicModule;
|
|
36
|
+
/**
|
|
37
|
+
* Registers MikroORM middleware for the module.
|
|
38
|
+
* @param args - forMiddleware arguments
|
|
39
|
+
* @returns Dynamic module configuration
|
|
40
|
+
*/
|
|
41
|
+
static forMiddleware(...args: Parameters<typeof BaseMikroOrmModule.forMiddleware>): DynamicModule;
|
|
42
|
+
/**
|
|
43
|
+
* Clears the MikroORM metadata storage.
|
|
44
|
+
* @param args - clearStorage arguments
|
|
45
|
+
*/
|
|
10
46
|
static clearStorage(...args: Parameters<typeof BaseMikroOrmModule.clearStorage>): void;
|
|
47
|
+
/** Registers the MikroORM entity manager fork middleware in the request context. */
|
|
11
48
|
onModuleInit(): void;
|
|
12
49
|
}
|
package/dist/mikro-orm.module.js
CHANGED
|
@@ -16,21 +16,62 @@ const request_context_1 = require("@nest-boot/request-context");
|
|
|
16
16
|
const common_1 = require("@nestjs/common");
|
|
17
17
|
const mikro_orm_module_definition_1 = require("./mikro-orm.module-definition");
|
|
18
18
|
const load_config_from_env_util_1 = require("./utils/load-config-from-env.util");
|
|
19
|
+
/**
|
|
20
|
+
* MikroORM integration module with request-scoped entity manager.
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* Wraps `@mikro-orm/nestjs` with automatic environment-based configuration
|
|
24
|
+
* and request context integration for per-request entity manager forking.
|
|
25
|
+
*/
|
|
19
26
|
let MikroOrmModule = class MikroOrmModule extends mikro_orm_module_definition_1.ConfigurableModuleClass {
|
|
27
|
+
/**
|
|
28
|
+
* Registers the MikroOrmModule with the given options.
|
|
29
|
+
* @param options - MikroORM configuration options
|
|
30
|
+
* @returns Dynamic module configuration
|
|
31
|
+
*/
|
|
32
|
+
static forRoot(options) {
|
|
33
|
+
return super.forRoot(options);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Registers the MikroOrmModule asynchronously with factory functions.
|
|
37
|
+
* @param options - Async configuration options
|
|
38
|
+
* @returns Dynamic module configuration
|
|
39
|
+
*/
|
|
40
|
+
static forRootAsync(options) {
|
|
41
|
+
return super.forRootAsync(options);
|
|
42
|
+
}
|
|
43
|
+
/** Creates a new MikroOrmModule instance.
|
|
44
|
+
* @param orm - The MikroORM instance
|
|
45
|
+
*/
|
|
20
46
|
constructor(orm) {
|
|
21
47
|
super();
|
|
22
48
|
this.orm = orm;
|
|
23
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Registers entity classes for use in the given module scope.
|
|
52
|
+
* @param args - forFeature arguments (entity classes, options)
|
|
53
|
+
* @returns Dynamic module configuration
|
|
54
|
+
*/
|
|
24
55
|
static forFeature(...args) {
|
|
25
56
|
return nestjs_1.MikroOrmModule.forFeature(...args);
|
|
26
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Registers MikroORM middleware for the module.
|
|
60
|
+
* @param args - forMiddleware arguments
|
|
61
|
+
* @returns Dynamic module configuration
|
|
62
|
+
*/
|
|
27
63
|
static forMiddleware(...args) {
|
|
28
64
|
return nestjs_1.MikroOrmModule.forMiddleware(...args);
|
|
29
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Clears the MikroORM metadata storage.
|
|
68
|
+
* @param args - clearStorage arguments
|
|
69
|
+
*/
|
|
30
70
|
static clearStorage(...args) {
|
|
31
71
|
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
|
|
32
72
|
return nestjs_1.MikroOrmModule.clearStorage(...args);
|
|
33
73
|
}
|
|
74
|
+
/** Registers the MikroORM entity manager fork middleware in the request context. */
|
|
34
75
|
onModuleInit() {
|
|
35
76
|
request_context_1.RequestContext.registerMiddleware("mikro-orm", (ctx, next) => {
|
|
36
77
|
ctx.set(core_1.EntityManager, this.orm.em.fork({ useContext: true }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mikro-orm.module.js","sourceRoot":"","sources":["../src/mikro-orm.module.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAA0D;AAC1D,8CAAyE;AACzE,gEAGoC;AACpC,
|
|
1
|
+
{"version":3,"file":"mikro-orm.module.js","sourceRoot":"","sources":["../src/mikro-orm.module.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAA0D;AAC1D,8CAAyE;AACzE,gEAGoC;AACpC,2CAMwB;AAGxB,+EAMuC;AACvC,iFAAsE;AAEtE;;;;;;GAMG;AAmCI,IAAM,cAAc,GAApB,MAAM,cACX,SAAQ,qDAAuB;IAG/B;;;;OAIG;IACH,MAAM,CAAU,OAAO,CAAC,OAA4B;QAClD,OAAO,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAU,YAAY,CAC1B,OAAkC;QAElC,OAAO,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,YAA6B,GAAa;QACxC,KAAK,EAAE,CAAC;QADmB,QAAG,GAAH,GAAG,CAAU;IAE1C,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,GAAG,IAAsD;QACzE,OAAO,uBAAkB,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,CAAC;IAChD,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,aAAa,CAClB,GAAG,IAAyD;QAE5D,OAAO,uBAAkB,CAAC,aAAa,CAAC,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AS,EAAE;YACT;gBACE,OAAO,EAAE,kDAAoB;gBAC7B,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,uDAAyB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;gBAC9D,UAAU,EAAE,CAAC,OAA+B,EAAE,EAAE,CAAC,OAAO,IAAI,EAAE;aAC/D;SACF;QACD,OAAO,EAAE,CAAC,kDAAoB,CAAC;KAChC,CAAC;qCA4BkC,eAAQ;GA3B/B,cAAc,CAqE1B"}
|
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
import { EntityProperty, Platform } from "@mikro-orm/core";
|
|
2
2
|
import { VectorType as BaseVectorType } from "pgvector/mikro-orm";
|
|
3
|
+
/**
|
|
4
|
+
* Custom MikroORM property type for pgvector vector columns with configurable dimensions.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Extends the base pgvector `VectorType` to support specifying the vector
|
|
8
|
+
* dimension at the property level (e.g. `vector(1536)`).
|
|
9
|
+
*/
|
|
3
10
|
export declare class VectorType extends BaseVectorType {
|
|
4
11
|
private readonly dimensions?;
|
|
12
|
+
/** Creates a new VectorType instance.
|
|
13
|
+
* @param dimensions - Optional vector dimension (e.g. 1536 for OpenAI embeddings)
|
|
14
|
+
*/
|
|
5
15
|
constructor(dimensions?: number | undefined);
|
|
16
|
+
/**
|
|
17
|
+
* Returns the SQL column type for the vector property.
|
|
18
|
+
* @param prop - The entity property metadata
|
|
19
|
+
* @param platform - The database platform
|
|
20
|
+
* @returns The column type string (e.g. `vector(1536)`)
|
|
21
|
+
*/
|
|
6
22
|
getColumnType(prop: EntityProperty, platform: Platform): any;
|
|
7
23
|
}
|
|
@@ -2,11 +2,27 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VectorType = void 0;
|
|
4
4
|
const mikro_orm_1 = require("pgvector/mikro-orm");
|
|
5
|
+
/**
|
|
6
|
+
* Custom MikroORM property type for pgvector vector columns with configurable dimensions.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Extends the base pgvector `VectorType` to support specifying the vector
|
|
10
|
+
* dimension at the property level (e.g. `vector(1536)`).
|
|
11
|
+
*/
|
|
5
12
|
class VectorType extends mikro_orm_1.VectorType {
|
|
13
|
+
/** Creates a new VectorType instance.
|
|
14
|
+
* @param dimensions - Optional vector dimension (e.g. 1536 for OpenAI embeddings)
|
|
15
|
+
*/
|
|
6
16
|
constructor(dimensions) {
|
|
7
17
|
super();
|
|
8
18
|
this.dimensions = dimensions;
|
|
9
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Returns the SQL column type for the vector property.
|
|
22
|
+
* @param prop - The entity property metadata
|
|
23
|
+
* @param platform - The database platform
|
|
24
|
+
* @returns The column type string (e.g. `vector(1536)`)
|
|
25
|
+
*/
|
|
10
26
|
getColumnType(prop, platform) {
|
|
11
27
|
return super.getColumnType({ dimensions: this.dimensions, ...prop }, platform);
|
|
12
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector.type.js","sourceRoot":"","sources":["../../src/property-types/vector.type.ts"],"names":[],"mappings":";;;AACA,kDAAkE;AAElE,MAAa,UAAW,SAAQ,sBAAc;IAC5C,YAA6B,UAAmB;QAC9C,KAAK,EAAE,CAAC;QADmB,eAAU,GAAV,UAAU,CAAS;IAEhD,CAAC;IAED,aAAa,CAAC,IAAoB,EAAE,QAAkB;QACpD,OAAO,KAAK,CAAC,aAAa,CACxB,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,GAAG,IAAI,EAAE,EACxC,QAAQ,CACT,CAAC;IACJ,CAAC;CACF;
|
|
1
|
+
{"version":3,"file":"vector.type.js","sourceRoot":"","sources":["../../src/property-types/vector.type.ts"],"names":[],"mappings":";;;AACA,kDAAkE;AAElE;;;;;;GAMG;AACH,MAAa,UAAW,SAAQ,sBAAc;IAC5C;;OAEG;IACH,YAA6B,UAAmB;QAC9C,KAAK,EAAE,CAAC;QADmB,eAAU,GAAV,UAAU,CAAS;IAEhD,CAAC;IAED;;;;;OAKG;IACH,aAAa,CAAC,IAAoB,EAAE,QAAkB;QACpD,OAAO,KAAK,CAAC,aAAa,CACxB,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,GAAG,IAAI,EAAE,EACxC,QAAQ,CACT,CAAC;IACJ,CAAC;CACF;AApBD,gCAoBC"}
|
|
@@ -4,21 +4,89 @@ import { Type } from "@nestjs/common";
|
|
|
4
4
|
import type { IdEntity } from "../interfaces/id-entity.interface";
|
|
5
5
|
import type { ChunkByIdOptions } from "../types/chunk-by-id-options.type";
|
|
6
6
|
import type { IdOrEntity } from "../types/id-or-entity.type";
|
|
7
|
+
/** Options for configuring an {@link EntityService} instance. */
|
|
7
8
|
export interface EntityServiceOptions<Entity extends IdEntity> {
|
|
9
|
+
/** Entity property key used for soft-delete timestamps (defaults to `"deletedAt"`). */
|
|
8
10
|
softDeleteKey?: keyof Entity;
|
|
9
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Generic CRUD service for MikroORM entities with DataLoader batching.
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Provides batched `create`, `findOne`, `update`, and `remove` operations
|
|
17
|
+
* via DataLoader for automatic N+1 prevention, plus standard `findAll`,
|
|
18
|
+
* `count`, and `chunkById` methods.
|
|
19
|
+
*
|
|
20
|
+
* @typeParam Entity - The entity type, which must have an `id` property
|
|
21
|
+
*/
|
|
10
22
|
export declare class EntityService<Entity extends IdEntity> {
|
|
11
23
|
#private;
|
|
12
24
|
protected readonly entityClass: Type<Entity>;
|
|
13
25
|
protected readonly em: EntityManager;
|
|
14
26
|
protected readonly options?: EntityServiceOptions<Entity> | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Creates a new EntityService instance.
|
|
29
|
+
* @param entityClass - The entity class to manage
|
|
30
|
+
* @param em - MikroORM entity manager
|
|
31
|
+
* @param options - Optional service configuration (e.g. soft-delete key)
|
|
32
|
+
*/
|
|
15
33
|
constructor(entityClass: Type<Entity>, em: EntityManager, options?: EntityServiceOptions<Entity> | undefined);
|
|
34
|
+
/**
|
|
35
|
+
* Creates a new entity and persists it.
|
|
36
|
+
* @param data - The entity data to create
|
|
37
|
+
* @returns The created entity
|
|
38
|
+
*/
|
|
16
39
|
create(data: RequiredEntityData<Entity>): Promise<Entity>;
|
|
40
|
+
/**
|
|
41
|
+
* Finds a single entity by ID, entity reference, or filter query.
|
|
42
|
+
* @param idOrEntityOrWhere - The entity ID, entity instance, or filter query
|
|
43
|
+
* @returns The found entity or null
|
|
44
|
+
*/
|
|
17
45
|
findOne(idOrEntityOrWhere: IdOrEntity<Entity> | FilterQuery<NoInfer<Entity>>): Promise<Loaded<Entity> | null>;
|
|
46
|
+
/**
|
|
47
|
+
* Finds a single entity by ID, entity reference, or filter query, throwing if not found.
|
|
48
|
+
* @param idOrEntityOrWhere - The entity ID, entity instance, or filter query
|
|
49
|
+
* @returns The found entity
|
|
50
|
+
* @throws NotFoundException if the entity is not found
|
|
51
|
+
*/
|
|
18
52
|
findOneOrFail(idOrEntityOrWhere: IdOrEntity<Entity> | FilterQuery<Entity>): Promise<Loaded<Entity>>;
|
|
53
|
+
/**
|
|
54
|
+
* Finds all entities matching the given filter query.
|
|
55
|
+
* @param where - Filter query
|
|
56
|
+
* @param options - Find options (populate, limit, offset, etc.)
|
|
57
|
+
* @returns Array of matching entities
|
|
58
|
+
*/
|
|
19
59
|
findAll<Hint extends string = never, Fields extends string = PopulatePath.ALL, Excludes extends string = never>(where: FilterQuery<NoInfer<Entity>>, options?: FindOptions<Entity, Hint, Fields, Excludes>): Promise<Loaded<Entity, Hint, Fields, Excludes>[]>;
|
|
60
|
+
/**
|
|
61
|
+
* Counts entities matching the given filter query.
|
|
62
|
+
* @param where - Filter query
|
|
63
|
+
* @param options - Count options
|
|
64
|
+
* @returns The number of matching entities
|
|
65
|
+
*/
|
|
20
66
|
count<Hint extends string = never>(where: FilterQuery<NoInfer<Entity>>, options?: CountOptions<Entity, Hint>): Promise<number>;
|
|
67
|
+
/**
|
|
68
|
+
* Updates an entity by ID or reference.
|
|
69
|
+
* @param idOrEntity - The entity ID or entity instance to update
|
|
70
|
+
* @param data - The data to assign to the entity
|
|
71
|
+
* @param options - Optional assign options
|
|
72
|
+
* @returns The updated entity
|
|
73
|
+
* @throws NotFoundException if the entity is not found
|
|
74
|
+
*/
|
|
21
75
|
update<Naked extends FromEntityType<Entity> = FromEntityType<Entity>, Convert extends boolean = false, Data extends EntityData<Naked, Convert> | Partial<EntityDTO<Naked>> = EntityData<Naked, Convert> | Partial<EntityDTO<Naked>>>(idOrEntity: IdOrEntity<Entity>, data: Data & IsSubset<EntityData<Naked, Convert>, Data>, options?: AssignOptions<Convert>): Promise<Entity>;
|
|
76
|
+
/**
|
|
77
|
+
* Removes an entity by ID or reference (supports soft-delete).
|
|
78
|
+
* @param idOrEntity - The entity ID or entity instance to remove
|
|
79
|
+
* @param softDelete - Whether to soft-delete (default: true)
|
|
80
|
+
* @returns The removed entity
|
|
81
|
+
* @throws NotFoundException if the entity is not found
|
|
82
|
+
*/
|
|
22
83
|
remove(idOrEntity: IdOrEntity<Entity>, softDelete?: boolean): Promise<Entity>;
|
|
84
|
+
/**
|
|
85
|
+
* Iterates over entities in chunks ordered by ID, useful for batch processing.
|
|
86
|
+
* @param where - Filter query
|
|
87
|
+
* @param options - Find options (limit determines chunk size)
|
|
88
|
+
* @param callback - Async callback invoked with each chunk of entities
|
|
89
|
+
* @returns This service instance for chaining
|
|
90
|
+
*/
|
|
23
91
|
chunkById<Hint extends string = never, Fields extends string = PopulatePath.ALL, Excludes extends string = never>(where: ExpandQuery<Entity>, options: ChunkByIdOptions<Entity, Hint, Fields, Excludes>, callback: (entities: Loaded<Entity, Hint, Fields, Excludes>[]) => Promise<void>): Promise<this>;
|
|
24
92
|
}
|
|
@@ -14,16 +14,42 @@ const core_1 = require("@mikro-orm/core");
|
|
|
14
14
|
const common_1 = require("@nestjs/common");
|
|
15
15
|
const dataloader_1 = __importDefault(require("dataloader"));
|
|
16
16
|
const lodash_1 = __importDefault(require("lodash"));
|
|
17
|
+
/**
|
|
18
|
+
* Generic CRUD service for MikroORM entities with DataLoader batching.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* Provides batched `create`, `findOne`, `update`, and `remove` operations
|
|
22
|
+
* via DataLoader for automatic N+1 prevention, plus standard `findAll`,
|
|
23
|
+
* `count`, and `chunkById` methods.
|
|
24
|
+
*
|
|
25
|
+
* @typeParam Entity - The entity type, which must have an `id` property
|
|
26
|
+
*/
|
|
17
27
|
class EntityService {
|
|
28
|
+
/**
|
|
29
|
+
* Creates a new EntityService instance.
|
|
30
|
+
* @param entityClass - The entity class to manage
|
|
31
|
+
* @param em - MikroORM entity manager
|
|
32
|
+
* @param options - Optional service configuration (e.g. soft-delete key)
|
|
33
|
+
*/
|
|
18
34
|
constructor(entityClass, em, options) {
|
|
19
35
|
_EntityService_instances.add(this);
|
|
20
36
|
this.entityClass = entityClass;
|
|
21
37
|
this.em = em;
|
|
22
38
|
this.options = options;
|
|
23
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Creates a new entity and persists it.
|
|
42
|
+
* @param data - The entity data to create
|
|
43
|
+
* @returns The created entity
|
|
44
|
+
*/
|
|
24
45
|
create(data) {
|
|
25
46
|
return __classPrivateFieldGet(this, _EntityService_instances, "a", _EntityService_createDataLoader_get).load(data);
|
|
26
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Finds a single entity by ID, entity reference, or filter query.
|
|
50
|
+
* @param idOrEntityOrWhere - The entity ID, entity instance, or filter query
|
|
51
|
+
* @returns The found entity or null
|
|
52
|
+
*/
|
|
27
53
|
async findOne(idOrEntityOrWhere) {
|
|
28
54
|
if (lodash_1.default.isPlainObject(idOrEntityOrWhere)) {
|
|
29
55
|
return await this.em.findOne(this.entityClass, idOrEntityOrWhere);
|
|
@@ -34,6 +60,12 @@ class EntityService {
|
|
|
34
60
|
}));
|
|
35
61
|
}
|
|
36
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Finds a single entity by ID, entity reference, or filter query, throwing if not found.
|
|
65
|
+
* @param idOrEntityOrWhere - The entity ID, entity instance, or filter query
|
|
66
|
+
* @returns The found entity
|
|
67
|
+
* @throws NotFoundException if the entity is not found
|
|
68
|
+
*/
|
|
37
69
|
async findOneOrFail(idOrEntityOrWhere) {
|
|
38
70
|
const entity = await this.findOne(idOrEntityOrWhere);
|
|
39
71
|
if (entity === null) {
|
|
@@ -41,12 +73,32 @@ class EntityService {
|
|
|
41
73
|
}
|
|
42
74
|
return entity;
|
|
43
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Finds all entities matching the given filter query.
|
|
78
|
+
* @param where - Filter query
|
|
79
|
+
* @param options - Find options (populate, limit, offset, etc.)
|
|
80
|
+
* @returns Array of matching entities
|
|
81
|
+
*/
|
|
44
82
|
async findAll(where, options) {
|
|
45
83
|
return await this.em.find(this.entityClass, where, options);
|
|
46
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Counts entities matching the given filter query.
|
|
87
|
+
* @param where - Filter query
|
|
88
|
+
* @param options - Count options
|
|
89
|
+
* @returns The number of matching entities
|
|
90
|
+
*/
|
|
47
91
|
async count(where, options) {
|
|
48
92
|
return await this.em.count(this.entityClass, where, options);
|
|
49
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Updates an entity by ID or reference.
|
|
96
|
+
* @param idOrEntity - The entity ID or entity instance to update
|
|
97
|
+
* @param data - The data to assign to the entity
|
|
98
|
+
* @param options - Optional assign options
|
|
99
|
+
* @returns The updated entity
|
|
100
|
+
* @throws NotFoundException if the entity is not found
|
|
101
|
+
*/
|
|
50
102
|
async update(idOrEntity, data, options) {
|
|
51
103
|
const entity = await __classPrivateFieldGet(this, _EntityService_instances, "a", _EntityService_updateDataLoader_get).load({
|
|
52
104
|
idOrEntity,
|
|
@@ -58,6 +110,13 @@ class EntityService {
|
|
|
58
110
|
}
|
|
59
111
|
return entity;
|
|
60
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* Removes an entity by ID or reference (supports soft-delete).
|
|
115
|
+
* @param idOrEntity - The entity ID or entity instance to remove
|
|
116
|
+
* @param softDelete - Whether to soft-delete (default: true)
|
|
117
|
+
* @returns The removed entity
|
|
118
|
+
* @throws NotFoundException if the entity is not found
|
|
119
|
+
*/
|
|
61
120
|
async remove(idOrEntity, softDelete = true) {
|
|
62
121
|
const entity = await __classPrivateFieldGet(this, _EntityService_instances, "a", _EntityService_removeDataLoader_get).load({
|
|
63
122
|
idOrEntity,
|
|
@@ -68,6 +127,13 @@ class EntityService {
|
|
|
68
127
|
}
|
|
69
128
|
return entity;
|
|
70
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* Iterates over entities in chunks ordered by ID, useful for batch processing.
|
|
132
|
+
* @param where - Filter query
|
|
133
|
+
* @param options - Find options (limit determines chunk size)
|
|
134
|
+
* @param callback - Async callback invoked with each chunk of entities
|
|
135
|
+
* @returns This service instance for chaining
|
|
136
|
+
*/
|
|
71
137
|
async chunkById(where, options, callback) {
|
|
72
138
|
let lastId;
|
|
73
139
|
let count = 0;
|
|
@@ -97,13 +163,13 @@ exports.EntityService = EntityService;
|
|
|
97
163
|
_EntityService_instances = new WeakSet(), _EntityService_getDataLoader_get = function _EntityService_getDataLoader_get() {
|
|
98
164
|
return new dataloader_1.default(async (items) => {
|
|
99
165
|
const uow = this.em.getUnitOfWork();
|
|
100
|
-
//
|
|
166
|
+
// Get all IDs
|
|
101
167
|
const ids = items.map(({ idOrEntity }) => typeof idOrEntity === "object" ? idOrEntity.id : idOrEntity);
|
|
102
|
-
//
|
|
168
|
+
// First try to get already loaded entities from UnitOfWork
|
|
103
169
|
const entitiesFromUow = [];
|
|
104
170
|
const idsToFetch = [];
|
|
105
171
|
for (const id of ids) {
|
|
106
|
-
//
|
|
172
|
+
// Try to get entity from UnitOfWork's identity map
|
|
107
173
|
const entity = uow.getById(core_1.Utils.className(this.entityClass), id);
|
|
108
174
|
if (entity) {
|
|
109
175
|
entitiesFromUow.push(entity);
|
|
@@ -112,16 +178,16 @@ _EntityService_instances = new WeakSet(), _EntityService_getDataLoader_get = fun
|
|
|
112
178
|
idsToFetch.push(id);
|
|
113
179
|
}
|
|
114
180
|
}
|
|
115
|
-
//
|
|
181
|
+
// If there are IDs that need to be fetched from the database, execute the query
|
|
116
182
|
let entitiesFromDb = [];
|
|
117
183
|
if (idsToFetch.length > 0) {
|
|
118
184
|
entitiesFromDb = await this.em.find(this.entityClass, {
|
|
119
185
|
id: { $in: idsToFetch },
|
|
120
186
|
}, { limit: idsToFetch.length });
|
|
121
187
|
}
|
|
122
|
-
//
|
|
188
|
+
// Merge results from UnitOfWork and database query
|
|
123
189
|
const allEntities = [...entitiesFromUow, ...entitiesFromDb];
|
|
124
|
-
//
|
|
190
|
+
// Return results in the original order
|
|
125
191
|
return ids.map((id) => {
|
|
126
192
|
return allEntities.find((entity) => entity.id === id) ?? null;
|
|
127
193
|
});
|
|
@@ -149,7 +215,7 @@ _EntityService_instances = new WeakSet(), _EntityService_getDataLoader_get = fun
|
|
|
149
215
|
return entityOrError;
|
|
150
216
|
}
|
|
151
217
|
const { data, options } = items[index];
|
|
152
|
-
//
|
|
218
|
+
// Filter out undefined values
|
|
153
219
|
const filteredData = Object.fromEntries(Object.entries(data).filter(([, value]) => value !== undefined));
|
|
154
220
|
this.em.assign(entityOrError, filteredData, options);
|
|
155
221
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity.service.js","sourceRoot":"","sources":["../../src/services/entity.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAgByB;AAEzB,2CAAyD;AACzD,4DAAoC;AACpC,oDAAuB;
|
|
1
|
+
{"version":3,"file":"entity.service.js","sourceRoot":"","sources":["../../src/services/entity.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAgByB;AAEzB,2CAAyD;AACzD,4DAAoC;AACpC,oDAAuB;AAkCv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