itlab-internal-services 2.16.12 → 2.16.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/dist/classes/document/content-document.class.d.ts +2 -2
- package/dist/classes/fetch-options/content-options.class.d.ts +2 -2
- package/dist/hub-resource.enum.d.ts +0 -23
- package/dist/hub-resource.enum.js +1 -25
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -10
- package/dist/modules/comments/comments.controller.d.ts +3 -3
- package/dist/modules/comments/comments.controller.js +1 -1
- package/dist/modules/comments/comments.service.d.ts +3 -3
- package/dist/modules/comments/comments.service.js +1 -1
- package/dist/modules/services/providers/books/books.service.d.ts +5 -5
- package/dist/modules/services/providers/books/books.service.js +2 -2
- package/dist/modules/services/providers/changelog/changelog.service.d.ts +1 -14
- package/dist/modules/services/providers/conflicts/conflicts.service.d.ts +5 -15
- package/dist/modules/services/providers/conflicts/conflicts.service.js +2 -2
- package/dist/modules/services/providers/content/content-return-types.d.ts +5 -5
- package/dist/modules/services/providers/content/content.service.d.ts +7 -6
- package/dist/modules/services/providers/demo-hive/demo-hive.service.d.ts +5 -5
- package/dist/modules/services/providers/demo-hive/demo-hive.service.js +2 -2
- package/dist/modules/services/providers/events/events.service.d.ts +5 -5
- package/dist/modules/services/providers/events/events.service.js +2 -2
- package/dist/modules/services/providers/files/files.service.d.ts +9 -30
- package/dist/modules/services/providers/files/files.service.js +4 -4
- package/dist/modules/services/providers/mail/dtos/newsletter-issue-mail.dto.v1.d.ts +2 -2
- package/dist/modules/services/providers/newsletter/newsletter.service.d.ts +5 -5
- package/dist/modules/services/providers/newsletter/newsletter.service.js +2 -2
- package/dist/modules/services/providers/newsroom/newsroom.service.d.ts +5 -5
- package/dist/modules/services/providers/newsroom/newsroom.service.js +2 -2
- package/dist/modules/services/providers/notifications/notifications.service.d.ts +5 -18
- package/dist/modules/services/providers/notifications/notifications.service.js +5 -3
- package/dist/modules/services/providers/podcasts/podcasts.service.d.ts +5 -5
- package/dist/modules/services/providers/podcasts/podcasts.service.js +2 -2
- package/dist/modules/services/providers/quick-links/quick-links.service.d.ts +5 -17
- package/dist/modules/services/providers/quick-links/quick-links.service.js +2 -2
- package/dist/pipes/restricted-fields.pipe.js +3 -1
- package/package.json +23 -23
- package/dist/classes/document-updater.class.d.ts +0 -40
- package/dist/classes/document-updater.class.js +0 -58
- package/dist/factories/index.d.ts +0 -1
- package/dist/factories/index.js +0 -5
- package/dist/factories/virtuals.factory.d.ts +0 -80
- package/dist/factories/virtuals.factory.js +0 -172
- package/dist/functions/create-duplicate-checker.function.d.ts +0 -29
- package/dist/functions/create-duplicate-checker.function.js +0 -52
- package/dist/likeable.interface.d.ts +0 -42
- package/dist/likeable.interface.js +0 -48
- package/dist/modules/_old/comment/comment.controller.d.ts +0 -35
- package/dist/modules/_old/comment/comment.controller.js +0 -86
- package/dist/modules/_old/comment/comment.model.d.ts +0 -29
- package/dist/modules/_old/comment/comment.model.js +0 -43
- package/dist/modules/_old/comment/comment.module-definition.d.ts +0 -45
- package/dist/modules/_old/comment/comment.module-definition.js +0 -8
- package/dist/modules/_old/comment/comment.module.d.ts +0 -22
- package/dist/modules/_old/comment/comment.module.js +0 -71
- package/dist/modules/_old/comment/comment.service.d.ts +0 -54
- package/dist/modules/_old/comment/comment.service.js +0 -133
- package/dist/modules/_old/comment/index.d.ts +0 -3
- package/dist/modules/_old/comment/index.js +0 -9
- package/dist/modules/_old/content/content.module-definition.d.ts +0 -5
- package/dist/modules/_old/content/content.module-definition.js +0 -8
- package/dist/modules/_old/content/content.module.d.ts +0 -31
- package/dist/modules/_old/content/content.module.js +0 -60
- package/dist/modules/_old/content/content.service.d.ts +0 -50
- package/dist/modules/_old/content/content.service.js +0 -145
- package/dist/modules/_old/content/index.d.ts +0 -2
- package/dist/modules/_old/content/index.js +0 -7
- package/dist/modules/_old/database/database-module-options.interface.d.ts +0 -41
- package/dist/modules/_old/database/database-module-options.interface.js +0 -2
- package/dist/modules/_old/database/database.liveness-controller.d.ts +0 -27
- package/dist/modules/_old/database/database.liveness-controller.js +0 -80
- package/dist/modules/_old/database/database.module.d.ts +0 -41
- package/dist/modules/_old/database/database.module.js +0 -97
- package/dist/modules/_old/database/index.d.ts +0 -6
- package/dist/modules/_old/database/index.js +0 -13
- package/dist/modules/_old/database/lock-service/lock.schema.d.ts +0 -38
- package/dist/modules/_old/database/lock-service/lock.schema.js +0 -51
- package/dist/modules/_old/database/lock-service/lock.service.d.ts +0 -53
- package/dist/modules/_old/database/lock-service/lock.service.js +0 -103
- package/dist/modules/_old/database/model-service/dbs/hub-account.db.d.ts +0 -28
- package/dist/modules/_old/database/model-service/dbs/hub-account.db.js +0 -44
- package/dist/modules/_old/database/model-service/dbs/hub-books.db.d.ts +0 -23
- package/dist/modules/_old/database/model-service/dbs/hub-books.db.js +0 -45
- package/dist/modules/_old/database/model-service/dbs/hub-comments.db.d.ts +0 -29
- package/dist/modules/_old/database/model-service/dbs/hub-comments.db.js +0 -68
- package/dist/modules/_old/database/model-service/dbs/hub-content.db.d.ts +0 -24
- package/dist/modules/_old/database/model-service/dbs/hub-content.db.js +0 -49
- package/dist/modules/_old/database/model-service/dbs/hub-demo-hive.db.d.ts +0 -23
- package/dist/modules/_old/database/model-service/dbs/hub-demo-hive.db.js +0 -45
- package/dist/modules/_old/database/model-service/dbs/hub-events.db.d.ts +0 -24
- package/dist/modules/_old/database/model-service/dbs/hub-events.db.js +0 -49
- package/dist/modules/_old/database/model-service/dbs/hub-hackschool.db.d.ts +0 -60
- package/dist/modules/_old/database/model-service/dbs/hub-hackschool.db.js +0 -106
- package/dist/modules/_old/database/model-service/dbs/hub-newsroom.db.d.ts +0 -25
- package/dist/modules/_old/database/model-service/dbs/hub-newsroom.db.js +0 -53
- package/dist/modules/_old/database/model-service/dbs/hub-podcasts.db.d.ts +0 -23
- package/dist/modules/_old/database/model-service/dbs/hub-podcasts.db.js +0 -45
- package/dist/modules/_old/database/model-service/dbs/hub-team.db.d.ts +0 -22
- package/dist/modules/_old/database/model-service/dbs/hub-team.db.js +0 -41
- package/dist/modules/_old/database/model-service/dbs/hub-tech-radar.db.d.ts +0 -42
- package/dist/modules/_old/database/model-service/dbs/hub-tech-radar.db.js +0 -81
- package/dist/modules/_old/database/model-service/model.service.d.ts +0 -8465
- package/dist/modules/_old/database/model-service/model.service.js +0 -136
- package/dist/modules/_old/database/populate-service/populate.service.d.ts +0 -73
- package/dist/modules/_old/database/populate-service/populate.service.js +0 -163
- package/dist/modules/_old/database/service-mapper-service/service-mapper.service.d.ts +0 -32
- package/dist/modules/_old/database/service-mapper-service/service-mapper.service.js +0 -73
- package/dist/modules/_old/fetch/fetch.module.d.ts +0 -31
- package/dist/modules/_old/fetch/fetch.module.js +0 -60
- package/dist/modules/_old/fetch/fetch.service.d.ts +0 -153
- package/dist/modules/_old/fetch/fetch.service.js +0 -274
- package/dist/modules/_old/fetch/index.d.ts +0 -2
- package/dist/modules/_old/fetch/index.js +0 -7
- package/dist/modules/_old/index.d.ts +0 -5
- package/dist/modules/_old/index.js +0 -21
- package/dist/modules/_old/like/index.d.ts +0 -1
- package/dist/modules/_old/like/index.js +0 -5
- package/dist/modules/_old/like/like.controller.d.ts +0 -41
- package/dist/modules/_old/like/like.controller.js +0 -125
- package/dist/modules/_old/like/like.module-definition.d.ts +0 -20
- package/dist/modules/_old/like/like.module-definition.js +0 -8
- package/dist/modules/_old/like/like.module.d.ts +0 -21
- package/dist/modules/_old/like/like.module.js +0 -67
- package/dist/modules/_old/like/like.service.d.ts +0 -61
- package/dist/modules/_old/like/like.service.js +0 -103
- package/dist/viewable.interface.d.ts +0 -42
- package/dist/viewable.interface.js +0 -48
|
@@ -1,71 +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 CommentModule_1;
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.CommentModule = void 0;
|
|
11
|
-
const common_1 = require("@nestjs/common");
|
|
12
|
-
const swagger_1 = require("@nestjs/swagger");
|
|
13
|
-
const itlab_functions_1 = require("itlab-functions");
|
|
14
|
-
const comment_controller_1 = require("./comment.controller");
|
|
15
|
-
const comment_module_definition_1 = require("./comment.module-definition");
|
|
16
|
-
const comment_service_1 = require("./comment.service");
|
|
17
|
-
/**
|
|
18
|
-
* @class CommentModule
|
|
19
|
-
* @description
|
|
20
|
-
* A dynamic NestJS module that registers a comment controller and service scoped
|
|
21
|
-
* to a specific resource type, route, and ownership model.
|
|
22
|
-
*/
|
|
23
|
-
let CommentModule = CommentModule_1 = class CommentModule {
|
|
24
|
-
/**
|
|
25
|
-
* Registers a dynamically scoped comment controller based on the provided options.
|
|
26
|
-
*
|
|
27
|
-
* - Generates a custom route path and Swagger tag based on `routeScope`.
|
|
28
|
-
* - If no model is provided, no controller will be registered (service-only mode).
|
|
29
|
-
*
|
|
30
|
-
* @template T - The resource document type the comment module is tied to.
|
|
31
|
-
* @param options - Configuration values for routing, model binding, and ownership strategy.
|
|
32
|
-
* @returns A fully configured NestJS DynamicModule.
|
|
33
|
-
*/
|
|
34
|
-
static register(options) {
|
|
35
|
-
const controllers = [];
|
|
36
|
-
if (options.model) {
|
|
37
|
-
const { routeScope = [] } = options;
|
|
38
|
-
// Transform suffixes into a readable Swagger tag (e.g., "Comment Module - Posts")
|
|
39
|
-
const swaggerTag = ['Comment Module', ...routeScope.map((scope) => (0, itlab_functions_1.capitalize)(scope))].join(' -');
|
|
40
|
-
// Build the controller route path (e.g., "/comment/posts")
|
|
41
|
-
const controllerRoutePath = ['comment', ...routeScope].join('/');
|
|
42
|
-
/**
|
|
43
|
-
* A dynamically scoped CommentController for a specific resource.
|
|
44
|
-
*
|
|
45
|
-
* This controller uses a generated route path and custom Swagger tag,
|
|
46
|
-
* but otherwise inherits all base CommentController behavior.
|
|
47
|
-
*/
|
|
48
|
-
let CommentController = class CommentController extends comment_controller_1.CommentController {
|
|
49
|
-
};
|
|
50
|
-
CommentController = __decorate([
|
|
51
|
-
(0, swagger_1.ApiTags)(swaggerTag),
|
|
52
|
-
(0, common_1.Controller)(controllerRoutePath)
|
|
53
|
-
], CommentController);
|
|
54
|
-
controllers.push(CommentController);
|
|
55
|
-
}
|
|
56
|
-
return {
|
|
57
|
-
module: CommentModule_1,
|
|
58
|
-
controllers: controllers,
|
|
59
|
-
providers: [comment_service_1.CommentService, { provide: comment_module_definition_1.COMMENT_MODULE_OPTIONS_TOKEN, useValue: options }],
|
|
60
|
-
exports: [comment_service_1.CommentService],
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
exports.CommentModule = CommentModule;
|
|
65
|
-
exports.CommentModule = CommentModule = CommentModule_1 = __decorate([
|
|
66
|
-
(0, common_1.Module)({
|
|
67
|
-
controllers: [comment_controller_1.CommentController],
|
|
68
|
-
providers: [comment_service_1.CommentService],
|
|
69
|
-
exports: [comment_service_1.CommentService],
|
|
70
|
-
})
|
|
71
|
-
], CommentModule);
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { ConfigService } from '@nestjs/config';
|
|
2
|
-
import { LabContentRichtext } from 'itlab-functions';
|
|
3
|
-
import { Connection } from 'mongoose';
|
|
4
|
-
import { AuthenticationModuleOptions } from '../../authentication';
|
|
5
|
-
import { Comment } from './comment.model';
|
|
6
|
-
import { CommentModuleOptions } from './comment.module-definition';
|
|
7
|
-
/**
|
|
8
|
-
* @class CommentService
|
|
9
|
-
* @description
|
|
10
|
-
* Handles business logic for posting and deleting comments associated with a resource.
|
|
11
|
-
* Integrates with external/internal comment services and supports resource ownership validation.
|
|
12
|
-
*/
|
|
13
|
-
export declare class CommentService {
|
|
14
|
-
private readonly moduleOptions;
|
|
15
|
-
private readonly connection;
|
|
16
|
-
private readonly authOptions;
|
|
17
|
-
private readonly configService;
|
|
18
|
-
private readonly logger;
|
|
19
|
-
private readonly axiosInstance;
|
|
20
|
-
private readonly resource;
|
|
21
|
-
private readonly commentModel;
|
|
22
|
-
/**
|
|
23
|
-
* Initializes the CommentService with injected dependencies and constructs
|
|
24
|
-
* an axios client for internal comment service communication.
|
|
25
|
-
*
|
|
26
|
-
* @param moduleOptions - Configuration for comment handling (resource, model, ownership fields)
|
|
27
|
-
* @param connection - Optional Mongoose connection for fetching resource documents
|
|
28
|
-
* @param authOptions - Auth options including Kubernetes token for service calls
|
|
29
|
-
* @param configService - Global config service for environment settings
|
|
30
|
-
*/
|
|
31
|
-
constructor(moduleOptions: CommentModuleOptions, connection: Connection | undefined, authOptions: AuthenticationModuleOptions, configService: ConfigService);
|
|
32
|
-
/**
|
|
33
|
-
* Posts a comment to a given resource, with optional ownership metadata attached.
|
|
34
|
-
*
|
|
35
|
-
* - Validates that the resource exists if a model is defined.
|
|
36
|
-
* - Looks up `ownerId` or `ownerIds` for authorization use by downstream services.
|
|
37
|
-
*
|
|
38
|
-
* @param {string} resourceId - ID of the resource being commented on
|
|
39
|
-
* @param {string} accountId - ID of the user posting the comment
|
|
40
|
-
* @param {LabContentRichtext} comment - Comment content in rich-text format
|
|
41
|
-
* @returns {Promise<Comment>} - Resolves with the saved comment or throws an HTTP exception
|
|
42
|
-
*/
|
|
43
|
-
postComment(resourceId: string, accountId: string, comment: LabContentRichtext): Promise<Comment>;
|
|
44
|
-
/**
|
|
45
|
-
* Deletes all comments associated with the specified resource.
|
|
46
|
-
*
|
|
47
|
-
* - Primarily used for cleanup during resource deletion.
|
|
48
|
-
* - Logs success or failure, but does not throw exceptions on error.
|
|
49
|
-
*
|
|
50
|
-
* @param {string} resourceId - ID of the resource whose comments should be deleted
|
|
51
|
-
* @returns {void}
|
|
52
|
-
*/
|
|
53
|
-
delete(resourceId: string): void;
|
|
54
|
-
}
|
|
@@ -1,133 +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 __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
var CommentService_1;
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.CommentService = void 0;
|
|
17
|
-
const common_1 = require("@nestjs/common");
|
|
18
|
-
const config_1 = require("@nestjs/config");
|
|
19
|
-
const mongoose_1 = require("@nestjs/mongoose");
|
|
20
|
-
const class_validator_1 = require("class-validator");
|
|
21
|
-
const mongoose_2 = require("mongoose");
|
|
22
|
-
const create_internal_axios_client_function_1 = require("../../../functions/create-internal-axios-client.function");
|
|
23
|
-
const authentication_1 = require("../../authentication");
|
|
24
|
-
const comment_module_definition_1 = require("./comment.module-definition");
|
|
25
|
-
/**
|
|
26
|
-
* @class CommentService
|
|
27
|
-
* @description
|
|
28
|
-
* Handles business logic for posting and deleting comments associated with a resource.
|
|
29
|
-
* Integrates with external/internal comment services and supports resource ownership validation.
|
|
30
|
-
*/
|
|
31
|
-
let CommentService = CommentService_1 = class CommentService {
|
|
32
|
-
/**
|
|
33
|
-
* Initializes the CommentService with injected dependencies and constructs
|
|
34
|
-
* an axios client for internal comment service communication.
|
|
35
|
-
*
|
|
36
|
-
* @param moduleOptions - Configuration for comment handling (resource, model, ownership fields)
|
|
37
|
-
* @param connection - Optional Mongoose connection for fetching resource documents
|
|
38
|
-
* @param authOptions - Auth options including Kubernetes token for service calls
|
|
39
|
-
* @param configService - Global config service for environment settings
|
|
40
|
-
*/
|
|
41
|
-
constructor(moduleOptions, connection, authOptions, configService) {
|
|
42
|
-
this.moduleOptions = moduleOptions;
|
|
43
|
-
this.connection = connection;
|
|
44
|
-
this.authOptions = authOptions;
|
|
45
|
-
this.configService = configService;
|
|
46
|
-
this.logger = new common_1.Logger(CommentService_1.name);
|
|
47
|
-
this.resource = this.moduleOptions.resource;
|
|
48
|
-
// If a model is provided, bind the commentModel to allow ownership lookup
|
|
49
|
-
if (this.moduleOptions.model) {
|
|
50
|
-
this.commentModel = this.connection.model(this.moduleOptions.model.name, this.moduleOptions.model.schema);
|
|
51
|
-
}
|
|
52
|
-
const isProduction = this.configService.get('NODE_ENV') === 'production';
|
|
53
|
-
// Construct base URL conditionally based on environment.
|
|
54
|
-
const baseUrl = isProduction
|
|
55
|
-
? 'http://organisation-hub-comments-service.organisation-hub-services.svc.cluster.local:3000/internal/'
|
|
56
|
-
: 'https://services.svi-itlab.com/comments/internal/';
|
|
57
|
-
// Initialize axios instance with k8s token and appropriate URL.
|
|
58
|
-
this.axiosInstance = (0, create_internal_axios_client_function_1.createInternalAxiosClient)({
|
|
59
|
-
k8sToken: this.authOptions.k8sToken,
|
|
60
|
-
baseUrl: `${baseUrl}${this.resource}/`,
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Posts a comment to a given resource, with optional ownership metadata attached.
|
|
65
|
-
*
|
|
66
|
-
* - Validates that the resource exists if a model is defined.
|
|
67
|
-
* - Looks up `ownerId` or `ownerIds` for authorization use by downstream services.
|
|
68
|
-
*
|
|
69
|
-
* @param {string} resourceId - ID of the resource being commented on
|
|
70
|
-
* @param {string} accountId - ID of the user posting the comment
|
|
71
|
-
* @param {LabContentRichtext} comment - Comment content in rich-text format
|
|
72
|
-
* @returns {Promise<Comment>} - Resolves with the saved comment or throws an HTTP exception
|
|
73
|
-
*/
|
|
74
|
-
async postComment(resourceId, accountId, comment) {
|
|
75
|
-
var _a, _b, _c;
|
|
76
|
-
// Exit early if no model is defined (e.g., management context)
|
|
77
|
-
if (!(0, class_validator_1.isDefined)(this.commentModel)) {
|
|
78
|
-
this.logger.error('Kommentare können nicht vom Management aus erstellt werden');
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
// Ensure the referenced resource exists before allowing comments
|
|
82
|
-
const resourceDoc = await this.commentModel.findOne({ _id: resourceId });
|
|
83
|
-
if (!resourceDoc) {
|
|
84
|
-
throw new common_1.NotFoundException('Kommentar konnte nicht erstellt werden');
|
|
85
|
-
}
|
|
86
|
-
// Optionally extract ownerId or ownerIds from the resource document
|
|
87
|
-
const { ownerIdField, ownerIdsField } = this.moduleOptions;
|
|
88
|
-
const ownerId = ownerIdField ? resourceDoc[ownerIdField] : undefined;
|
|
89
|
-
const ownerIds = ownerIdsField ? resourceDoc[ownerIdsField] : undefined;
|
|
90
|
-
this.logger.log(`Posting comment for ${this.resource} (${resourceId}) by account ${accountId}`);
|
|
91
|
-
try {
|
|
92
|
-
const response = await this.axiosInstance.post(`${resourceId}/${accountId}`, comment, {
|
|
93
|
-
params: { ownerId, ownerIds },
|
|
94
|
-
});
|
|
95
|
-
this.logger.log(`Comment for ${this.resource} (${resourceId}) posted`);
|
|
96
|
-
return response.data;
|
|
97
|
-
}
|
|
98
|
-
catch (error) {
|
|
99
|
-
const axiosError = error;
|
|
100
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
101
|
-
this.logger.error(`Couldn't post comment for ${this.resource} (${resourceId}): ${(_a = axiosError.response) === null || _a === void 0 ? void 0 : _a.data}`);
|
|
102
|
-
throw new common_1.HttpException(((_b = axiosError.response) === null || _b === void 0 ? void 0 : _b.data) || 'Internal error', ((_c = axiosError.response) === null || _c === void 0 ? void 0 : _c.status) || 500);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Deletes all comments associated with the specified resource.
|
|
107
|
-
*
|
|
108
|
-
* - Primarily used for cleanup during resource deletion.
|
|
109
|
-
* - Logs success or failure, but does not throw exceptions on error.
|
|
110
|
-
*
|
|
111
|
-
* @param {string} resourceId - ID of the resource whose comments should be deleted
|
|
112
|
-
* @returns {void}
|
|
113
|
-
*/
|
|
114
|
-
delete(resourceId) {
|
|
115
|
-
this.logger.log(`Deleting all comments for ${this.resource} (${resourceId})`);
|
|
116
|
-
this.axiosInstance
|
|
117
|
-
.delete(resourceId)
|
|
118
|
-
.then(() => {
|
|
119
|
-
this.logger.log(`All comments for ${this.resource} (${resourceId}) deleted`);
|
|
120
|
-
})
|
|
121
|
-
.catch(({ response }) => {
|
|
122
|
-
this.logger.error(`Couldn't delete all comments for ${this.resource} (${resourceId}): ${JSON.stringify(response === null || response === void 0 ? void 0 : response.data)}`);
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
exports.CommentService = CommentService;
|
|
127
|
-
exports.CommentService = CommentService = CommentService_1 = __decorate([
|
|
128
|
-
(0, common_1.Injectable)(),
|
|
129
|
-
__param(0, (0, common_1.Inject)(comment_module_definition_1.COMMENT_MODULE_OPTIONS_TOKEN)),
|
|
130
|
-
__param(1, (0, mongoose_1.InjectConnection)()),
|
|
131
|
-
__param(2, (0, authentication_1.InjectAuthenticationOptions)()),
|
|
132
|
-
__metadata("design:paramtypes", [Object, mongoose_2.Connection, Object, config_1.ConfigService])
|
|
133
|
-
], CommentService);
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OldCommentService = exports.OldCommentModule = exports.OldComment = void 0;
|
|
4
|
-
var comment_model_1 = require("./comment.model");
|
|
5
|
-
Object.defineProperty(exports, "OldComment", { enumerable: true, get: function () { return comment_model_1.Comment; } });
|
|
6
|
-
var comment_module_1 = require("./comment.module");
|
|
7
|
-
Object.defineProperty(exports, "OldCommentModule", { enumerable: true, get: function () { return comment_module_1.CommentModule; } });
|
|
8
|
-
var comment_service_1 = require("./comment.service");
|
|
9
|
-
Object.defineProperty(exports, "OldCommentService", { enumerable: true, get: function () { return comment_service_1.CommentService; } });
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CONTENT_MODULE_RESOURCE_TOKEN = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Token used to inject ContentModule options into services or controllers if needed.
|
|
6
|
-
* Symbol is used to avoid accidental naming collisions across modules.
|
|
7
|
-
*/
|
|
8
|
-
exports.CONTENT_MODULE_RESOURCE_TOKEN = Symbol('CONTENT_MODULE_RESOURCE_TOKEN');
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { DynamicModule } from '@nestjs/common';
|
|
2
|
-
import { HubResource } from '../../../hub-resource.enum';
|
|
3
|
-
/**
|
|
4
|
-
* Dynamic module for providing ContentService configured for a specific Hub resource.
|
|
5
|
-
* Can be registered either globally (application-wide) or locally (module-scoped).
|
|
6
|
-
*/
|
|
7
|
-
export declare class OldContentModule {
|
|
8
|
-
/**
|
|
9
|
-
* Internal utility to generate the module configuration.
|
|
10
|
-
*
|
|
11
|
-
* @param {boolean} isGlobal - Whether the module should be globally scoped.
|
|
12
|
-
* @param {HubResource} resource - The resource associated with the module.
|
|
13
|
-
* @returns {DynamicModule} - Configured dynamic module.
|
|
14
|
-
*/
|
|
15
|
-
private static createModule;
|
|
16
|
-
/**
|
|
17
|
-
* Registers the module globally, making ContentService accessible application-wide.
|
|
18
|
-
*
|
|
19
|
-
* @param {HubResource} resource - The resource associated with the module.
|
|
20
|
-
* @returns {DynamicModule} - Global dynamic module instance.
|
|
21
|
-
*/
|
|
22
|
-
static forRoot(resource: HubResource): DynamicModule;
|
|
23
|
-
/**
|
|
24
|
-
* Registers the module locally (non-global), restricting ContentService
|
|
25
|
-
* to the importing module's scope.
|
|
26
|
-
*
|
|
27
|
-
* @param {HubResource} resource - The resource associated with the module.
|
|
28
|
-
* @returns {DynamicModule} - Local dynamic module instance.
|
|
29
|
-
*/
|
|
30
|
-
static register(resource: HubResource): DynamicModule;
|
|
31
|
-
}
|
|
@@ -1,60 +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 OldContentModule_1;
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.OldContentModule = void 0;
|
|
11
|
-
const common_1 = require("@nestjs/common");
|
|
12
|
-
const content_module_definition_1 = require("./content.module-definition");
|
|
13
|
-
const content_service_1 = require("./content.service");
|
|
14
|
-
/**
|
|
15
|
-
* Dynamic module for providing ContentService configured for a specific Hub resource.
|
|
16
|
-
* Can be registered either globally (application-wide) or locally (module-scoped).
|
|
17
|
-
*/
|
|
18
|
-
let OldContentModule = OldContentModule_1 = class OldContentModule {
|
|
19
|
-
/**
|
|
20
|
-
* Internal utility to generate the module configuration.
|
|
21
|
-
*
|
|
22
|
-
* @param {boolean} isGlobal - Whether the module should be globally scoped.
|
|
23
|
-
* @param {HubResource} resource - The resource associated with the module.
|
|
24
|
-
* @returns {DynamicModule} - Configured dynamic module.
|
|
25
|
-
*/
|
|
26
|
-
static createModule(isGlobal, resource) {
|
|
27
|
-
return {
|
|
28
|
-
global: isGlobal,
|
|
29
|
-
module: OldContentModule_1,
|
|
30
|
-
providers: [content_service_1.OldContentService, { provide: content_module_definition_1.CONTENT_MODULE_RESOURCE_TOKEN, useValue: resource }],
|
|
31
|
-
exports: [content_service_1.OldContentService],
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Registers the module globally, making ContentService accessible application-wide.
|
|
36
|
-
*
|
|
37
|
-
* @param {HubResource} resource - The resource associated with the module.
|
|
38
|
-
* @returns {DynamicModule} - Global dynamic module instance.
|
|
39
|
-
*/
|
|
40
|
-
static forRoot(resource) {
|
|
41
|
-
return this.createModule(true, resource);
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Registers the module locally (non-global), restricting ContentService
|
|
45
|
-
* to the importing module's scope.
|
|
46
|
-
*
|
|
47
|
-
* @param {HubResource} resource - The resource associated with the module.
|
|
48
|
-
* @returns {DynamicModule} - Local dynamic module instance.
|
|
49
|
-
*/
|
|
50
|
-
static register(resource) {
|
|
51
|
-
return this.createModule(false, resource);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
exports.OldContentModule = OldContentModule;
|
|
55
|
-
exports.OldContentModule = OldContentModule = OldContentModule_1 = __decorate([
|
|
56
|
-
(0, common_1.Module)({
|
|
57
|
-
providers: [content_service_1.OldContentService],
|
|
58
|
-
exports: [content_service_1.OldContentService],
|
|
59
|
-
})
|
|
60
|
-
], OldContentModule);
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { ConfigService } from '@nestjs/config';
|
|
2
|
-
import { LabContent, LabContentPopulated } from 'itlab-functions';
|
|
3
|
-
import { HubResource } from '../../../hub-resource.enum';
|
|
4
|
-
import { AuthenticationModuleOptions } from '../../authentication';
|
|
5
|
-
/**
|
|
6
|
-
* Service responsible for interacting with the Organisation Hub Content Service.
|
|
7
|
-
* Encapsulates logic for verifying, posting, retrieving, and deleting content.
|
|
8
|
-
* Uses a secured Axios client to communicate with internal endpoints.
|
|
9
|
-
*/
|
|
10
|
-
export declare class OldContentService {
|
|
11
|
-
private readonly resource;
|
|
12
|
-
private readonly authOptions;
|
|
13
|
-
private readonly configService;
|
|
14
|
-
private readonly logger;
|
|
15
|
-
private readonly axiosInstance;
|
|
16
|
-
/**
|
|
17
|
-
* Initializes the ContentService with appropriate API client and settings.
|
|
18
|
-
*
|
|
19
|
-
* @param {HubResource} resource - Resource type injected via DI
|
|
20
|
-
* @param {AuthenticationModuleOptions} authOptions - Contains Kubernetes service account token
|
|
21
|
-
* @param {ConfigService} configService - Configuration service for environment checks
|
|
22
|
-
*/
|
|
23
|
-
constructor(resource: HubResource, authOptions: AuthenticationModuleOptions, configService: ConfigService);
|
|
24
|
-
/**
|
|
25
|
-
* Validates the structure and integrity of content using the backend.
|
|
26
|
-
*
|
|
27
|
-
* @param {LabContent} content - Content object to validate
|
|
28
|
-
* @returns {Promise<void>} Resolves if valid, rejects with HTTP error otherwise
|
|
29
|
-
*/
|
|
30
|
-
validateContent(content: LabContent): Promise<void>;
|
|
31
|
-
/**
|
|
32
|
-
* Submits new content for a specific resource.
|
|
33
|
-
*
|
|
34
|
-
* @param {string} resourceId - Unique identifier of the resource
|
|
35
|
-
* @param {LabContent} content - Content to be persisted
|
|
36
|
-
* @returns {Promise<void>}
|
|
37
|
-
*/
|
|
38
|
-
submitContent(resourceId: string, content: LabContent): Promise<void>;
|
|
39
|
-
/**
|
|
40
|
-
* Removes content associated with the given resource.
|
|
41
|
-
*
|
|
42
|
-
* @param {string} resourceId - Unique identifier of the resource
|
|
43
|
-
* @returns {Promise<void>}
|
|
44
|
-
*/
|
|
45
|
-
removeContent(resourceId: string): Promise<void>;
|
|
46
|
-
getContent(resourceId: string, type: 'json'): Promise<LabContent>;
|
|
47
|
-
getContent(resourceId: string, type: 'text'): Promise<string>;
|
|
48
|
-
getContent(resourceId: string, type: 'html'): Promise<LabContent>;
|
|
49
|
-
getContent(resourceId: string, type: 'populated'): Promise<LabContentPopulated>;
|
|
50
|
-
}
|
|
@@ -1,145 +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 __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
var OldContentService_1;
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.OldContentService = void 0;
|
|
17
|
-
const common_1 = require("@nestjs/common");
|
|
18
|
-
const config_1 = require("@nestjs/config");
|
|
19
|
-
const create_internal_axios_client_function_1 = require("../../../functions/create-internal-axios-client.function");
|
|
20
|
-
const hub_resource_enum_1 = require("../../../hub-resource.enum");
|
|
21
|
-
const authentication_1 = require("../../authentication");
|
|
22
|
-
const content_module_definition_1 = require("./content.module-definition");
|
|
23
|
-
/**
|
|
24
|
-
* Service responsible for interacting with the Organisation Hub Content Service.
|
|
25
|
-
* Encapsulates logic for verifying, posting, retrieving, and deleting content.
|
|
26
|
-
* Uses a secured Axios client to communicate with internal endpoints.
|
|
27
|
-
*/
|
|
28
|
-
let OldContentService = OldContentService_1 = class OldContentService {
|
|
29
|
-
/**
|
|
30
|
-
* Initializes the ContentService with appropriate API client and settings.
|
|
31
|
-
*
|
|
32
|
-
* @param {HubResource} resource - Resource type injected via DI
|
|
33
|
-
* @param {AuthenticationModuleOptions} authOptions - Contains Kubernetes service account token
|
|
34
|
-
* @param {ConfigService} configService - Configuration service for environment checks
|
|
35
|
-
*/
|
|
36
|
-
constructor(resource, authOptions, configService) {
|
|
37
|
-
this.resource = resource;
|
|
38
|
-
this.authOptions = authOptions;
|
|
39
|
-
this.configService = configService;
|
|
40
|
-
this.logger = new common_1.Logger(OldContentService_1.name);
|
|
41
|
-
const isProduction = this.configService.get('NODE_ENV') === 'production';
|
|
42
|
-
// Construct base URL conditionally based on environment.
|
|
43
|
-
const baseUrl = isProduction
|
|
44
|
-
? 'http://organisation-hub-content-service.organisation-hub-services.svc.cluster.local:3000/internal/'
|
|
45
|
-
: 'https://services.svi-itlab.com/content/internal/';
|
|
46
|
-
// Initialize axios instance with k8s token and appropriate URL.
|
|
47
|
-
this.axiosInstance = (0, create_internal_axios_client_function_1.createInternalAxiosClient)({
|
|
48
|
-
k8sToken: this.authOptions.k8sToken,
|
|
49
|
-
baseUrl: `${baseUrl}`,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Validates the structure and integrity of content using the backend.
|
|
54
|
-
*
|
|
55
|
-
* @param {LabContent} content - Content object to validate
|
|
56
|
-
* @returns {Promise<void>} Resolves if valid, rejects with HTTP error otherwise
|
|
57
|
-
*/
|
|
58
|
-
async validateContent(content) {
|
|
59
|
-
var _a, _b, _c;
|
|
60
|
-
this.logger.log('Validating content');
|
|
61
|
-
try {
|
|
62
|
-
await this.axiosInstance.post(`verify`, { content });
|
|
63
|
-
this.logger.log('Content validation successful');
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
const axiosError = error;
|
|
67
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
68
|
-
this.logger.error(`Content validation failed: ${(_a = axiosError.response) === null || _a === void 0 ? void 0 : _a.data}`);
|
|
69
|
-
throw new common_1.HttpException((_b = axiosError.response) === null || _b === void 0 ? void 0 : _b.data, ((_c = axiosError.response) === null || _c === void 0 ? void 0 : _c.status) || 500);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Submits new content for a specific resource.
|
|
74
|
-
*
|
|
75
|
-
* @param {string} resourceId - Unique identifier of the resource
|
|
76
|
-
* @param {LabContent} content - Content to be persisted
|
|
77
|
-
* @returns {Promise<void>}
|
|
78
|
-
*/
|
|
79
|
-
async submitContent(resourceId, content) {
|
|
80
|
-
var _a, _b, _c;
|
|
81
|
-
this.logger.log(`Submitting content for ${this.resource} (${resourceId})`);
|
|
82
|
-
try {
|
|
83
|
-
await this.axiosInstance.post(`${this.resource}/${resourceId}`, { content });
|
|
84
|
-
this.logger.log(`Content successfully submitted for ${this.resource} (${resourceId})`);
|
|
85
|
-
}
|
|
86
|
-
catch (error) {
|
|
87
|
-
const axiosError = error;
|
|
88
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
89
|
-
this.logger.error(`Content submission failed for ${this.resource} (${resourceId}): ${(_a = axiosError.response) === null || _a === void 0 ? void 0 : _a.data}`);
|
|
90
|
-
throw new common_1.HttpException((_b = axiosError.response) === null || _b === void 0 ? void 0 : _b.data, ((_c = axiosError.response) === null || _c === void 0 ? void 0 : _c.status) || 500);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Removes content associated with the given resource.
|
|
95
|
-
*
|
|
96
|
-
* @param {string} resourceId - Unique identifier of the resource
|
|
97
|
-
* @returns {Promise<void>}
|
|
98
|
-
*/
|
|
99
|
-
async removeContent(resourceId) {
|
|
100
|
-
var _a;
|
|
101
|
-
this.logger.log(`Removing content for ${this.resource} (${resourceId})`);
|
|
102
|
-
try {
|
|
103
|
-
await this.axiosInstance.delete(`${this.resource}/${resourceId}`);
|
|
104
|
-
this.logger.log(`Content removed successfully for ${this.resource} (${resourceId})`);
|
|
105
|
-
}
|
|
106
|
-
catch (error) {
|
|
107
|
-
const axiosError = error;
|
|
108
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
109
|
-
this.logger.error(`Content removal failed for ${this.resource} (${resourceId}): ${(_a = axiosError.response) === null || _a === void 0 ? void 0 : _a.data}`);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Retrieves content in the specified format from the backend service.
|
|
114
|
-
*
|
|
115
|
-
* @param {string} resourceId - Resource ID to fetch content for
|
|
116
|
-
* @param {'json'|'text'|'html'|'populated'} type - Format in which to retrieve content
|
|
117
|
-
* @returns {Promise<LabContent | string | LabContentPopulated>} - The retrieved content
|
|
118
|
-
*/
|
|
119
|
-
async getContent(resourceId, type) {
|
|
120
|
-
var _a;
|
|
121
|
-
this.logger.log(`Fetching ${type} content for ${this.resource} (${resourceId})`);
|
|
122
|
-
try {
|
|
123
|
-
const response = await this.axiosInstance.get(`${this.resource}/${resourceId}/${type}`);
|
|
124
|
-
this.logger.log(`Successfully retrieved ${type} content for ${this.resource} (${resourceId})`);
|
|
125
|
-
return response.data;
|
|
126
|
-
}
|
|
127
|
-
catch (error) {
|
|
128
|
-
const axiosError = error;
|
|
129
|
-
this.logger.error(
|
|
130
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
131
|
-
`Failed to fetch ${type} content for ${this.resource} (${resourceId}): ${(_a = axiosError.response) === null || _a === void 0 ? void 0 : _a.data}`);
|
|
132
|
-
// Return sensible default based on content type
|
|
133
|
-
if (type === 'text')
|
|
134
|
-
return '';
|
|
135
|
-
return [];
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
exports.OldContentService = OldContentService;
|
|
140
|
-
exports.OldContentService = OldContentService = OldContentService_1 = __decorate([
|
|
141
|
-
(0, common_1.Injectable)(),
|
|
142
|
-
__param(0, (0, common_1.Inject)(content_module_definition_1.CONTENT_MODULE_RESOURCE_TOKEN)),
|
|
143
|
-
__param(1, (0, authentication_1.InjectAuthenticationOptions)()),
|
|
144
|
-
__metadata("design:paramtypes", [String, Object, config_1.ConfigService])
|
|
145
|
-
], OldContentService);
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OldContentService = exports.OldContentModule = void 0;
|
|
4
|
-
var content_module_1 = require("./content.module");
|
|
5
|
-
Object.defineProperty(exports, "OldContentModule", { enumerable: true, get: function () { return content_module_1.OldContentModule; } });
|
|
6
|
-
var content_service_1 = require("./content.service");
|
|
7
|
-
Object.defineProperty(exports, "OldContentService", { enumerable: true, get: function () { return content_service_1.OldContentService; } });
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration options required to connect to a MongoDB database.
|
|
3
|
-
* Encapsulates all necessary connection parameters to establish
|
|
4
|
-
* a database connection within the application.
|
|
5
|
-
*/
|
|
6
|
-
export type OldDatabaseModuleOptions = {
|
|
7
|
-
/**
|
|
8
|
-
* The MongoDB connection URI string.
|
|
9
|
-
* This typically includes the protocol, host, port, and authentication info.
|
|
10
|
-
*/
|
|
11
|
-
uri: string;
|
|
12
|
-
/**
|
|
13
|
-
* The name of the application using the database.
|
|
14
|
-
* Used to identify the client application in MongoDB logs and monitoring.
|
|
15
|
-
*/
|
|
16
|
-
appName: string;
|
|
17
|
-
/**
|
|
18
|
-
* The specific database name within the MongoDB server to connect to.
|
|
19
|
-
*/
|
|
20
|
-
dbName: string;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Defines the shape of asynchronous options for configuring the database module.
|
|
24
|
-
* Supports dynamic generation of DatabaseModuleOptions, allowing for
|
|
25
|
-
* async configuration such as fetching from environment variables or remote config services.
|
|
26
|
-
*/
|
|
27
|
-
export type DatabaseModuleAsyncOptions = {
|
|
28
|
-
/**
|
|
29
|
-
* Factory function that returns the database connection options,
|
|
30
|
-
* either synchronously or asynchronously.
|
|
31
|
-
* Can accept injected dependencies as parameters.
|
|
32
|
-
*
|
|
33
|
-
* @param {...any[]} args - Injected dependencies used to build configuration
|
|
34
|
-
* @returns {Promise<OldDatabaseModuleOptions> | OldDatabaseModuleOptions} The database connection options
|
|
35
|
-
*/
|
|
36
|
-
useFactory: (...args: any[]) => Promise<OldDatabaseModuleOptions> | OldDatabaseModuleOptions;
|
|
37
|
-
/**
|
|
38
|
-
* Optional list of providers to be injected into the useFactory function.
|
|
39
|
-
*/
|
|
40
|
-
inject?: any[];
|
|
41
|
-
};
|