@lenne.tech/nest-server 9.0.12 → 9.0.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lenne.tech/nest-server",
3
- "version": "9.0.12",
3
+ "version": "9.0.13",
4
4
  "description": "Modern, fast, powerful Node.js web framework in TypeScript based on Nest with a GraphQL API and a connection to MongoDB (or other databases).",
5
5
  "keywords": [
6
6
  "node",
package/src/config.env.ts CHANGED
@@ -44,6 +44,9 @@ const config: { [env: string]: IServerOptions } = {
44
44
  },
45
45
  env: 'local',
46
46
  execAfterInit: 'npm run docs:bootstrap',
47
+ filter: {
48
+ maxLimit: null,
49
+ },
47
50
  graphQl: {
48
51
  driver: {
49
52
  debug: true,
@@ -97,6 +100,9 @@ const config: { [env: string]: IServerOptions } = {
97
100
  },
98
101
  env: 'development',
99
102
  execAfterInit: 'npm run docs:bootstrap',
103
+ filter: {
104
+ maxLimit: null,
105
+ },
100
106
  graphQl: {
101
107
  driver: {
102
108
  debug: true,
@@ -150,6 +156,9 @@ const config: { [env: string]: IServerOptions } = {
150
156
  },
151
157
  env: 'productive',
152
158
  execAfterInit: 'npm run docs:bootstrap',
159
+ filter: {
160
+ maxLimit: null,
161
+ },
153
162
  graphQl: {
154
163
  driver: {
155
164
  debug: false,
@@ -226,7 +226,7 @@ export function generateFindOptions<T = any>(
226
226
 
227
227
  // Config
228
228
  const config = {
229
- maxLimit: 100,
229
+ maxLimit: ConfigService.get('filter.maxLimit'),
230
230
  ...options,
231
231
  };
232
232
 
@@ -243,8 +243,8 @@ export function generateFindOptions<T = any>(
243
243
  }
244
244
 
245
245
  // Check limit
246
- if (!queryOptions.limit || queryOptions.limit > config.maxLimit) {
247
- queryOptions.limit = 25;
246
+ if (config.maxLimit && (!queryOptions.limit || queryOptions.limit > config.maxLimit)) {
247
+ queryOptions.limit = config.maxLimit;
248
248
  }
249
249
 
250
250
  // Prepare order
@@ -347,7 +347,7 @@ export function combinePlain(...args: Record<any, any>[]): any {
347
347
  * Get deep frozen object
348
348
  */
349
349
  export function deepFreeze(object: any) {
350
- if (typeof object !== 'object') {
350
+ if (!object || typeof object !== 'object') {
351
351
  return object;
352
352
  }
353
353
  for (const [key, value] of Object.entries(object)) {
@@ -78,6 +78,16 @@ export interface IServerOptions {
78
78
  */
79
79
  execAfterInit?: string;
80
80
 
81
+ /**
82
+ * Filter configuration and defaults
83
+ */
84
+ filter?: {
85
+ /**
86
+ * Maximum limit for the number of results
87
+ */
88
+ maxLimit?: number;
89
+ };
90
+
81
91
  /**
82
92
  * Configuration of the GraphQL module
83
93
  * see https://docs.nestjs.com/graphql/quick-start