@lenne.tech/nest-server 8.6.9 → 8.6.10

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": "8.6.9",
3
+ "version": "8.6.10",
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/index.ts CHANGED
@@ -78,6 +78,15 @@ export * from './core/modules/auth/core-auth.module';
78
78
  export * from './core/modules/auth/core-auth.resolver';
79
79
  export * from './core/modules/auth/jwt.strategy';
80
80
 
81
+ // =====================================================================================================================
82
+ // Core - Modules - File
83
+ // =====================================================================================================================
84
+
85
+ export * from './core/modules/file/interfaces/file-service-options.interface';
86
+ export * from './core/modules/file/interfaces/file-upload.interface';
87
+ export * from './core/modules/file/core-file.service';
88
+ export * from './core/modules/file/file-info.output';
89
+
81
90
  // =====================================================================================================================
82
91
  // Core - Modules - User
83
92
  // =====================================================================================================================
@@ -51,7 +51,7 @@ export class FileController {
51
51
  })
52
52
  )
53
53
  uploadFiles(@UploadedFiles() files, @Body() fields: any) {
54
- console.log(JSON.stringify({ files, fields }, null, 2));
54
+ console.log('Saved file info', JSON.stringify({ files, fields }, null, 2));
55
55
  }
56
56
 
57
57
  /**
@@ -4,6 +4,7 @@ import * as fs from 'fs';
4
4
  import { createClient } from 'graphql-ws';
5
5
  import { jsonToGraphQLQuery } from 'json-to-graphql-query';
6
6
  import * as LightMyRequest from 'light-my-request';
7
+ import * as superagent from 'superagent';
7
8
  import * as supertest from 'supertest';
8
9
  import * as util from 'util';
9
10
  import * as ws from 'ws';
@@ -146,8 +147,9 @@ export class TestHelper {
146
147
 
147
148
  /**
148
149
  * Download file from URL
150
+ * @return Superagent response with additional data field containing the content of the file
149
151
  */
150
- download(url: string, token?: string) {
152
+ download(url: string, token?: string): Promise<superagent.Response & { data: string }> {
151
153
  return new Promise((resolve, reject) => {
152
154
  const request = supertest((this.app as INestApplication).getHttpServer()).get(url);
153
155
  if (token) {
@@ -166,9 +168,9 @@ export class TestHelper {
166
168
  err ? reject(err) : callback(null, null);
167
169
  });
168
170
  })
169
- .end((err, res: unknown) => {
170
- (res as Response & { data: string }).data = new Buffer(data, 'binary').toString();
171
- err ? reject(err) : resolve(res);
171
+ .end((err, res: superagent.Response) => {
172
+ (res as superagent.Response & { data: string }).data = new Buffer(data, 'binary').toString();
173
+ err ? reject(err) : resolve(res as superagent.Response & { data: string });
172
174
  });
173
175
  });
174
176
  }
@@ -480,7 +482,7 @@ export class TestHelper {
480
482
  processResponse(response, statusCode, log, logError) {
481
483
  // Log response
482
484
  if (log) {
483
- console.log(JSON.stringify(response, null, 2));
485
+ console.log('Response', JSON.stringify(response, null, 2));
484
486
  }
485
487
 
486
488
  // Log error