@lenne.tech/nest-server 11.7.3 → 11.8.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/core/common/interfaces/server-options.interface.d.ts +22 -0
- package/dist/core/modules/file/core-file.controller.d.ts +1 -0
- package/dist/core/modules/file/core-file.controller.js +22 -0
- package/dist/core/modules/file/core-file.controller.js.map +1 -1
- package/dist/core/modules/tus/core-tus.controller.d.ts +9 -0
- package/dist/core/modules/tus/core-tus.controller.js +85 -0
- package/dist/core/modules/tus/core-tus.controller.js.map +1 -0
- package/dist/core/modules/tus/core-tus.service.d.ts +30 -0
- package/dist/core/modules/tus/core-tus.service.js +284 -0
- package/dist/core/modules/tus/core-tus.service.js.map +1 -0
- package/dist/core/modules/tus/index.d.ts +4 -0
- package/dist/core/modules/tus/index.js +21 -0
- package/dist/core/modules/tus/index.js.map +1 -0
- package/dist/core/modules/tus/interfaces/tus-config.interface.d.ts +10 -0
- package/dist/core/modules/tus/interfaces/tus-config.interface.js +59 -0
- package/dist/core/modules/tus/interfaces/tus-config.interface.js.map +1 -0
- package/dist/core/modules/tus/tus.module.d.ts +21 -0
- package/dist/core/modules/tus/tus.module.js +99 -0
- package/dist/core/modules/tus/tus.module.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/server/modules/file/file.controller.d.ts +5 -7
- package/dist/server/modules/file/file.controller.js +3 -31
- package/dist/server/modules/file/file.controller.js.map +1 -1
- package/dist/server/server.module.js +3 -1
- package/dist/server/server.module.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +4 -1
- package/src/core/common/interfaces/server-options.interface.ts +154 -0
- package/src/core/modules/file/README.md +165 -0
- package/src/core/modules/file/core-file.controller.ts +27 -1
- package/src/core/modules/tus/INTEGRATION-CHECKLIST.md +176 -0
- package/src/core/modules/tus/README.md +439 -0
- package/src/core/modules/tus/core-tus.controller.ts +88 -0
- package/src/core/modules/tus/core-tus.service.ts +424 -0
- package/src/core/modules/tus/index.ts +5 -0
- package/src/core/modules/tus/interfaces/tus-config.interface.ts +107 -0
- package/src/core/modules/tus/tus.module.ts +187 -0
- package/src/index.ts +6 -0
- package/src/server/modules/file/file.controller.ts +14 -34
- package/src/server/server.module.ts +5 -1
|
@@ -0,0 +1,99 @@
|
|
|
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 TusModule_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.TusModule = exports.TUS_CONFIG = void 0;
|
|
14
|
+
const common_1 = require("@nestjs/common");
|
|
15
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
16
|
+
const core_tus_controller_1 = require("./core-tus.controller");
|
|
17
|
+
const core_tus_service_1 = require("./core-tus.service");
|
|
18
|
+
const tus_config_interface_1 = require("./interfaces/tus-config.interface");
|
|
19
|
+
exports.TUS_CONFIG = 'TUS_CONFIG';
|
|
20
|
+
let TusModule = TusModule_1 = class TusModule {
|
|
21
|
+
constructor(tusService) {
|
|
22
|
+
this.tusService = tusService;
|
|
23
|
+
}
|
|
24
|
+
async onModuleInit() {
|
|
25
|
+
if (TusModule_1.tusEnabled && this.tusService?.isEnabled()) {
|
|
26
|
+
TusModule_1.logger.log('TusModule ready');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
static getControllerClass() {
|
|
30
|
+
return this.customController || core_tus_controller_1.CoreTusController;
|
|
31
|
+
}
|
|
32
|
+
static forRoot(options = {}) {
|
|
33
|
+
const { config: rawConfig, controller } = options;
|
|
34
|
+
const config = (0, tus_config_interface_1.normalizeTusConfig)(rawConfig);
|
|
35
|
+
this.currentConfig = config;
|
|
36
|
+
this.customController = controller || null;
|
|
37
|
+
if (config === null) {
|
|
38
|
+
this.logger.debug('TUS uploads disabled');
|
|
39
|
+
this.tusEnabled = false;
|
|
40
|
+
return {
|
|
41
|
+
exports: [exports.TUS_CONFIG, core_tus_service_1.CoreTusService],
|
|
42
|
+
module: TusModule_1,
|
|
43
|
+
providers: [
|
|
44
|
+
{
|
|
45
|
+
provide: exports.TUS_CONFIG,
|
|
46
|
+
useValue: null,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
inject: [(0, mongoose_1.getConnectionToken)()],
|
|
50
|
+
provide: core_tus_service_1.CoreTusService,
|
|
51
|
+
useFactory: (connection) => {
|
|
52
|
+
const service = new core_tus_service_1.CoreTusService(connection);
|
|
53
|
+
service.configure(false);
|
|
54
|
+
return service;
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
this.tusEnabled = true;
|
|
61
|
+
return {
|
|
62
|
+
controllers: [this.getControllerClass()],
|
|
63
|
+
exports: [exports.TUS_CONFIG, core_tus_service_1.CoreTusService],
|
|
64
|
+
module: TusModule_1,
|
|
65
|
+
providers: [
|
|
66
|
+
{
|
|
67
|
+
provide: exports.TUS_CONFIG,
|
|
68
|
+
useValue: config,
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
inject: [(0, mongoose_1.getConnectionToken)(), exports.TUS_CONFIG],
|
|
72
|
+
provide: core_tus_service_1.CoreTusService,
|
|
73
|
+
useFactory: async (connection, tusConfig) => {
|
|
74
|
+
const service = new core_tus_service_1.CoreTusService(connection);
|
|
75
|
+
service.configure(tusConfig);
|
|
76
|
+
await service.onModuleInit();
|
|
77
|
+
return service;
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
static reset() {
|
|
84
|
+
this.tusEnabled = false;
|
|
85
|
+
this.currentConfig = null;
|
|
86
|
+
this.customController = null;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
exports.TusModule = TusModule;
|
|
90
|
+
TusModule.logger = new common_1.Logger(TusModule_1.name);
|
|
91
|
+
TusModule.tusEnabled = false;
|
|
92
|
+
TusModule.currentConfig = null;
|
|
93
|
+
TusModule.customController = null;
|
|
94
|
+
exports.TusModule = TusModule = TusModule_1 = __decorate([
|
|
95
|
+
(0, common_1.Global)(),
|
|
96
|
+
(0, common_1.Module)({}),
|
|
97
|
+
__metadata("design:paramtypes", [core_tus_service_1.CoreTusService])
|
|
98
|
+
], TusModule);
|
|
99
|
+
//# sourceMappingURL=tus.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tus.module.js","sourceRoot":"","sources":["../../../../src/core/modules/tus/tus.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAA2F;AAC3F,+CAAsD;AAItD,+DAA0D;AAC1D,yDAAoD;AACpD,4EAAuE;AAK1D,QAAA,UAAU,GAAG,YAAY,CAAC;AA2EhC,IAAM,SAAS,iBAAf,MAAM,SAAS;IAMpB,YAA6B,UAA2B;QAA3B,eAAU,GAAV,UAAU,CAAiB;IAAG,CAAC;IAE5D,KAAK,CAAC,YAAY;QAChB,IAAI,WAAS,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,EAAE,SAAS,EAAE,EAAE,CAAC;YACzD,WAAS,CAAC,MAAM,CAAC,GAAG,CAAC,iBAAiB,C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jB,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,kBAAU;oBACnB,QAAQ,EAAE,MAAM;iBACjB;gBACD;oBACE,MAAM,EAAE,CAAC,IAAA,6BAAkB,GAAE,EAAE,kBAAU,CAAC;oBAC1C,OAAO,EAAE,iCAAc;oBACvB,UAAU,EAAE,KAAK,EAAE,UAAsB,EAAE,SAAqB,EAAE,EAAE;wBAClE,MAAM,OAAO,GAAG,IAAI,iCAAc,CAAC,UAAU,CAAC,CAAC;wBAC/C,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;wBAE7B,MAAM,OAAO,CAAC,YAAY,EAAE,CAAC;wBAC7B,OAAO,OAAO,CAAC;oBACjB,CAAC;iBACF;aACF;SACF,CAAC;IACJ,CAAC;IAMD,MAAM,CAAC,KAAK;QACV,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC1B,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAC/B,CAAC;;AAlGU,8BAAS;AACL,gBAAM,GAAG,IAAI,eAAM,CAAC,WAAS,CAAC,IAAI,CAAC,AAA7B,CAA8B;AACpC,oBAAU,GAAG,KAAK,AAAR,CAAS;AACnB,uBAAa,GAAsB,IAAI,AAA1B,CAA2B;AACxC,0BAAgB,GAAmC,IAAI,AAAvC,CAAwC;oBAJ5D,SAAS;IAFrB,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC,EAAE,CAAC;qCAOiC,iCAAc;GAN7C,SAAS,CAmGrB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -125,6 +125,7 @@ export * from './core/modules/health-check/core-health-check.module';
|
|
|
125
125
|
export * from './core/modules/health-check/core-health-check.resolver';
|
|
126
126
|
export * from './core/modules/health-check/core-health-check.service';
|
|
127
127
|
export * from './core/modules/migrate';
|
|
128
|
+
export * from './core/modules/tus';
|
|
128
129
|
export * from './core/modules/user/core-user.model';
|
|
129
130
|
export * from './core/modules/user/core-user.service';
|
|
130
131
|
export * from './core/modules/user/inputs/core-user-create.input';
|
package/dist/index.js
CHANGED
|
@@ -140,6 +140,7 @@ __exportStar(require("./core/modules/health-check/core-health-check.module"), ex
|
|
|
140
140
|
__exportStar(require("./core/modules/health-check/core-health-check.resolver"), exports);
|
|
141
141
|
__exportStar(require("./core/modules/health-check/core-health-check.service"), exports);
|
|
142
142
|
__exportStar(require("./core/modules/migrate"), exports);
|
|
143
|
+
__exportStar(require("./core/modules/tus"), exports);
|
|
143
144
|
__exportStar(require("./core/modules/user/core-user.model"), exports);
|
|
144
145
|
__exportStar(require("./core/modules/user/core-user.service"), exports);
|
|
145
146
|
__exportStar(require("./core/modules/user/inputs/core-user-create.input"), exports);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAIA,gDAA8B;AAK9B,iEAA+C;AAC/C,qEAAmD;AACnD,kFAAgE;AAChE,kFAAgE;AAChE,sFAAoE;AACpE,6FAA2E;AAC3E,kFAAgE;AAChE,0FAAwE;AACxE,+EAA6D;AAC7D,gFAA8D;AAC9D,2EAAyD;AACzD,kFAAgE;AAChE,mFAAiE;AACjE,+EAA6D;AAC7D,4EAA0D;AAC1D,wEAAsD;AACtD,gEAA8C;AAC9C,sEAAoD;AACpD,kFAAgE;AAChE,sEAAoD;AACpD,sEAAoD;AACpD,uEAAqD;AACrD,kEAAgD;AAChD,yEAAuD;AACvD,oEAAkD;AAClD,sEAAoD;AACpD,uEAAqD;AACrD,sEAAoD;AACpD,qEAAmD;AACnD,qEAAmD;AACnD,6EAA2D;AAC3D,oEAAkD;AAClD,uEAAqD;AACrD,qEAAmD;AACnD,6EAA2D;AAC3D,wEAAsD;AACtD,oEAAkD;AAClD,2EAAyD;AACzD,kEAAgD;AAChD,wFAAsE;AACtE,wFAAsE;AACtE,4FAA0E;AAC1E,oGAAkF;AA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,wEAAsD;AACtD,oFAAkE;AAClE,6EAA2D;AAC3D,qGAAmF;AAMnF,qDAAmC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAIA,gDAA8B;AAK9B,iEAA+C;AAC/C,qEAAmD;AACnD,kFAAgE;AAChE,kFAAgE;AAChE,sFAAoE;AACpE,6FAA2E;AAC3E,kFAAgE;AAChE,0FAAwE;AACxE,+EAA6D;AAC7D,gFAA8D;AAC9D,2EAAyD;AACzD,kFAAgE;AAChE,mFAAiE;AACjE,+EAA6D;AAC7D,4EAA0D;AAC1D,wEAAsD;AACtD,gEAA8C;AAC9C,sEAAoD;AACpD,kFAAgE;AAChE,sEAAoD;AACpD,sEAAoD;AACpD,uEAAqD;AACrD,kEAAgD;AAChD,yEAAuD;AACvD,oEAAkD;AAClD,sEAAoD;AACpD,uEAAqD;AACrD,sEAAoD;AACpD,qEAAmD;AACnD,qEAAmD;AACnD,6EAA2D;AAC3D,oEAAkD;AAClD,uEAAqD;AACrD,qEAAmD;AACnD,6EAA2D;AAC3D,wEAAsD;AACtD,oEAAkD;AAClD,2EAAyD;AACzD,kEAAgD;AAChD,wFAAsE;AACtE,wFAAsE;AACtE,4FAA0E;AAC1E,oGAAkF;AAClF,qGAAmF;AACnF,qFAAmE;AACnE,qFAAmE;AACnE,2FAAyE;AACzE,4FAA0E;AAC1E,sFAAoE;AACpE,oFAAkE;AAClE,qFAAmE;AACnE,qFAAmE;AACnE,wEAAsD;AACtD,8EAA4D;AAC5D,uEAAqD;AACrD,4EAA0D;AAC1D,0EAAwD;AACxD,2EAAyD;AACzD,mEAAiD;AACjD,8EAA4D;AAC5D,oEAAkD;AAClD,oEAAkD;AAClD,uEAAqD;AACrD,wEAAsD;AACtD,gFAA8D;AAC9D,sEAAoD;AACpD,uEAAqD;AACrD,yEAAuD;AACvD,2EAAyD;AACzD,wEAAsD;AACtD,0EAAwD;AACxD,yEAAuD;AACvD,kFAAgE;AAChE,iEAA+C;AAC/C,2EAAyD;AACzD,8DAA4C;AAC5C,+DAA6C;AAC7C,qEAAmD;AACnD,yEAAuD;AACvD,uEAAqD;AACrD,6EAA2D;AAC3D,wEAAsD;AACtD,2EAAyD;AACzD,0EAAwD;AACxD,4EAA0D;AAC1D,iFAA+D;AAC/D,+EAA6D;AAC7D,mEAAiD;AAMjD,+EAA6D;AAC7D,2EAAyD;AACzD,sEAAoD;AACpD,uEAAqD;AACrD,yEAAuD;AACvD,iGAA+E;AAC/E,yFAAuE;AACvE,yFAAuE;AACvE,gGAA8E;AAC9E,wEAAsD;AACtD,0FAAwE;AACxE,yEAAuD;AACvD,qFAAmE;AACnE,qFAAmE;AACnE,yFAAuE;AACvE,0FAAwE;AACxE,2FAAyE;AACzE,uFAAqE;AACrE,sFAAoE;AACpE,iFAA+D;AAC/D,gGAA8E;AAC9E,sFAAoE;AACpE,8EAA4D;AAC5D,uEAAqD;AAMrD,6DAA2C;AAM3C,2EAAyD;AACzD,2EAAyD;AACzD,yEAAuD;AACvD,wEAAsD;AACtD,gGAA8E;AAC9E,uFAAqE;AAMrE,6FAA2E;AAC3E,2FAAyE;AACzE,uFAAqE;AACrE,yFAAuE;AACvE,wFAAsE;AAMtE,yDAAuC;AAMvC,qDAAmC;AAMnC,sEAAoD;AACpD,wEAAsD;AACtD,oFAAkE;AAClE,6EAA2D;AAC3D,qGAAmF;AAMnF,qDAAmC"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CoreFileInfo } from '../../../core/modules/file/core-file-info.model';
|
|
1
|
+
import { CoreFileController } from '../../../core/modules/file/core-file.controller';
|
|
3
2
|
import { FileService } from './file.service';
|
|
4
|
-
export declare class FileController {
|
|
5
|
-
|
|
3
|
+
export declare class FileController extends CoreFileController {
|
|
4
|
+
protected readonly fileService: FileService;
|
|
6
5
|
constructor(fileService: FileService);
|
|
7
6
|
uploadFile(file: Express.Multer.File): Promise<any>;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
deleteFile(id: string): Promise<CoreFileInfo>;
|
|
7
|
+
getFileInfo(id: string): Promise<import("../../..").CoreFileInfo>;
|
|
8
|
+
deleteFile(id: string): Promise<import("../../..").CoreFileInfo>;
|
|
11
9
|
}
|
|
@@ -18,9 +18,11 @@ const platform_express_1 = require("@nestjs/platform-express");
|
|
|
18
18
|
const stream_1 = require("stream");
|
|
19
19
|
const roles_decorator_1 = require("../../../core/common/decorators/roles.decorator");
|
|
20
20
|
const role_enum_1 = require("../../../core/common/enums/role.enum");
|
|
21
|
+
const core_file_controller_1 = require("../../../core/modules/file/core-file.controller");
|
|
21
22
|
const file_service_1 = require("./file.service");
|
|
22
|
-
let FileController = class FileController {
|
|
23
|
+
let FileController = class FileController extends core_file_controller_1.CoreFileController {
|
|
23
24
|
constructor(fileService) {
|
|
25
|
+
super(fileService);
|
|
24
26
|
this.fileService = fileService;
|
|
25
27
|
}
|
|
26
28
|
async uploadFile(file) {
|
|
@@ -35,27 +37,6 @@ let FileController = class FileController {
|
|
|
35
37
|
};
|
|
36
38
|
return await this.fileService.createFile(fileUpload);
|
|
37
39
|
}
|
|
38
|
-
async getFile(id, res) {
|
|
39
|
-
if (!id) {
|
|
40
|
-
throw new common_1.BadRequestException('Missing ID');
|
|
41
|
-
}
|
|
42
|
-
let file;
|
|
43
|
-
try {
|
|
44
|
-
file = await this.fileService.getFileInfo(id);
|
|
45
|
-
}
|
|
46
|
-
catch (e) {
|
|
47
|
-
console.error(e);
|
|
48
|
-
file = null;
|
|
49
|
-
}
|
|
50
|
-
if (!file) {
|
|
51
|
-
throw new common_1.NotFoundException('File not found');
|
|
52
|
-
}
|
|
53
|
-
const filestream = await this.fileService.getFileStream(id);
|
|
54
|
-
res.header('Content-Type', file.contentType || 'application/octet-stream');
|
|
55
|
-
res.header('Content-Disposition', `attachment; filename=${file.filename}`);
|
|
56
|
-
res.header('Cache-Control', 'max-age=31536000');
|
|
57
|
-
return filestream.pipe(res);
|
|
58
|
-
}
|
|
59
40
|
async getFileInfo(id) {
|
|
60
41
|
return await this.fileService.getFileInfo(id);
|
|
61
42
|
}
|
|
@@ -76,15 +57,6 @@ __decorate([
|
|
|
76
57
|
__metadata("design:paramtypes", [Object]),
|
|
77
58
|
__metadata("design:returntype", Promise)
|
|
78
59
|
], FileController.prototype, "uploadFile", null);
|
|
79
|
-
__decorate([
|
|
80
|
-
(0, common_1.Get)(':id'),
|
|
81
|
-
(0, roles_decorator_1.Roles)(role_enum_1.RoleEnum.ADMIN),
|
|
82
|
-
__param(0, (0, common_1.Param)('id')),
|
|
83
|
-
__param(1, (0, common_1.Res)()),
|
|
84
|
-
__metadata("design:type", Function),
|
|
85
|
-
__metadata("design:paramtypes", [String, Object]),
|
|
86
|
-
__metadata("design:returntype", Promise)
|
|
87
|
-
], FileController.prototype, "getFile", null);
|
|
88
60
|
__decorate([
|
|
89
61
|
(0, common_1.Get)('info/:id'),
|
|
90
62
|
(0, roles_decorator_1.Roles)(role_enum_1.RoleEnum.ADMIN),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.controller.js","sourceRoot":"","sources":["../../../../src/server/modules/file/file.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"file.controller.js","sourceRoot":"","sources":["../../../../src/server/modules/file/file.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CASwB;AACxB,+DAA2D;AAC3D,mCAAkC;AAElC,qFAAwE;AACxE,oEAAgE;AAChE,0FAAqF;AAErF,iDAA6C;AAgBtC,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,yCAAkB;IAIpD,YAAwC,WAAwB;QAC9D,KAAK,CAAC,WAAW,CAAC,CAAC;QADmB,gBAAW,GAAX,WAAW,CAAa;IAEhE,CAAC;IAQK,AAAN,KAAK,CAAC,UAAU,CAAiB,IAAyB;QACxD,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAA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C,CAAA;;;;gDAM5B;yBAnDU,cAAc;IAF1B,IAAA,mBAAU,EAAC,OAAO,CAAC;IACnB,IAAA,uBAAK,EAAC,oBAAQ,CAAC,KAAK,CAAC;qCAKiC,0BAAW;GAJrD,cAAc,CAoD1B"}
|
|
@@ -15,6 +15,7 @@ const any_scalar_1 = require("../core/common/scalars/any.scalar");
|
|
|
15
15
|
const date_scalar_1 = require("../core/common/scalars/date.scalar");
|
|
16
16
|
const json_scalar_1 = require("../core/common/scalars/json.scalar");
|
|
17
17
|
const core_auth_service_1 = require("../core/modules/auth/services/core-auth.service");
|
|
18
|
+
const tus_1 = require("../core/modules/tus");
|
|
18
19
|
const cron_jobs_service_1 = require("./common/services/cron-jobs.service");
|
|
19
20
|
const auth_controller_1 = require("./modules/auth/auth.controller");
|
|
20
21
|
const auth_module_1 = require("./modules/auth/auth.module");
|
|
@@ -27,7 +28,7 @@ exports.ServerModule = ServerModule;
|
|
|
27
28
|
exports.ServerModule = ServerModule = __decorate([
|
|
28
29
|
(0, common_1.Module)({
|
|
29
30
|
controllers: [server_controller_1.ServerController, auth_controller_1.AuthController],
|
|
30
|
-
exports: [core_module_1.CoreModule, auth_module_1.AuthModule, better_auth_module_1.BetterAuthModule, file_module_1.FileModule],
|
|
31
|
+
exports: [core_module_1.CoreModule, auth_module_1.AuthModule, better_auth_module_1.BetterAuthModule, file_module_1.FileModule, tus_1.TusModule],
|
|
31
32
|
imports: [
|
|
32
33
|
core_module_1.CoreModule.forRoot(core_auth_service_1.CoreAuthService, auth_module_1.AuthModule.forRoot(config_env_1.default.jwt), config_env_1.default),
|
|
33
34
|
schedule_1.ScheduleModule.forRoot(),
|
|
@@ -37,6 +38,7 @@ exports.ServerModule = ServerModule = __decorate([
|
|
|
37
38
|
fallbackSecrets: [config_env_1.default.jwt?.secret, config_env_1.default.jwt?.refresh?.secret],
|
|
38
39
|
}),
|
|
39
40
|
file_module_1.FileModule,
|
|
41
|
+
tus_1.TusModule.forRoot(),
|
|
40
42
|
],
|
|
41
43
|
providers: [any_scalar_1.Any, cron_jobs_service_1.CronJobs, date_scalar_1.DateScalar, json_scalar_1.JSON],
|
|
42
44
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.module.js","sourceRoot":"","sources":["../../src/server/server.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,+CAAkD;AAElD,8CAAsC;AACtC,gDAA4C;AAC5C,kEAAwD;AACxD,oEAAgE;AAChE,oEAA0D;AAC1D,uFAAkF;AAClF,2EAA+D;AAC/D,oEAAgE;AAChE,4DAAwD;AACxD,iFAA4E;AAC5E,4DAAwD;AACxD,2DAAuD;
|
|
1
|
+
{"version":3,"file":"server.module.js","sourceRoot":"","sources":["../../src/server/server.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,+CAAkD;AAElD,8CAAsC;AACtC,gDAA4C;AAC5C,kEAAwD;AACxD,oEAAgE;AAChE,oEAA0D;AAC1D,uFAAkF;AAClF,6CAAgD;AAChD,2EAA+D;AAC/D,oEAAgE;AAChE,4DAAwD;AACxD,iFAA4E;AAC5E,4DAAwD;AACxD,2DAAuD;AA4ChD,IAAM,YAAY,GAAlB,MAAM,YAAY;CAAG,CAAA;AAAf,oCAAY;uBAAZ,YAAY;IApCxB,IAAA,eAAM,EAAC;QAEN,WAAW,EAAE,CAAC,oCAAgB,EAAE,gCAAc,CAAC;QAG/C,OAAO,EAAE,CAAC,wBAAU,EAAE,wBAAU,EAAE,qCAAgB,EAAE,wBAAU,EAAE,eAAS,CAAC;QAG1E,OAAO,EAAE;YAGP,wBAAU,CAAC,OAAO,CAAC,mCAAe,EAAE,wBAAU,CAAC,OAAO,CAAC,oBAAS,CAAC,GAAG,CAAC,EAAE,oBAAS,CAAC;YAGjF,yBAAc,CAAC,OAAO,EAAE;YAIxB,wBAAU,CAAC,OAAO,CAAC,oBAAS,CAAC,GAAG,CAAC;YAIjC,qCAAgB,CAAC,OAAO,CAAC;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