@nest-boot/graphql 6.0.0-alpha.2 → 6.0.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.
- package/dist/graphql.exception-filter.d.ts +5 -3
- package/dist/graphql.exception-filter.js +4 -2
- package/dist/graphql.exception-filter.js.map +1 -1
- package/dist/graphql.module.d.ts +3 -0
- package/dist/graphql.module.js +27 -5
- package/dist/graphql.module.js.map +1 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -6
- package/dist/index.js.map +1 -1
- package/dist/interfaces/cost-response.interface.d.ts +10 -0
- package/dist/interfaces/{connection.interface.js → cost-response.interface.js} +1 -1
- package/dist/interfaces/cost-response.interface.js.map +1 -0
- package/dist/interfaces/graphql-module-options.interface.d.ts +8 -11
- package/dist/interfaces/index.d.ts +1 -4
- package/dist/interfaces/index.js +1 -4
- package/dist/interfaces/index.js.map +1 -1
- package/dist/plugins/complexity.plugin.d.ts +9 -8
- package/dist/plugins/complexity.plugin.js +94 -62
- package/dist/plugins/complexity.plugin.js.map +1 -1
- package/dist/plugins/logging.plugin.d.ts +7 -0
- package/dist/plugins/logging.plugin.js +48 -0
- package/dist/plugins/logging.plugin.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +22 -31
- package/dist/connection.builder.d.ts +0 -24
- package/dist/connection.builder.js +0 -122
- package/dist/connection.builder.js.map +0 -1
- package/dist/connection.service.d.ts +0 -10
- package/dist/connection.service.js +0 -147
- package/dist/connection.service.js.map +0 -1
- package/dist/dtos/index.d.ts +0 -1
- package/dist/dtos/index.js +0 -18
- package/dist/dtos/index.js.map +0 -1
- package/dist/dtos/page-info.object.d.ts +0 -6
- package/dist/dtos/page-info.object.js +0 -36
- package/dist/dtos/page-info.object.js.map +0 -1
- package/dist/entity.data-loader.d.ts +0 -7
- package/dist/entity.data-loader.js +0 -18
- package/dist/entity.data-loader.js.map +0 -1
- package/dist/enums/index.d.ts +0 -2
- package/dist/enums/index.js +0 -19
- package/dist/enums/index.js.map +0 -1
- package/dist/enums/order-direction.enum.d.ts +0 -4
- package/dist/enums/order-direction.enum.js +0 -11
- package/dist/enums/order-direction.enum.js.map +0 -1
- package/dist/enums/paging-type.enum.d.ts +0 -4
- package/dist/enums/paging-type.enum.js +0 -9
- package/dist/enums/paging-type.enum.js.map +0 -1
- package/dist/interfaces/connection-args.interface.d.ts +0 -9
- package/dist/interfaces/connection-args.interface.js +0 -3
- package/dist/interfaces/connection-args.interface.js.map +0 -1
- package/dist/interfaces/connection.interface.d.ts +0 -9
- package/dist/interfaces/connection.interface.js.map +0 -1
- package/dist/interfaces/order-field.type.d.ts +0 -8
- package/dist/interfaces/order-field.type.js +0 -3
- package/dist/interfaces/order-field.type.js.map +0 -1
- package/dist/interfaces/order.interface.d.ts +0 -6
- package/dist/interfaces/order.interface.js +0 -3
- package/dist/interfaces/order.interface.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/utils/cursor.d.ts +0 -6
- package/dist/utils/cursor.js +0 -30
- package/dist/utils/cursor.js.map +0 -1
- package/dist/utils/get-paging-type.d.ts +0 -3
- package/dist/utils/get-paging-type.js +0 -21
- package/dist/utils/get-paging-type.js.map +0 -1
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.js +0 -19
- package/dist/utils/index.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nest-boot/graphql",
|
|
3
|
-
"version": "6.0.0-
|
|
3
|
+
"version": "6.0.0-beta.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "d4rkcr0w <me@d4rkcr0w.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -14,47 +14,50 @@
|
|
|
14
14
|
"dist"
|
|
15
15
|
],
|
|
16
16
|
"scripts": {
|
|
17
|
-
"build": "
|
|
17
|
+
"build": "tsc -p tsconfig.build.json",
|
|
18
18
|
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
|
|
19
|
-
"dev": "
|
|
19
|
+
"dev": "tsc -w -p tsconfig.build.json",
|
|
20
20
|
"lint": "eslint \"{src,test}/**/*.ts\" --fix",
|
|
21
21
|
"test": "jest"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@apollo/server": "^4.
|
|
24
|
+
"@apollo/server": "^4.10.0",
|
|
25
25
|
"graphql-query-complexity": "^0.12.0",
|
|
26
26
|
"lodash": "^4.17.21"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@mikro-orm/core": "
|
|
30
|
-
"@nest-boot/
|
|
31
|
-
"@nest-boot/
|
|
32
|
-
"@nest-boot/
|
|
33
|
-
"@nest-boot/
|
|
29
|
+
"@mikro-orm/core": "^6.0.5",
|
|
30
|
+
"@nest-boot/common": "1.0.0-beta.1",
|
|
31
|
+
"@nest-boot/database": "6.0.0-beta.1",
|
|
32
|
+
"@nest-boot/eslint-config": "6.0.0-beta.1",
|
|
33
|
+
"@nest-boot/eslint-plugin": "6.0.0-beta.1",
|
|
34
34
|
"@nest-boot/tsconfig": "5.1.0",
|
|
35
35
|
"@nestjs/apollo": "^12.0.9",
|
|
36
|
-
"@nestjs/common": "^10.
|
|
37
|
-
"@nestjs/core": "^10.
|
|
36
|
+
"@nestjs/common": "^10.3.1",
|
|
37
|
+
"@nestjs/core": "^10.3.1",
|
|
38
38
|
"@nestjs/graphql": "^12.0.9",
|
|
39
39
|
"@types/express": "^4.17.17",
|
|
40
|
-
"@types/jest": "^29.5.
|
|
40
|
+
"@types/jest": "^29.5.11",
|
|
41
41
|
"@types/lodash": "^4.14.198",
|
|
42
|
-
"@types/node": "^20.6
|
|
42
|
+
"@types/node": "^20.11.6",
|
|
43
43
|
"dataloader": "^2.2.2",
|
|
44
44
|
"eslint": "^8.49.0",
|
|
45
45
|
"express": "^4.18.2",
|
|
46
46
|
"graphql": "^16.8.1",
|
|
47
|
+
"ioredis": "^5.3.2",
|
|
47
48
|
"jest": "^29.7.0",
|
|
48
49
|
"reflect-metadata": "^0.1.13",
|
|
49
50
|
"rxjs": "^7.8.1",
|
|
50
|
-
"ts-jest": "^29.1.
|
|
51
|
+
"ts-jest": "^29.1.2",
|
|
51
52
|
"typescript": "^5.2.2"
|
|
52
53
|
},
|
|
54
|
+
"optionalDependencies": {
|
|
55
|
+
"@nest-boot/logger": "6.0.0-beta.1"
|
|
56
|
+
},
|
|
53
57
|
"peerDependencies": {
|
|
54
|
-
"@mikro-orm/core": "
|
|
55
|
-
"@nest-boot/
|
|
56
|
-
"@nest-boot/
|
|
57
|
-
"@nest-boot/search": "6.0.0-alpha.2",
|
|
58
|
+
"@mikro-orm/core": "^6.0.0",
|
|
59
|
+
"@nest-boot/common": "1.0.0-beta.1",
|
|
60
|
+
"@nest-boot/database": "6.0.0-beta.1",
|
|
58
61
|
"@nestjs/apollo": "^12.0.0",
|
|
59
62
|
"@nestjs/common": "^10.0.0",
|
|
60
63
|
"@nestjs/core": "^10.0.0",
|
|
@@ -62,6 +65,7 @@
|
|
|
62
65
|
"dataloader": "^2.0.0",
|
|
63
66
|
"express": "^4.0.0",
|
|
64
67
|
"graphql": "^16.0.0",
|
|
68
|
+
"ioredis": "^5.3.2",
|
|
65
69
|
"reflect-metadata": "^0.1.13",
|
|
66
70
|
"rxjs": "^7.0.0"
|
|
67
71
|
},
|
|
@@ -74,19 +78,6 @@
|
|
|
74
78
|
"eslint --fix"
|
|
75
79
|
]
|
|
76
80
|
},
|
|
77
|
-
"jest": {
|
|
78
|
-
"moduleFileExtensions": [
|
|
79
|
-
"js",
|
|
80
|
-
"json",
|
|
81
|
-
"ts"
|
|
82
|
-
],
|
|
83
|
-
"testRegex": ".test.ts$",
|
|
84
|
-
"transform": {
|
|
85
|
-
"^.+\\.(t|j)s$": "ts-jest"
|
|
86
|
-
},
|
|
87
|
-
"coverageDirectory": "./coverage",
|
|
88
|
-
"testEnvironment": "node"
|
|
89
|
-
},
|
|
90
81
|
"volta": {
|
|
91
82
|
"extends": "../../package.json"
|
|
92
83
|
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { type Type } from "@nestjs/common";
|
|
2
|
-
import { type ConnectionArgsInterface, type ConnectionInterface, type EdgeInterface, type OrderFieldType, type OrderFieldValue, type OrderInterface } from "./interfaces";
|
|
3
|
-
interface ConnectionBuilderOptions<T> {
|
|
4
|
-
orderFields: OrderFieldValue<T>[];
|
|
5
|
-
}
|
|
6
|
-
interface ConnectionBuildResult<T extends {
|
|
7
|
-
id: number | string | bigint;
|
|
8
|
-
}> {
|
|
9
|
-
Connection: Type<ConnectionInterface<T>>;
|
|
10
|
-
ConnectionArgs: Type<ConnectionArgsInterface<T>>;
|
|
11
|
-
Edge: Type<EdgeInterface<T>>;
|
|
12
|
-
Order: Type<OrderInterface<T>>;
|
|
13
|
-
OrderField?: OrderFieldType<T>;
|
|
14
|
-
}
|
|
15
|
-
export declare class ConnectionBuilder<T extends {
|
|
16
|
-
id: number | string | bigint;
|
|
17
|
-
}> {
|
|
18
|
-
private readonly entityClass;
|
|
19
|
-
private readonly options;
|
|
20
|
-
private readonly entityName;
|
|
21
|
-
constructor(entityClass: Type<T>, options: ConnectionBuilderOptions<T>);
|
|
22
|
-
build(): ConnectionBuildResult<T>;
|
|
23
|
-
}
|
|
24
|
-
export {};
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.ConnectionBuilder = void 0;
|
|
16
|
-
const graphql_1 = require("@nestjs/graphql");
|
|
17
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
18
|
-
const dtos_1 = require("./dtos");
|
|
19
|
-
const enums_1 = require("./enums");
|
|
20
|
-
class ConnectionBuilder {
|
|
21
|
-
constructor(entityClass, options) {
|
|
22
|
-
this.entityClass = entityClass;
|
|
23
|
-
this.options = options;
|
|
24
|
-
this.entityName = entityClass.name;
|
|
25
|
-
}
|
|
26
|
-
build() {
|
|
27
|
-
let Edge = class Edge {
|
|
28
|
-
};
|
|
29
|
-
__decorate([
|
|
30
|
-
(0, graphql_1.Field)(() => this.entityClass),
|
|
31
|
-
__metadata("design:type", Object)
|
|
32
|
-
], Edge.prototype, "node", void 0);
|
|
33
|
-
__decorate([
|
|
34
|
-
(0, graphql_1.Field)({ complexity: 0 }),
|
|
35
|
-
__metadata("design:type", String)
|
|
36
|
-
], Edge.prototype, "cursor", void 0);
|
|
37
|
-
Edge = __decorate([
|
|
38
|
-
(0, graphql_1.ObjectType)(`${this.entityName}Edge`)
|
|
39
|
-
], Edge);
|
|
40
|
-
let Connection = class Connection {
|
|
41
|
-
};
|
|
42
|
-
__decorate([
|
|
43
|
-
(0, graphql_1.Field)(() => [Edge]),
|
|
44
|
-
__metadata("design:type", Array)
|
|
45
|
-
], Connection.prototype, "edges", void 0);
|
|
46
|
-
__decorate([
|
|
47
|
-
(0, graphql_1.Field)({ complexity: 0 }),
|
|
48
|
-
__metadata("design:type", dtos_1.PageInfo)
|
|
49
|
-
], Connection.prototype, "pageInfo", void 0);
|
|
50
|
-
__decorate([
|
|
51
|
-
(0, graphql_1.Field)(() => graphql_1.Int, { complexity: 0 }),
|
|
52
|
-
__metadata("design:type", Number)
|
|
53
|
-
], Connection.prototype, "totalCount", void 0);
|
|
54
|
-
Connection = __decorate([
|
|
55
|
-
(0, graphql_1.ObjectType)(`${this.entityName}Connection`, { isAbstract: true })
|
|
56
|
-
], Connection);
|
|
57
|
-
const OrderField = this.options.orderFields.length > 0
|
|
58
|
-
? this.options.orderFields.reduce((result, field) => ({
|
|
59
|
-
...result,
|
|
60
|
-
[lodash_1.default.snakeCase(field.replace(/_/g, ".")).toUpperCase()]: field,
|
|
61
|
-
}),
|
|
62
|
-
// eslint-disable-next-line @typescript-eslint/prefer-reduce-type-parameter
|
|
63
|
-
{})
|
|
64
|
-
: undefined;
|
|
65
|
-
if (typeof OrderField !== "undefined") {
|
|
66
|
-
(0, graphql_1.registerEnumType)(OrderField, {
|
|
67
|
-
name: `${this.entityName}OrderField`,
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
let Order = class Order {
|
|
71
|
-
};
|
|
72
|
-
__decorate([
|
|
73
|
-
(0, graphql_1.Field)(() => OrderField ?? String),
|
|
74
|
-
__metadata("design:type", String)
|
|
75
|
-
], Order.prototype, "field", void 0);
|
|
76
|
-
__decorate([
|
|
77
|
-
(0, graphql_1.Field)(() => enums_1.OrderDirection),
|
|
78
|
-
__metadata("design:type", String)
|
|
79
|
-
], Order.prototype, "direction", void 0);
|
|
80
|
-
Order = __decorate([
|
|
81
|
-
(0, graphql_1.InputType)(`${this.entityName}Order`)
|
|
82
|
-
], Order);
|
|
83
|
-
let ConnectionArgs = class ConnectionArgs {
|
|
84
|
-
};
|
|
85
|
-
__decorate([
|
|
86
|
-
(0, graphql_1.Field)({ nullable: true }),
|
|
87
|
-
__metadata("design:type", String)
|
|
88
|
-
], ConnectionArgs.prototype, "query", void 0);
|
|
89
|
-
__decorate([
|
|
90
|
-
(0, graphql_1.Field)(() => graphql_1.Int, { nullable: true }),
|
|
91
|
-
__metadata("design:type", Number)
|
|
92
|
-
], ConnectionArgs.prototype, "first", void 0);
|
|
93
|
-
__decorate([
|
|
94
|
-
(0, graphql_1.Field)(() => graphql_1.Int, { nullable: true }),
|
|
95
|
-
__metadata("design:type", Number)
|
|
96
|
-
], ConnectionArgs.prototype, "last", void 0);
|
|
97
|
-
__decorate([
|
|
98
|
-
(0, graphql_1.Field)({ nullable: true }),
|
|
99
|
-
__metadata("design:type", String)
|
|
100
|
-
], ConnectionArgs.prototype, "after", void 0);
|
|
101
|
-
__decorate([
|
|
102
|
-
(0, graphql_1.Field)({ nullable: true }),
|
|
103
|
-
__metadata("design:type", String)
|
|
104
|
-
], ConnectionArgs.prototype, "before", void 0);
|
|
105
|
-
__decorate([
|
|
106
|
-
(0, graphql_1.Field)(() => Order, { nullable: true }),
|
|
107
|
-
__metadata("design:type", Order)
|
|
108
|
-
], ConnectionArgs.prototype, "orderBy", void 0);
|
|
109
|
-
ConnectionArgs = __decorate([
|
|
110
|
-
(0, graphql_1.ArgsType)()
|
|
111
|
-
], ConnectionArgs);
|
|
112
|
-
return {
|
|
113
|
-
Connection,
|
|
114
|
-
ConnectionArgs,
|
|
115
|
-
Edge,
|
|
116
|
-
Order,
|
|
117
|
-
OrderField,
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
exports.ConnectionBuilder = ConnectionBuilder;
|
|
122
|
-
//# sourceMappingURL=connection.builder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"connection.builder.js","sourceRoot":"","sources":["../src/connection.builder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,6CAOyB;AACzB,oDAAuB;AAEvB,iCAAkC;AAClC,mCAAyC;AAuBzC,MAAa,iBAAiB;IAG5B,YACmB,WAAoB,EACpB,OAAoC;QADpC,gBAAW,GAAX,WAAW,CAAS;QACpB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|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type EntityClass, type FilterQuery } from "@mikro-orm/core";
|
|
2
|
-
import { SearchService } from "@nest-boot/search";
|
|
3
|
-
import { type ConnectionArgsInterface, type ConnectionInterface } from "./interfaces";
|
|
4
|
-
export declare class ConnectionService {
|
|
5
|
-
private readonly searchService;
|
|
6
|
-
constructor(searchService: SearchService);
|
|
7
|
-
get<E extends {
|
|
8
|
-
id: string | number | bigint;
|
|
9
|
-
}>(entityClass: EntityClass<E>, args: ConnectionArgsInterface<E>, where?: FilterQuery<E>): Promise<ConnectionInterface<E>>;
|
|
10
|
-
}
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.ConnectionService = void 0;
|
|
16
|
-
const core_1 = require("@mikro-orm/core");
|
|
17
|
-
const search_1 = require("@nest-boot/search");
|
|
18
|
-
const common_1 = require("@nestjs/common");
|
|
19
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
20
|
-
const enums_1 = require("./enums");
|
|
21
|
-
const utils_1 = require("./utils");
|
|
22
|
-
function get(object, path) {
|
|
23
|
-
const keys = path.split(".");
|
|
24
|
-
let value = object;
|
|
25
|
-
// eslint-disable-next-line no-unreachable-loop
|
|
26
|
-
for (const key of keys) {
|
|
27
|
-
if (value[key] instanceof core_1.Reference) {
|
|
28
|
-
value = value[key].getEntity();
|
|
29
|
-
}
|
|
30
|
-
else if (lodash_1.default.isObject(value) && key in value) {
|
|
31
|
-
value = value[key];
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
break;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return value;
|
|
38
|
-
}
|
|
39
|
-
let ConnectionService = class ConnectionService {
|
|
40
|
-
constructor(searchService) {
|
|
41
|
-
this.searchService = searchService;
|
|
42
|
-
}
|
|
43
|
-
async get(entityClass, args, where) {
|
|
44
|
-
// 提取集合参数
|
|
45
|
-
const { first, last, after, before, query = "", orderBy = { field: "createdAt", direction: enums_1.OrderDirection.ASC }, } = args;
|
|
46
|
-
const limit = first ?? last ?? 0;
|
|
47
|
-
const cursor = after != null
|
|
48
|
-
? new utils_1.Cursor(after)
|
|
49
|
-
: before != null
|
|
50
|
-
? new utils_1.Cursor(before)
|
|
51
|
-
: undefined;
|
|
52
|
-
const pagingType = (0, utils_1.getPagingType)(args);
|
|
53
|
-
const idWhere = (typeof cursor?.id !== "undefined"
|
|
54
|
-
? // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
55
|
-
{
|
|
56
|
-
id: {
|
|
57
|
-
[pagingType === enums_1.PagingType.FORWARD ? "$gt" : "$lt"]: cursor.id,
|
|
58
|
-
},
|
|
59
|
-
}
|
|
60
|
-
: undefined);
|
|
61
|
-
const cursorWhere = typeof orderBy !== "undefined" && typeof cursor?.value !== "undefined"
|
|
62
|
-
? {
|
|
63
|
-
$or: [
|
|
64
|
-
lodash_1.default.set({}, orderBy.field, (pagingType === enums_1.PagingType.FORWARD
|
|
65
|
-
? orderBy.direction === enums_1.OrderDirection.ASC
|
|
66
|
-
: orderBy.direction === enums_1.OrderDirection.DESC)
|
|
67
|
-
? { $gt: cursor.value }
|
|
68
|
-
: { $lt: cursor.value }),
|
|
69
|
-
typeof idWhere !== "undefined"
|
|
70
|
-
? {
|
|
71
|
-
$and: [
|
|
72
|
-
lodash_1.default.set({}, orderBy.field, { $eq: cursor.value }),
|
|
73
|
-
idWhere,
|
|
74
|
-
],
|
|
75
|
-
}
|
|
76
|
-
: lodash_1.default.set({}, orderBy.field, { $eq: cursor.value }),
|
|
77
|
-
],
|
|
78
|
-
}
|
|
79
|
-
: idWhere;
|
|
80
|
-
// 搜索结果
|
|
81
|
-
const [[results], [, totalCount]] = await Promise.all([
|
|
82
|
-
this.searchService.search(entityClass, query, {
|
|
83
|
-
where: (typeof cursorWhere !== "undefined"
|
|
84
|
-
? { $and: [where, cursorWhere] }
|
|
85
|
-
: where),
|
|
86
|
-
populate: [orderBy.field],
|
|
87
|
-
limit: limit + 1,
|
|
88
|
-
orderBy: [
|
|
89
|
-
lodash_1.default.set({}, orderBy.field, (pagingType === enums_1.PagingType.FORWARD
|
|
90
|
-
? orderBy.direction === enums_1.OrderDirection.ASC
|
|
91
|
-
: orderBy.direction === enums_1.OrderDirection.DESC)
|
|
92
|
-
? core_1.QueryOrder.ASC
|
|
93
|
-
: core_1.QueryOrder.DESC),
|
|
94
|
-
{
|
|
95
|
-
id: (pagingType === enums_1.PagingType.FORWARD
|
|
96
|
-
? orderBy.direction === enums_1.OrderDirection.ASC
|
|
97
|
-
: orderBy.direction === enums_1.OrderDirection.DESC)
|
|
98
|
-
? core_1.QueryOrder.ASC
|
|
99
|
-
: core_1.QueryOrder.DESC,
|
|
100
|
-
},
|
|
101
|
-
],
|
|
102
|
-
}),
|
|
103
|
-
this.searchService.search(entityClass, query, {
|
|
104
|
-
where,
|
|
105
|
-
limit: 0,
|
|
106
|
-
}),
|
|
107
|
-
]);
|
|
108
|
-
// 重新排序结果
|
|
109
|
-
const entities = pagingType === enums_1.PagingType.FORWARD ? results : results.reverse();
|
|
110
|
-
// 根据结果生成 edges
|
|
111
|
-
const edges = (entities.length > limit
|
|
112
|
-
? pagingType === enums_1.PagingType.FORWARD
|
|
113
|
-
? entities.slice(0, -1)
|
|
114
|
-
: entities.slice(1)
|
|
115
|
-
: entities).map((node) => ({
|
|
116
|
-
node,
|
|
117
|
-
cursor: new utils_1.Cursor({
|
|
118
|
-
id: node.id,
|
|
119
|
-
value: typeof orderBy !== "undefined" ? get(node, orderBy.field) : undefined,
|
|
120
|
-
}).toString(),
|
|
121
|
-
}));
|
|
122
|
-
// 返回集合
|
|
123
|
-
return {
|
|
124
|
-
totalCount,
|
|
125
|
-
pageInfo: {
|
|
126
|
-
...(pagingType === enums_1.PagingType.FORWARD
|
|
127
|
-
? {
|
|
128
|
-
hasNextPage: entities.length > limit,
|
|
129
|
-
hasPreviousPage: after != null,
|
|
130
|
-
}
|
|
131
|
-
: {
|
|
132
|
-
hasNextPage: before != null,
|
|
133
|
-
hasPreviousPage: entities.length > limit,
|
|
134
|
-
}),
|
|
135
|
-
startCursor: edges[0]?.cursor,
|
|
136
|
-
endCursor: edges[edges.length - 1]?.cursor,
|
|
137
|
-
},
|
|
138
|
-
edges,
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
exports.ConnectionService = ConnectionService;
|
|
143
|
-
exports.ConnectionService = ConnectionService = __decorate([
|
|
144
|
-
(0, common_1.Injectable)(),
|
|
145
|
-
__metadata("design:paramtypes", [search_1.SearchService])
|
|
146
|
-
], ConnectionService);
|
|
147
|
-
//# sourceMappingURL=connection.service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"connection.service.js","sourceRoot":"","sources":["../src/connection.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,0CAMyB;AACzB,8CAAkD;AAClD,2CAA4C;AAC5C,oDAAuB;AAEvB,mC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AAU,GAAE;qCAEiC,sBAAa;GAD9C,iBAAiB,CAkJ7B"}
|
package/dist/dtos/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./page-info.object";
|
package/dist/dtos/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./page-info.object"), exports);
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
package/dist/dtos/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dtos/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.PageInfo = void 0;
|
|
13
|
-
const graphql_1 = require("@nestjs/graphql");
|
|
14
|
-
let PageInfo = class PageInfo {
|
|
15
|
-
};
|
|
16
|
-
exports.PageInfo = PageInfo;
|
|
17
|
-
__decorate([
|
|
18
|
-
(0, graphql_1.Field)({ complexity: 0 }),
|
|
19
|
-
__metadata("design:type", Boolean)
|
|
20
|
-
], PageInfo.prototype, "hasNextPage", void 0);
|
|
21
|
-
__decorate([
|
|
22
|
-
(0, graphql_1.Field)({ complexity: 0 }),
|
|
23
|
-
__metadata("design:type", Boolean)
|
|
24
|
-
], PageInfo.prototype, "hasPreviousPage", void 0);
|
|
25
|
-
__decorate([
|
|
26
|
-
(0, graphql_1.Field)({ nullable: true, complexity: 0 }),
|
|
27
|
-
__metadata("design:type", String)
|
|
28
|
-
], PageInfo.prototype, "startCursor", void 0);
|
|
29
|
-
__decorate([
|
|
30
|
-
(0, graphql_1.Field)({ nullable: true, complexity: 0 }),
|
|
31
|
-
__metadata("design:type", String)
|
|
32
|
-
], PageInfo.prototype, "endCursor", void 0);
|
|
33
|
-
exports.PageInfo = PageInfo = __decorate([
|
|
34
|
-
(0, graphql_1.ObjectType)()
|
|
35
|
-
], PageInfo);
|
|
36
|
-
//# sourceMappingURL=page-info.object.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"page-info.object.js","sourceRoot":"","sources":["../../src/dtos/page-info.object.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAoD;AAG7C,IAAM,QAAQ,GAAd,MAAM,QAAQ;CAYpB,CAAA;AAZY,4BAAQ;AAEnB;IADC,IAAA,eAAK,EAAC,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;;6CACH;AAGtB;IADC,IAAA,eAAK,EAAC,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;;iDACC;AAG1B;IADC,IAAA,eAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;;6CACpB;AAGrB;IADC,IAAA,eAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;;2CACtB;mBAXR,QAAQ;IADpB,IAAA,oBAAU,GAAE;GACA,QAAQ,CAYpB"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.EntityDataLoader = void 0;
|
|
7
|
-
const dataloader_1 = __importDefault(require("dataloader"));
|
|
8
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
9
|
-
class EntityDataLoader extends dataloader_1.default {
|
|
10
|
-
constructor(repository) {
|
|
11
|
-
super(async (ids) => {
|
|
12
|
-
const results = [];
|
|
13
|
-
return lodash_1.default.sortBy(results, (result) => lodash_1.default.findIndex(ids, (id) => result.id === id));
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
exports.EntityDataLoader = EntityDataLoader;
|
|
18
|
-
//# sourceMappingURL=entity.data-loader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entity.data-loader.js","sourceRoot":"","sources":["../src/entity.data-loader.ts"],"names":[],"mappings":";;;;;;AACA,4DAAoC;AACpC,oDAAuB;AAEvB,MAAa,gBAA2C,SAAQ,oBAG/D;IACC,YAAY,UAA+B;QACzC,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YAClB,MAAM,OAAO,GAAQ,EAAE,CAAC;YAExB,OAAO,gBAAC,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE,CAClC,gBAAC,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAC3C,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAbD,4CAaC"}
|
package/dist/enums/index.d.ts
DELETED
package/dist/enums/index.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./order-direction.enum"), exports);
|
|
18
|
-
__exportStar(require("./paging-type.enum"), exports);
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
package/dist/enums/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/enums/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,qDAAmC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OrderDirection = void 0;
|
|
4
|
-
const graphql_1 = require("@nestjs/graphql");
|
|
5
|
-
var OrderDirection;
|
|
6
|
-
(function (OrderDirection) {
|
|
7
|
-
OrderDirection["ASC"] = "ASC";
|
|
8
|
-
OrderDirection["DESC"] = "DESC";
|
|
9
|
-
})(OrderDirection || (exports.OrderDirection = OrderDirection = {}));
|
|
10
|
-
(0, graphql_1.registerEnumType)(OrderDirection, { name: "OrderDirection" });
|
|
11
|
-
//# sourceMappingURL=order-direction.enum.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"order-direction.enum.js","sourceRoot":"","sources":["../../src/enums/order-direction.enum.ts"],"names":[],"mappings":";;;AAAA,6CAAmD;AAEnD,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,6BAAW,CAAA;IACX,+BAAa,CAAA;AACf,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAED,IAAA,0BAAgB,EAAC,cAAc,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PagingType = void 0;
|
|
4
|
-
var PagingType;
|
|
5
|
-
(function (PagingType) {
|
|
6
|
-
PagingType["FORWARD"] = "FORWARD";
|
|
7
|
-
PagingType["BACKWARD"] = "BACKWARD";
|
|
8
|
-
})(PagingType || (exports.PagingType = PagingType = {}));
|
|
9
|
-
//# sourceMappingURL=paging-type.enum.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paging-type.enum.js","sourceRoot":"","sources":["../../src/enums/paging-type.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,iCAAmB,CAAA;IACnB,mCAAqB,CAAA;AACvB,CAAC,EAHW,UAAU,0BAAV,UAAU,QAGrB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"connection-args.interface.js","sourceRoot":"","sources":["../../src/interfaces/connection-args.interface.ts"],"names":[],"mappings":""}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type PageInfo } from "../dtos";
|
|
2
|
-
import { type EdgeInterface } from "./edge.interface";
|
|
3
|
-
export interface ConnectionInterface<T extends {
|
|
4
|
-
id: string | number | bigint;
|
|
5
|
-
}> {
|
|
6
|
-
edges: EdgeInterface<T>[];
|
|
7
|
-
pageInfo: PageInfo;
|
|
8
|
-
totalCount: number;
|
|
9
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"connection.interface.js","sourceRoot":"","sources":["../../src/interfaces/connection.interface.ts"],"names":[],"mappings":""}
|