Skip to content

Commit

Permalink
fix: compatibility with latest mikro-orm alphas (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
darkbasic authored Nov 27, 2023
1 parent a4bf086 commit a1a0fff
Show file tree
Hide file tree
Showing 6 changed files with 257 additions and 268 deletions.
5 changes: 5 additions & 0 deletions .changeset/smooth-lies-scream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"mikro-orm-find-dataloader": patch
---

Compatibility with latest MikroORM alphas which export different types
14 changes: 7 additions & 7 deletions examples/graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
"test": "yarn run build"
},
"dependencies": {
"@mikro-orm/cli": "6.0.0-dev.187",
"@mikro-orm/core": "6.0.0-dev.187",
"@mikro-orm/entity-generator": "6.0.0-dev.187",
"@mikro-orm/knex": "6.0.0-dev.187",
"@mikro-orm/migrations": "6.0.0-dev.187",
"@mikro-orm/reflection": "6.0.0-dev.187",
"@mikro-orm/sqlite": "6.0.0-dev.187",
"@mikro-orm/cli": "6.0.0-dev.220",
"@mikro-orm/core": "6.0.0-dev.220",
"@mikro-orm/entity-generator": "6.0.0-dev.220",
"@mikro-orm/knex": "6.0.0-dev.220",
"@mikro-orm/migrations": "6.0.0-dev.220",
"@mikro-orm/reflection": "6.0.0-dev.220",
"@mikro-orm/sqlite": "6.0.0-dev.220",
"graphql": "16.8.1",
"graphql-yoga": "5.0.0",
"tslib": "2.6.2"
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.26.2",
"@types/eslint": "^8.44.7",
"@types/jest": "^29.5.8",
"@types/node": "^20.9.1",
"@typescript-eslint/eslint-plugin": "^6.11.0",
"@types/jest": "^29.5.10",
"@types/node": "^20.10.0",
"@typescript-eslint/eslint-plugin": "^6.12.0",
"eslint": "^8.54.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-standard-with-typescript": "^40.0.0",
Expand All @@ -44,11 +44,11 @@
"rimraf": "^5.0.5",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"typescript": "^5.2.2"
"typescript": "^5.3.2"
},
"lint-staged": {
"*.ts": [
"eslint \"packages/**/*.ts\" \"examples/**/*.ts\" --fix"
]
"*.{js,jsx}": ["prettier --write", "eslint --fix --quiet --config .eslintrc.js --resolve-plugins-relative-to .", "git add"],
"*.{ts,tsx}": ["prettier --write", "eslint --fix --quiet --config .eslintrc.js --resolve-plugins-relative-to .", "git add"],
"*.{scss,scss,css,md,html}": ["prettier --write", "git add"]
}
}
9 changes: 6 additions & 3 deletions packages/find/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,17 @@
"testEnvironment": "node",
"preset": "ts-jest",
"collectCoverage": true,
"testPathIgnorePatterns": ["/node_modules/", "/dist/"]
"testPathIgnorePatterns": [
"/node_modules/",
"/dist/"
]
},
"publishConfig": {
"access": "public"
},
"devDependencies": {
"@mikro-orm/core": "6.0.0-dev.187",
"@mikro-orm/sqlite": "6.0.0-dev.187"
"@mikro-orm/core": "6.0.0-dev.220",
"@mikro-orm/sqlite": "6.0.0-dev.220"
},
"peerDependencies": {
"@mikro-orm/core": "^6.0.0"
Expand Down
17 changes: 11 additions & 6 deletions packages/find/src/EntityDataLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,24 @@ import {
type EntityName,
type EntityKey,
type Loaded,
type EntityProps,
type ExpandProperty,
type ExpandScalar,
type FilterItemValue,
type ExpandQuery,
type Scalar,
} from "@mikro-orm/core";
import DataLoader from "dataloader";
import { type DataloaderFind, groupFindQueries, assertHasNewFilterAndMapKey } from "./findDataloader";
import type { EntityProps, ExpandProperty, ExpandScalar, FilterValue2, Query, Scalar } from "@mikro-orm/core/typings";

export interface OperatorMapDataloader<T> {
// $and?: Query<T>[];
$or?: Array<Query<T>>;
// $and?: ExpandQuery<T>[];
$or?: Array<ExpandQuery<T>>;
// $eq?: ExpandScalar<T> | ExpandScalar<T>[];
// $ne?: ExpandScalar<T>;
// $in?: ExpandScalar<T>[];
// $nin?: ExpandScalar<T>[];
// $not?: Query<T>;
// $not?: ExpandQuery<T>;
// $gt?: ExpandScalar<T>;
// $gte?: ExpandScalar<T>;
// $lt?: ExpandScalar<T>;
Expand All @@ -40,8 +45,8 @@ export interface OperatorMapDataloader<T> {
}

export type FilterValueDataloader<T> =
/* OperatorMapDataloader<FilterValue2<T>> | */
FilterValue2<T> | FilterValue2<T>[] | null;
/* OperatorMapDataloader<FilterItemValue<T>> | */
FilterItemValue<T> | FilterItemValue<T>[] | null;

export type QueryDataloader<T> = T extends object
? T extends Scalar
Expand Down
Loading

0 comments on commit a1a0fff

Please sign in to comment.