@lenne.tech/nest-server 10.0.11 → 10.1.0
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/config.env.js +1 -0
- package/dist/config.env.js.map +1 -1
- package/dist/core/common/helpers/filter.helper.d.ts +9 -0
- package/dist/core/common/helpers/filter.helper.js +18 -1
- package/dist/core/common/helpers/filter.helper.js.map +1 -1
- package/dist/core/common/interfaces/server-options.interface.d.ts +1 -0
- package/dist/main.js +2 -1
- package/dist/main.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/config.env.ts +1 -0
- package/src/core/common/helpers/filter.helper.ts +34 -5
- package/src/core/common/interfaces/server-options.interface.ts +6 -0
- package/src/main.ts +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lenne.tech/nest-server",
|
|
3
|
-
"version": "10.0
|
|
3
|
+
"version": "10.1.0",
|
|
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
|
@@ -206,11 +206,11 @@ export function generateFilterQuery<T = any>(
|
|
|
206
206
|
case ComparisonOperatorEnum.REGEX:
|
|
207
207
|
result[field] = not
|
|
208
208
|
? {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
209
|
+
$not: {
|
|
210
|
+
$regex: new RegExp(value),
|
|
211
|
+
$options: options || '',
|
|
212
|
+
},
|
|
213
|
+
}
|
|
214
214
|
: { $regex: new RegExp(value), $options: options || '' };
|
|
215
215
|
break;
|
|
216
216
|
}
|
|
@@ -265,3 +265,32 @@ export function generateFindOptions(
|
|
|
265
265
|
|
|
266
266
|
return queryOptions;
|
|
267
267
|
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Merge FilterArgs and FilterQueries
|
|
271
|
+
*/
|
|
272
|
+
export function filterMerge<T = unknown>(
|
|
273
|
+
filterArgs: Partial<FilterArgs>,
|
|
274
|
+
filterQuery: Partial<FilterQuery<T>>,
|
|
275
|
+
options?: {
|
|
276
|
+
operator?: '$and' | '$or' | '$nor';
|
|
277
|
+
queryOptions?: Partial<QueryOptions>;
|
|
278
|
+
samples?: number;
|
|
279
|
+
},
|
|
280
|
+
): { filterQuery: FilterQuery<T>; queryOptions?: QueryOptions; samples?: number } {
|
|
281
|
+
const config = {
|
|
282
|
+
operator: '$and',
|
|
283
|
+
...options,
|
|
284
|
+
};
|
|
285
|
+
const converted = convertFilterArgsToQuery(filterArgs);
|
|
286
|
+
return {
|
|
287
|
+
filterQuery: (converted[0]
|
|
288
|
+
? { [config.operator]: [converted[0], filterQuery || {}] }
|
|
289
|
+
: filterQuery
|
|
290
|
+
) as FilterQuery<T>,
|
|
291
|
+
queryOptions: converted[1] || config.queryOptions
|
|
292
|
+
? { ...converted[1], ...config.queryOptions }
|
|
293
|
+
: undefined,
|
|
294
|
+
samples: config.samples,
|
|
295
|
+
};
|
|
296
|
+
}
|
|
@@ -277,6 +277,12 @@ export interface IServerOptions {
|
|
|
277
277
|
};
|
|
278
278
|
};
|
|
279
279
|
|
|
280
|
+
/**
|
|
281
|
+
* Hostname of the server
|
|
282
|
+
* default: localhost
|
|
283
|
+
*/
|
|
284
|
+
hostname?: string;
|
|
285
|
+
|
|
280
286
|
/**
|
|
281
287
|
* Ignore selections in fieldSelection
|
|
282
288
|
* [ConfigService must be integrated in ModuleService]
|
package/src/main.ts
CHANGED
|
@@ -54,7 +54,8 @@ async function bootstrap() {
|
|
|
54
54
|
server.enableCors();
|
|
55
55
|
|
|
56
56
|
// Start server on configured port
|
|
57
|
-
await server.listen(envConfig.port);
|
|
57
|
+
await server.listen(envConfig.port, envConfig.hostname);
|
|
58
|
+
console.debug(`Server startet at ${await server.getUrl()}`);
|
|
58
59
|
|
|
59
60
|
// Run command after server init
|
|
60
61
|
if (envConfig.execAfterInit) {
|