@klerick/json-api-nestjs-microorm 0.1.0-beta.1

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +53 -0
  3. package/package.json +65 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ ## 0.1.0-beta.0 (2025-05-21)
2
+
3
+ ### 🚀 Features
4
+
5
+ - **json-api-nestjs-microorm:** Adapter for microorm ([cd56636](https://github.com/klerick/nestjs-json-api/commit/cd56636))
6
+
7
+ ### 🩹 Fixes
8
+
9
+ - **json-api-nestjs-typeorm, json-api-nestjs-microorm:** Fix mysql like error ([780bbf9](https://github.com/klerick/nestjs-json-api/commit/780bbf9))
10
+
11
+ ### ❤️ Thank You
12
+
13
+ - Alex H
package/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # json-api-nestjs-microorm
2
+
3
+ MocroOrm adapter for **[json-api-nestjs](https://github.com/klerick/nestjs-json-api/tree/master/libs/json-api/json-api-nestjs)**
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ $ npm install @klerick/json-api-nestjs-microorm
9
+ ```
10
+
11
+ ## Configuration params
12
+
13
+ The following interface is using for the configuration:
14
+
15
+ ```typescript
16
+ export type MicroOrmParam = {
17
+ arrayType?: string[]; //Custom type for indicate of array
18
+ };
19
+
20
+ ```
21
+
22
+ ## NOTE: MikroORM Default Named Context Issue in NestJS
23
+
24
+ [@mikro-orm/nestjs](https://github.com/mikro-orm/nestjs) does not create a [default named context](https://github.com/mikro-orm/nestjs/discussions/214).
25
+
26
+ As a result, the module initialization behaves differently depending on whether a single or multiple connections are used.
27
+ More specifically, the [dependency injection token for MikroORM differs](https://github.com/mikro-orm/nestjs/issues/213) between one and multiple database connections.
28
+
29
+ To maintain a consistent JSON:API module configuration across different database adapters,
30
+ I decided **not to add extra conditional checks** in the setup.
31
+
32
+ For everything to work correctly, @mikro-orm/nestjs should be integrated using the following module:
33
+ 👉 [MicroORM Database Module](https://github.com/klerick/nestjs-json-api/blob/master/libs/microorm-database/src/lib/micro-orm-database.module.ts).
34
+
35
+ ```typescript
36
+ import ormConfig from './config';
37
+
38
+ // need set contextName and registerRequestContext
39
+ export const config: Options = {
40
+ contextName: 'default',
41
+ registerRequestContext: false,
42
+ ...ormConfig,
43
+ };
44
+
45
+ @Module({
46
+ imports: [MikroOrmModule.forRoot(config), MikroOrmModule.forMiddleware()],
47
+ exports: [MikroOrmCoreModule],
48
+ })
49
+ export class MicroOrmDatabaseModule {}
50
+ ```
51
+
52
+
53
+
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@klerick/json-api-nestjs-microorm",
3
+ "version": "0.1.0-beta.1",
4
+ "license": "MIT",
5
+ "private": false,
6
+ "contributors": [
7
+ {
8
+ "email": "klerick666@gmain.com",
9
+ "name": "Aleksandr Kharkovey"
10
+ }
11
+ ],
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/klerick/nestjs-json-api.git"
15
+ },
16
+ "engines": {
17
+ "node": ">= 20.0.0"
18
+ },
19
+ "type": "commonjs",
20
+ "main": "./src/index.js",
21
+ "types": "./src/index.d.ts",
22
+ "description": "MicroOrm adapter for JsonApi Plugin for NestJs",
23
+ "keywords": [
24
+ "nestjs",
25
+ "nest",
26
+ "jsonapi",
27
+ "json-api",
28
+ "typeorm",
29
+ "microorm",
30
+ "CRUD"
31
+ ],
32
+ "dependencies": {
33
+ "@mikro-orm/core": "^6.4.3",
34
+ "@mikro-orm/knex": "6.4.3",
35
+ "@mikro-orm/nestjs": "^6.1.1",
36
+ "@mikro-orm/postgresql": "^6.4.3",
37
+ "@mikro-orm/sql-highlighter": "^1.0.1",
38
+ "@nestjs/common": "^11.0.10",
39
+ "change-case-commonjs": "^5.4.4",
40
+ "knex": "3.1.0",
41
+ "reflect-metadata": "^0.1.12 || ^0.2.0",
42
+ "rxjs": "^7.1.0",
43
+ "tslib": ">2.3.0"
44
+ },
45
+ "publishConfig": {
46
+ "access": "public"
47
+ },
48
+ "peerDependencies": {
49
+ "@anatine/zod-openapi": "2.2.7",
50
+ "@klerick/json-api-nestjs": "10.0.0-beta.1",
51
+ "@klerick/json-api-nestjs-shared": "1.0.0-beta.1",
52
+ "@nestjs/core": "11.0.10",
53
+ "@nestjs/swagger": "11.0.4",
54
+ "ts-toolbelt": "9.6.0",
55
+ "zod": "3.24.1",
56
+ "zod-validation-error": "3.4.0"
57
+ },
58
+ "exports": {
59
+ "./package.json": "./package.json",
60
+ ".": {
61
+ "types": "./src/index.d.ts",
62
+ "default": "./src/index.js"
63
+ }
64
+ }
65
+ }