itlab-internal-services 2.16.1 → 2.16.3
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/commentable-document.class.d.ts +200 -0
- package/dist/classes/document/commentable-document.class.js +24 -0
- package/dist/classes/document/content-document.class.d.ts +200 -0
- package/dist/classes/document/content-document.class.js +24 -0
- package/dist/classes/document/index.d.ts +4 -0
- package/dist/classes/document/index.js +11 -0
- package/dist/classes/document/likeable-document.class.d.ts +205 -0
- package/dist/classes/document/likeable-document.class.js +70 -0
- package/dist/classes/document/viewable-document.class.d.ts +205 -0
- package/dist/classes/document/viewable-document.class.js +67 -0
- package/dist/classes/document-updater.class.d.ts +40 -0
- package/dist/classes/document-updater.class.js +58 -0
- package/dist/classes/fetch-options/base-options.class.d.ts +18 -0
- package/dist/classes/fetch-options/base-options.class.js +81 -0
- package/dist/classes/fetch-options/comments-options.class.d.ts +6 -0
- package/dist/classes/fetch-options/comments-options.class.js +26 -0
- package/dist/classes/fetch-options/content-options.class.d.ts +7 -0
- package/dist/classes/fetch-options/content-options.class.js +32 -0
- package/dist/classes/fetch-options/drafted-options.class.d.ts +9 -0
- package/dist/classes/fetch-options/drafted-options.class.js +34 -0
- package/dist/classes/fetch-options/index.d.ts +6 -0
- package/dist/classes/fetch-options/index.js +15 -0
- package/dist/classes/fetch-options/liked-by-options.class.d.ts +8 -0
- package/dist/classes/fetch-options/liked-by-options.class.js +28 -0
- package/dist/classes/fetch-options/viewed-by-options.class.d.ts +9 -0
- package/dist/classes/fetch-options/viewed-by-options.class.js +28 -0
- package/dist/classes/index.d.ts +2 -2
- package/dist/classes/index.js +17 -3
- package/dist/classes/task-manager.class.d.ts +2 -2
- package/dist/classes/task-manager.class.js +4 -0
- package/dist/decorators/has-permission.decorator.d.ts +3 -0
- package/dist/decorators/has-permission.decorator.js +26 -0
- package/dist/decorators/index.d.ts +2 -0
- package/dist/decorators/index.js +2 -0
- package/dist/decorators/jwt.decorator.d.ts +1 -1
- package/dist/decorators/jwt.decorator.js +13 -11
- package/dist/decorators/schema-with-critical-keys.decorator.d.ts +12 -0
- package/dist/decorators/schema-with-critical-keys.decorator.js +16 -0
- package/dist/factories/index.d.ts +1 -0
- package/dist/factories/index.js +5 -0
- package/dist/factories/virtuals.factory.d.ts +80 -0
- package/dist/factories/virtuals.factory.js +172 -0
- package/dist/functions/create-schema.function.d.ts +3 -0
- package/dist/functions/create-schema.function.js +33 -0
- package/dist/functions/index.d.ts +1 -1
- package/dist/functions/index.js +3 -3
- package/dist/index.d.ts +6 -0
- package/dist/index.js +10 -0
- package/dist/likeable.interface.d.ts +42 -0
- package/dist/likeable.interface.js +48 -0
- package/dist/modules/_old/comment/comment.controller.d.ts +35 -0
- package/dist/modules/_old/comment/comment.controller.js +86 -0
- package/dist/modules/_old/comment/comment.model.d.ts +29 -0
- package/dist/modules/_old/comment/comment.model.js +43 -0
- package/dist/modules/_old/comment/comment.module-definition.d.ts +45 -0
- package/dist/modules/{comment → _old/comment}/comment.module-definition.js +2 -1
- package/dist/modules/_old/comment/comment.module.d.ts +22 -0
- package/dist/modules/_old/comment/comment.module.js +71 -0
- package/dist/modules/_old/comment/comment.service.d.ts +54 -0
- package/dist/modules/_old/comment/comment.service.js +133 -0
- package/dist/modules/_old/comment/index.d.ts +3 -0
- package/dist/modules/_old/comment/index.js +9 -0
- package/dist/modules/_old/content/content.module-definition.d.ts +5 -0
- package/dist/modules/_old/content/content.module-definition.js +8 -0
- package/dist/modules/_old/content/content.module.d.ts +31 -0
- package/dist/modules/_old/content/content.module.js +60 -0
- package/dist/modules/_old/content/content.service.d.ts +50 -0
- package/dist/modules/_old/content/content.service.js +145 -0
- package/dist/modules/_old/content/index.d.ts +2 -0
- package/dist/modules/_old/content/index.js +7 -0
- package/dist/modules/_old/database/database-module-options.interface.d.ts +41 -0
- package/dist/modules/_old/database/database.liveness-controller.d.ts +27 -0
- package/dist/modules/_old/database/database.liveness-controller.js +80 -0
- package/dist/modules/_old/database/database.module.d.ts +41 -0
- package/dist/modules/_old/database/database.module.js +97 -0
- package/dist/modules/_old/database/index.d.ts +6 -0
- package/dist/modules/_old/database/index.js +13 -0
- package/dist/modules/_old/database/lock-service/lock.schema.d.ts +38 -0
- package/dist/modules/_old/database/lock-service/lock.schema.js +51 -0
- package/dist/modules/_old/database/lock-service/lock.service.d.ts +53 -0
- package/dist/modules/_old/database/lock-service/lock.service.js +103 -0
- package/dist/modules/_old/database/model-service/dbs/hub-account.db.d.ts +28 -0
- package/dist/modules/_old/database/model-service/dbs/hub-account.db.js +44 -0
- package/dist/modules/_old/database/model-service/dbs/hub-books.db.d.ts +23 -0
- package/dist/modules/_old/database/model-service/dbs/hub-books.db.js +45 -0
- package/dist/modules/_old/database/model-service/dbs/hub-comments.db.d.ts +29 -0
- package/dist/modules/_old/database/model-service/dbs/hub-comments.db.js +68 -0
- package/dist/modules/_old/database/model-service/dbs/hub-content.db.d.ts +24 -0
- package/dist/modules/_old/database/model-service/dbs/hub-content.db.js +49 -0
- package/dist/modules/_old/database/model-service/dbs/hub-demo-hive.db.d.ts +23 -0
- package/dist/modules/_old/database/model-service/dbs/hub-demo-hive.db.js +45 -0
- package/dist/modules/_old/database/model-service/dbs/hub-events.db.d.ts +24 -0
- package/dist/modules/_old/database/model-service/dbs/hub-events.db.js +49 -0
- package/dist/modules/_old/database/model-service/dbs/hub-hackschool.db.d.ts +60 -0
- package/dist/modules/_old/database/model-service/dbs/hub-hackschool.db.js +106 -0
- package/dist/modules/_old/database/model-service/dbs/hub-newsroom.db.d.ts +25 -0
- package/dist/modules/_old/database/model-service/dbs/hub-newsroom.db.js +53 -0
- package/dist/modules/_old/database/model-service/dbs/hub-podcasts.db.d.ts +23 -0
- package/dist/modules/_old/database/model-service/dbs/hub-podcasts.db.js +45 -0
- package/dist/modules/_old/database/model-service/dbs/hub-team.db.d.ts +22 -0
- package/dist/modules/_old/database/model-service/dbs/hub-team.db.js +41 -0
- package/dist/modules/_old/database/model-service/dbs/hub-tech-radar.db.d.ts +42 -0
- package/dist/modules/_old/database/model-service/dbs/hub-tech-radar.db.js +81 -0
- package/dist/modules/_old/database/model-service/model.service.d.ts +8465 -0
- package/dist/modules/_old/database/model-service/model.service.js +136 -0
- package/dist/modules/_old/database/populate-service/populate.service.d.ts +73 -0
- package/dist/modules/_old/database/populate-service/populate.service.js +163 -0
- package/dist/modules/_old/database/service-mapper-service/service-mapper.service.d.ts +32 -0
- package/dist/modules/_old/database/service-mapper-service/service-mapper.service.js +73 -0
- package/dist/modules/_old/fetch/fetch.module.d.ts +31 -0
- package/dist/modules/_old/fetch/fetch.module.js +60 -0
- package/dist/modules/_old/fetch/fetch.service.d.ts +153 -0
- package/dist/modules/_old/fetch/fetch.service.js +274 -0
- package/dist/modules/_old/fetch/index.d.ts +2 -0
- package/dist/modules/_old/fetch/index.js +7 -0
- package/dist/modules/_old/index.d.ts +5 -0
- package/dist/modules/{comment → _old}/index.js +5 -2
- package/dist/modules/_old/like/index.d.ts +1 -0
- package/dist/modules/_old/like/index.js +5 -0
- package/dist/modules/_old/like/like.controller.d.ts +41 -0
- package/dist/modules/_old/like/like.controller.js +125 -0
- package/dist/modules/_old/like/like.module-definition.d.ts +20 -0
- package/dist/modules/_old/like/like.module-definition.js +8 -0
- package/dist/modules/_old/like/like.module.d.ts +21 -0
- package/dist/modules/_old/like/like.module.js +67 -0
- package/dist/modules/_old/like/like.service.d.ts +61 -0
- package/dist/modules/_old/like/like.service.js +103 -0
- package/dist/modules/authentication/guards/jwt-auth.guard.d.ts +1 -1
- package/dist/modules/authentication/guards/jwt-auth.guard.js +5 -3
- package/dist/modules/authentication/guards/permissions.guard.d.ts +1 -3
- package/dist/modules/authentication/guards/permissions.guard.js +2 -8
- package/dist/modules/authentication/guards/service-auth.guard.d.ts +0 -4
- package/dist/modules/authentication/guards/service-auth.guard.js +10 -13
- package/dist/modules/{comment/comment-module-options.interface.d.ts → comments/comments-module-options.interface.d.ts} +3 -2
- package/dist/modules/comments/comments-module-options.interface.js +2 -0
- package/dist/modules/{comment/comment.controller.d.ts → comments/comments.controller.d.ts} +7 -6
- package/dist/modules/{comment/comment.controller.js → comments/comments.controller.js} +14 -14
- package/dist/modules/comments/comments.module-definition.d.ts +4 -0
- package/dist/modules/comments/comments.module-definition.js +7 -0
- package/dist/modules/{comment/comment.module.d.ts → comments/comments.module.d.ts} +6 -6
- package/dist/modules/{comment/comment.module.js → comments/comments.module.js} +17 -16
- package/dist/modules/{comment/comment.service.d.ts → comments/comments.service.d.ts} +35 -9
- package/dist/modules/comments/comments.service.js +165 -0
- package/dist/modules/comments/index.d.ts +3 -0
- package/dist/modules/{services/providers/comments → comments}/index.js +2 -0
- package/dist/modules/index.d.ts +1 -1
- package/dist/modules/index.js +1 -1
- package/dist/modules/like/like-module-options.interface.d.ts +1 -0
- package/dist/modules/like/like.controller.d.ts +3 -2
- package/dist/modules/like/like.controller.js +4 -4
- package/dist/modules/like/like.module.js +1 -1
- package/dist/modules/like/like.service.d.ts +0 -16
- package/dist/modules/like/like.service.js +9 -28
- package/dist/modules/merge/merge-module-options.interface.d.ts +1 -0
- package/dist/modules/merge/merge.controller.d.ts +3 -2
- package/dist/modules/merge/merge.controller.js +4 -4
- package/dist/modules/merge/merge.module.js +1 -1
- package/dist/modules/services/providers/accounts.service.js +4 -0
- package/dist/modules/services/providers/index.d.ts +0 -1
- package/dist/modules/services/providers/index.js +0 -1
- package/dist/modules/services/services.module.js +0 -1
- package/dist/pipes/index.d.ts +1 -0
- package/dist/pipes/index.js +1 -0
- package/dist/pipes/restricted-fields.pipe.d.ts +35 -0
- package/dist/pipes/restricted-fields.pipe.js +83 -0
- package/dist/properties/content-return-type.property.d.ts +4 -0
- package/dist/properties/content-return-type.property.js +12 -7
- package/dist/properties/content.property.d.ts +7 -2
- package/dist/properties/content.property.js +11 -3
- package/dist/properties/index.d.ts +2 -4
- package/dist/properties/index.js +5 -5
- package/dist/transform/index.d.ts +2 -0
- package/dist/transform/index.js +2 -0
- package/dist/transform/mongo-id.transform.d.ts +4 -0
- package/dist/transform/mongo-id.transform.js +13 -0
- package/dist/transform/mongo-ids.transform.d.ts +4 -0
- package/dist/transform/mongo-ids.transform.js +16 -0
- package/dist/types/duplicable-model.type.d.ts +10 -0
- package/dist/types/duplicable-model.type.js +2 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/likeable.type.d.ts +4 -3
- package/dist/types/viewable.type.d.ts +4 -3
- package/dist/viewable.interface.d.ts +42 -0
- package/dist/viewable.interface.js +48 -0
- package/package.json +1 -1
- package/dist/classes/schema-builder.class.d.ts +0 -75
- package/dist/classes/schema-builder.class.js +0 -109
- package/dist/modules/comment/comment.module-definition.d.ts +0 -4
- package/dist/modules/comment/comment.service.js +0 -99
- package/dist/modules/comment/index.d.ts +0 -2
- package/dist/modules/services/providers/comments/comments.service-definition.d.ts +0 -1
- package/dist/modules/services/providers/comments/comments.service-definition.js +0 -4
- package/dist/modules/services/providers/comments/comments.service.d.ts +0 -60
- package/dist/modules/services/providers/comments/comments.service.js +0 -139
- package/dist/modules/services/providers/comments/index.d.ts +0 -1
- package/dist/properties/likeable.properties.d.ts +0 -1
- package/dist/properties/likeable.properties.js +0 -66
- package/dist/properties/viewable.properties.d.ts +0 -1
- package/dist/properties/viewable.properties.js +0 -66
- /package/dist/modules/{comment/comment-module-options.interface.js → _old/database/database-module-options.interface.js} +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare class BaseOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Basic
|
|
4
|
+
*/
|
|
5
|
+
id?: string;
|
|
6
|
+
ids?: string[];
|
|
7
|
+
samples?: number;
|
|
8
|
+
/**
|
|
9
|
+
* Sorting
|
|
10
|
+
*/
|
|
11
|
+
sortField?: string;
|
|
12
|
+
sortDirection?: 1 | -1;
|
|
13
|
+
/**
|
|
14
|
+
* Pagination
|
|
15
|
+
*/
|
|
16
|
+
skip?: number;
|
|
17
|
+
limit?: number;
|
|
18
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.BaseOptions = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
const transform_1 = require("../../transform");
|
|
16
|
+
class BaseOptions {
|
|
17
|
+
}
|
|
18
|
+
exports.BaseOptions = BaseOptions;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, swagger_1.ApiPropertyOptional)({ description: '' }),
|
|
21
|
+
(0, transform_1.MongoIdTransform)(),
|
|
22
|
+
(0, class_validator_1.IsOptional)(),
|
|
23
|
+
__metadata("design:type", String)
|
|
24
|
+
], BaseOptions.prototype, "id", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, swagger_1.ApiPropertyOptional)({ description: '' }),
|
|
27
|
+
(0, transform_1.MongoIdsTransform)(),
|
|
28
|
+
(0, class_validator_1.IsOptional)(),
|
|
29
|
+
__metadata("design:type", Array)
|
|
30
|
+
], BaseOptions.prototype, "ids", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, swagger_1.ApiPropertyOptional)({ description: '' }),
|
|
33
|
+
(0, transform_1.NumberTransform)({ default: undefined, min: 1, max: undefined }),
|
|
34
|
+
(0, class_validator_1.IsOptional)(),
|
|
35
|
+
__metadata("design:type", Number)
|
|
36
|
+
], BaseOptions.prototype, "samples", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
39
|
+
description: 'Feldname, nach dem sortiert werden soll',
|
|
40
|
+
default: '_id',
|
|
41
|
+
}),
|
|
42
|
+
(0, transform_1.StringTransform)({ trim: true, omitEmpty: true }),
|
|
43
|
+
(0, class_validator_1.MinLength)(1, { message: 'Das Sortierfeld muss mindestens 1 Zeichen lang sein.' }),
|
|
44
|
+
(0, class_validator_1.IsOptional)(),
|
|
45
|
+
__metadata("design:type", String)
|
|
46
|
+
], BaseOptions.prototype, "sortField", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
49
|
+
description: 'Sortierreihenfolge: 1 für aufsteigend, -1 für absteigend (Standard)',
|
|
50
|
+
examples: {
|
|
51
|
+
ascending: { value: 1, summary: 'Aufsteigend' },
|
|
52
|
+
descending: { value: -1, summary: 'Absteigend (Standard)' },
|
|
53
|
+
},
|
|
54
|
+
default: -1,
|
|
55
|
+
}),
|
|
56
|
+
(0, transform_1.NumberTransform)({ default: -1, min: -1, max: 1 }),
|
|
57
|
+
(0, class_validator_1.IsOptional)(),
|
|
58
|
+
__metadata("design:type", Number)
|
|
59
|
+
], BaseOptions.prototype, "sortDirection", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
62
|
+
description: 'Anzahl der zu überspringenden Ergebnisse (für Paginierung)',
|
|
63
|
+
minimum: 0,
|
|
64
|
+
default: 0,
|
|
65
|
+
example: 0,
|
|
66
|
+
}),
|
|
67
|
+
(0, transform_1.NumberTransform)({ default: 0, min: 0 }),
|
|
68
|
+
(0, class_validator_1.IsOptional)(),
|
|
69
|
+
__metadata("design:type", Number)
|
|
70
|
+
], BaseOptions.prototype, "skip", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
73
|
+
description: 'Maximale Anzahl der zurückgegebenen Ergebnisse',
|
|
74
|
+
minimum: 0,
|
|
75
|
+
default: undefined,
|
|
76
|
+
example: undefined,
|
|
77
|
+
}),
|
|
78
|
+
(0, transform_1.NumberTransform)({ default: undefined, min: 0, max: undefined }),
|
|
79
|
+
(0, class_validator_1.IsOptional)(),
|
|
80
|
+
__metadata("design:type", Number)
|
|
81
|
+
], BaseOptions.prototype, "limit", void 0);
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CommentsOptions = CommentsOptions;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
const transform_1 = require("../../transform");
|
|
16
|
+
function CommentsOptions(Base) {
|
|
17
|
+
class CommentsOptions extends Base {
|
|
18
|
+
}
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, swagger_1.ApiPropertyOptional)({ example: true }),
|
|
21
|
+
(0, transform_1.BooleanTransform)(),
|
|
22
|
+
(0, class_validator_1.IsOptional)(),
|
|
23
|
+
__metadata("design:type", Boolean)
|
|
24
|
+
], CommentsOptions.prototype, "includeComments", void 0);
|
|
25
|
+
return CommentsOptions;
|
|
26
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ContentOptions = ContentOptions;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
15
|
+
const class_validator_1 = require("class-validator");
|
|
16
|
+
const content_return_types_1 = require("../../modules/services/providers/content/content-return-types");
|
|
17
|
+
const properties_1 = require("../../properties");
|
|
18
|
+
function ContentOptions(Base) {
|
|
19
|
+
class ContentOptions extends Base {
|
|
20
|
+
}
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
23
|
+
description: 'In which format should the content be returned',
|
|
24
|
+
enum: [undefined, ...content_return_types_1.supportedContentReturnTypes],
|
|
25
|
+
default: undefined,
|
|
26
|
+
}),
|
|
27
|
+
(0, class_transformer_1.Transform)(({ value }) => ((0, properties_1.isSupportedContentType)(value) ? value : undefined)),
|
|
28
|
+
(0, class_validator_1.IsOptional)(),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], ContentOptions.prototype, "includeContent", void 0);
|
|
31
|
+
return ContentOptions;
|
|
32
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.DraftedOptions = DraftedOptions;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
const pipes_1 = require("../../pipes");
|
|
16
|
+
const transform_1 = require("../../transform");
|
|
17
|
+
function DraftedOptions(Base, options) {
|
|
18
|
+
class DraftedOptions extends Base {
|
|
19
|
+
}
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, swagger_1.ApiPropertyOptional)({ example: true }),
|
|
22
|
+
(0, transform_1.BooleanTransform)(),
|
|
23
|
+
(0, class_validator_1.IsOptional)(),
|
|
24
|
+
(0, pipes_1.Restricted)(options === null || options === void 0 ? void 0 : options.requiredPermissions),
|
|
25
|
+
__metadata("design:type", Boolean)
|
|
26
|
+
], DraftedOptions.prototype, "includeDrafted", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, swagger_1.ApiPropertyOptional)(),
|
|
29
|
+
(0, transform_1.BooleanTransform)(),
|
|
30
|
+
(0, class_validator_1.IsOptional)(),
|
|
31
|
+
__metadata("design:type", Boolean)
|
|
32
|
+
], DraftedOptions.prototype, "isDraft", void 0);
|
|
33
|
+
return DraftedOptions;
|
|
34
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { BaseOptions } from './base-options.class';
|
|
2
|
+
export { CommentsOptions } from './comments-options.class';
|
|
3
|
+
export { ContentOptions } from './content-options.class';
|
|
4
|
+
export { DraftedOptions } from './drafted-options.class';
|
|
5
|
+
export { LikedByOptions } from './liked-by-options.class';
|
|
6
|
+
export { ViewedByOptions } from './viewed-by-options.class';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ViewedByOptions = exports.LikedByOptions = exports.DraftedOptions = exports.ContentOptions = exports.CommentsOptions = exports.BaseOptions = void 0;
|
|
4
|
+
var base_options_class_1 = require("./base-options.class");
|
|
5
|
+
Object.defineProperty(exports, "BaseOptions", { enumerable: true, get: function () { return base_options_class_1.BaseOptions; } });
|
|
6
|
+
var comments_options_class_1 = require("./comments-options.class");
|
|
7
|
+
Object.defineProperty(exports, "CommentsOptions", { enumerable: true, get: function () { return comments_options_class_1.CommentsOptions; } });
|
|
8
|
+
var content_options_class_1 = require("./content-options.class");
|
|
9
|
+
Object.defineProperty(exports, "ContentOptions", { enumerable: true, get: function () { return content_options_class_1.ContentOptions; } });
|
|
10
|
+
var drafted_options_class_1 = require("./drafted-options.class");
|
|
11
|
+
Object.defineProperty(exports, "DraftedOptions", { enumerable: true, get: function () { return drafted_options_class_1.DraftedOptions; } });
|
|
12
|
+
var liked_by_options_class_1 = require("./liked-by-options.class");
|
|
13
|
+
Object.defineProperty(exports, "LikedByOptions", { enumerable: true, get: function () { return liked_by_options_class_1.LikedByOptions; } });
|
|
14
|
+
var viewed_by_options_class_1 = require("./viewed-by-options.class");
|
|
15
|
+
Object.defineProperty(exports, "ViewedByOptions", { enumerable: true, get: function () { return viewed_by_options_class_1.ViewedByOptions; } });
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.LikedByOptions = LikedByOptions;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
const pipes_1 = require("../../pipes");
|
|
16
|
+
const transform_1 = require("../../transform");
|
|
17
|
+
function LikedByOptions(Base, options) {
|
|
18
|
+
class LikedByOptions extends Base {
|
|
19
|
+
}
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, swagger_1.ApiPropertyOptional)({}),
|
|
22
|
+
(0, transform_1.BooleanTransform)(),
|
|
23
|
+
(0, class_validator_1.IsOptional)(),
|
|
24
|
+
(0, pipes_1.Restricted)(options === null || options === void 0 ? void 0 : options.requiredPermissions),
|
|
25
|
+
__metadata("design:type", Boolean)
|
|
26
|
+
], LikedByOptions.prototype, "includeLikedBy", void 0);
|
|
27
|
+
return LikedByOptions;
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ViewedByOptions = ViewedByOptions;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
const pipes_1 = require("../../pipes");
|
|
16
|
+
const transform_1 = require("../../transform");
|
|
17
|
+
function ViewedByOptions(Base, options) {
|
|
18
|
+
class ViewedByOptions extends Base {
|
|
19
|
+
}
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, swagger_1.ApiPropertyOptional)({}),
|
|
22
|
+
(0, transform_1.BooleanTransform)(),
|
|
23
|
+
(0, class_validator_1.IsOptional)(),
|
|
24
|
+
(0, pipes_1.Restricted)(options === null || options === void 0 ? void 0 : options.requiredPermissions),
|
|
25
|
+
__metadata("design:type", Boolean)
|
|
26
|
+
], ViewedByOptions.prototype, "includeViewedBy", void 0);
|
|
27
|
+
return ViewedByOptions;
|
|
28
|
+
}
|
package/dist/classes/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
export * from './document';
|
|
2
|
+
export * from './fetch-options';
|
|
1
3
|
export { DocumentMerger } from './document-merger.class';
|
|
2
4
|
export { ReportCategory } from './report-category.class';
|
|
3
|
-
export { SchemaBuilder } from './schema-builder.class';
|
|
4
|
-
export type { SchemaBuilderDocument, SchemaBuilderModel, SchemaBuilderOptions } from './schema-builder.class';
|
|
5
5
|
export { TaskManager } from './task-manager.class';
|
package/dist/classes/index.js
CHANGED
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TaskManager = exports.
|
|
17
|
+
exports.TaskManager = exports.ReportCategory = exports.DocumentMerger = void 0;
|
|
18
|
+
__exportStar(require("./document"), exports);
|
|
19
|
+
__exportStar(require("./fetch-options"), exports);
|
|
4
20
|
var document_merger_class_1 = require("./document-merger.class");
|
|
5
21
|
Object.defineProperty(exports, "DocumentMerger", { enumerable: true, get: function () { return document_merger_class_1.DocumentMerger; } });
|
|
6
22
|
var report_category_class_1 = require("./report-category.class");
|
|
7
23
|
Object.defineProperty(exports, "ReportCategory", { enumerable: true, get: function () { return report_category_class_1.ReportCategory; } });
|
|
8
|
-
var schema_builder_class_1 = require("./schema-builder.class");
|
|
9
|
-
Object.defineProperty(exports, "SchemaBuilder", { enumerable: true, get: function () { return schema_builder_class_1.SchemaBuilder; } });
|
|
10
24
|
var task_manager_class_1 = require("./task-manager.class");
|
|
11
25
|
Object.defineProperty(exports, "TaskManager", { enumerable: true, get: function () { return task_manager_class_1.TaskManager; } });
|
|
@@ -40,7 +40,7 @@ export declare class TaskManager {
|
|
|
40
40
|
* @param userMap Map of userId -> user object
|
|
41
41
|
* @returns Array of user objects
|
|
42
42
|
*/
|
|
43
|
-
static mapIdsToUsers(userIds: string[], userMap: Map<string, User>):
|
|
43
|
+
static mapIdsToUsers(userIds: string[], userMap: Map<string, User>): User[];
|
|
44
44
|
/**
|
|
45
45
|
* Maps an array of IDs to user objects using a userMap.
|
|
46
46
|
* Filters out any IDs that don’t have a corresponding user.
|
|
@@ -48,7 +48,7 @@ export declare class TaskManager {
|
|
|
48
48
|
* @param accountMap Map of userId -> user object
|
|
49
49
|
* @returns Array of user objects
|
|
50
50
|
*/
|
|
51
|
-
static mapIdsToAccounts(accountIds: string[], accountMap: Map<string, Account>):
|
|
51
|
+
static mapIdsToAccounts(accountIds: string[], accountMap: Map<string, Account>): Account[];
|
|
52
52
|
/**
|
|
53
53
|
* Adds a new asynchronous task to the queue.
|
|
54
54
|
*
|
|
@@ -30,6 +30,8 @@ class TaskManager {
|
|
|
30
30
|
static async fetchAndMapUsers(userIdGroups, accountsService) {
|
|
31
31
|
// Collect all unique user IDs across all groups
|
|
32
32
|
const uniqueUserIds = new Set(userIdGroups.flat());
|
|
33
|
+
if (uniqueUserIds.size === 0)
|
|
34
|
+
return new Map();
|
|
33
35
|
// Fetch all users once
|
|
34
36
|
const userCollection = await accountsService.getUserCollection(Array.from(uniqueUserIds));
|
|
35
37
|
// Build a map for quick lookup
|
|
@@ -45,6 +47,8 @@ class TaskManager {
|
|
|
45
47
|
static async fetchAndMapAccounts(accountIdGroups, accountsService) {
|
|
46
48
|
// Collect all unique user IDs across all groups
|
|
47
49
|
const uniqueAccountIds = new Set(accountIdGroups.flat());
|
|
50
|
+
if (uniqueAccountIds.size === 0)
|
|
51
|
+
return new Map();
|
|
48
52
|
// Fetch all users once
|
|
49
53
|
const accountCollection = await accountsService.getAccountCollection(Array.from(uniqueAccountIds));
|
|
50
54
|
// Build a map for quick lookup
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const HasPermission: (...dataOrPipes: (string | import("@nestjs/common").PipeTransform<any, any> | import("@nestjs/common").Type<import("@nestjs/common").PipeTransform<any, any>>)[]) => ParameterDecorator;
|
|
2
|
+
export declare const HasSomePermission: (...dataOrPipes: (string[] | import("@nestjs/common").PipeTransform<any, any> | import("@nestjs/common").Type<import("@nestjs/common").PipeTransform<any, any>>)[]) => ParameterDecorator;
|
|
3
|
+
export declare const HasEveryPermission: (...dataOrPipes: (string[] | import("@nestjs/common").PipeTransform<any, any> | import("@nestjs/common").Type<import("@nestjs/common").PipeTransform<any, any>>)[]) => ParameterDecorator;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HasEveryPermission = exports.HasSomePermission = exports.HasPermission = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const itlab_functions_1 = require("itlab-functions");
|
|
6
|
+
exports.HasPermission = (0, common_1.createParamDecorator)((permission, executionContext) => {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
const request = executionContext.switchToHttp().getRequest();
|
|
9
|
+
if (!((_b = (_a = request.account) === null || _a === void 0 ? void 0 : _a.perms) === null || _b === void 0 ? void 0 : _b.length))
|
|
10
|
+
return false;
|
|
11
|
+
return (0, itlab_functions_1.hasPermission)(permission, request.account.perms);
|
|
12
|
+
});
|
|
13
|
+
exports.HasSomePermission = (0, common_1.createParamDecorator)((permissions, executionContext) => {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
const request = executionContext.switchToHttp().getRequest();
|
|
16
|
+
if (!((_b = (_a = request.account) === null || _a === void 0 ? void 0 : _a.perms) === null || _b === void 0 ? void 0 : _b.length))
|
|
17
|
+
return false;
|
|
18
|
+
return (0, itlab_functions_1.hasSomePermission)(permissions, request.account.perms);
|
|
19
|
+
});
|
|
20
|
+
exports.HasEveryPermission = (0, common_1.createParamDecorator)((permissions, executionContext) => {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
const request = executionContext.switchToHttp().getRequest();
|
|
23
|
+
if (!((_b = (_a = request.account) === null || _a === void 0 ? void 0 : _a.perms) === null || _b === void 0 ? void 0 : _b.length))
|
|
24
|
+
return false;
|
|
25
|
+
return (0, itlab_functions_1.hasEveryPermission)(permissions, request.account.perms);
|
|
26
|
+
});
|
package/dist/decorators/index.js
CHANGED
|
@@ -15,4 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./authenticated-account.decorator"), exports);
|
|
18
|
+
__exportStar(require("./has-permission.decorator"), exports);
|
|
18
19
|
__exportStar(require("./jwt.decorator"), exports);
|
|
20
|
+
__exportStar(require("./schema-with-critical-keys.decorator"), exports);
|
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
* @throws {UnprocessableEntityException} When the 'Authorization' header is missing.
|
|
10
10
|
* @returns {string} The extracted JWT token without the 'Bearer ' prefix.
|
|
11
11
|
*/
|
|
12
|
-
export declare
|
|
12
|
+
export declare function Jwt(): ParameterDecorator;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Jwt =
|
|
3
|
+
exports.Jwt = Jwt;
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
5
|
/**
|
|
6
6
|
* Custom decorator to extract the JWT token from the request headers.
|
|
@@ -13,13 +13,15 @@ const common_1 = require("@nestjs/common");
|
|
|
13
13
|
* @throws {UnprocessableEntityException} When the 'Authorization' header is missing.
|
|
14
14
|
* @returns {string} The extracted JWT token without the 'Bearer ' prefix.
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
function Jwt() {
|
|
17
|
+
return (0, common_1.createParamDecorator)((_, executionContext) => {
|
|
18
|
+
const request = executionContext.switchToHttp().getRequest();
|
|
19
|
+
const authHeader = request.header('Authorization');
|
|
20
|
+
if (!authHeader) {
|
|
21
|
+
throw new common_1.UnprocessableEntityException('Authorization header is missing from the request');
|
|
22
|
+
}
|
|
23
|
+
// Extract token by removing the 'Bearer ' prefix (case-insensitive)
|
|
24
|
+
const token = authHeader.replace(/^Bearer\s+/i, '');
|
|
25
|
+
return token;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SchemaOptions } from '@nestjs/mongoose';
|
|
2
|
+
/**
|
|
3
|
+
* Extended SchemaOptions to include `criticalKeys` for duplicate checking.
|
|
4
|
+
*/
|
|
5
|
+
export interface ExtendedSchemaOptions extends SchemaOptions {
|
|
6
|
+
criticalKeys?: string[];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Custom decorator that wraps NestJS's @Schema
|
|
10
|
+
* and stores criticalKeys on the schema options.
|
|
11
|
+
*/
|
|
12
|
+
export declare function SchemaWithCriticalKeys(options?: ExtendedSchemaOptions): ClassDecorator;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SchemaWithCriticalKeys = SchemaWithCriticalKeys;
|
|
4
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
5
|
+
/**
|
|
6
|
+
* Custom decorator that wraps NestJS's @Schema
|
|
7
|
+
* and stores criticalKeys on the schema options.
|
|
8
|
+
*/
|
|
9
|
+
function SchemaWithCriticalKeys(options = {}) {
|
|
10
|
+
return (target) => {
|
|
11
|
+
// Store options on the class constructor for the factory to read later
|
|
12
|
+
Reflect.defineMetadata('criticalKeys', options.criticalKeys || [], target);
|
|
13
|
+
// Call the original NestJS @Schema decorator with the same options
|
|
14
|
+
(0, mongoose_1.Schema)(options)(target);
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { VirtualsFactory } from './virtuals.factory';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VirtualsFactory = void 0;
|
|
4
|
+
var virtuals_factory_1 = require("./virtuals.factory");
|
|
5
|
+
Object.defineProperty(exports, "VirtualsFactory", { enumerable: true, get: function () { return virtuals_factory_1.VirtualsFactory; } });
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Schema, VirtualTypeOptions } from 'mongoose';
|
|
2
|
+
import { HubResource } from '../hub-resource.enum';
|
|
3
|
+
/**
|
|
4
|
+
* TODO: Remove
|
|
5
|
+
* VirtualsFactory
|
|
6
|
+
*
|
|
7
|
+
* Provides a fluent, composable API for defining reusable Mongoose virtuals on schemas.
|
|
8
|
+
* Helps keep schema definitions clean and DRY by centralizing the logic for frequently-used
|
|
9
|
+
* virtual references (accounts, comments, likes, etc.), derived values, and hub-based resources.
|
|
10
|
+
*/
|
|
11
|
+
export declare class VirtualsFactory {
|
|
12
|
+
private readonly schema;
|
|
13
|
+
private readonly resource;
|
|
14
|
+
/**
|
|
15
|
+
* @param {Schema} schema - the schema to create the virtual field on
|
|
16
|
+
* @param {HubResource} resource - the resource used for the virtual field
|
|
17
|
+
*/
|
|
18
|
+
constructor(schema: Schema, resource: HubResource);
|
|
19
|
+
/**
|
|
20
|
+
* Registers a generic virtual with custom Mongoose options.
|
|
21
|
+
*
|
|
22
|
+
* @param {string} name - The virtual field name.
|
|
23
|
+
* @param {VirtualTypeOptions} [options] - The Mongoose virtual options.
|
|
24
|
+
* @returns {VirtualsFactory} - The VirtualsFactory instance for chaining.
|
|
25
|
+
*/
|
|
26
|
+
virtual(name: string, options?: VirtualTypeOptions): VirtualsFactory;
|
|
27
|
+
/**
|
|
28
|
+
* Registers a virtual referencing a single Account by ID.
|
|
29
|
+
*
|
|
30
|
+
* @param {string} name - Virtual field name.
|
|
31
|
+
* @param {string} localField - Field containing the Account ID.
|
|
32
|
+
*/
|
|
33
|
+
virtualSingleAccount(name: string, localField: string): VirtualsFactory;
|
|
34
|
+
/**
|
|
35
|
+
* Registers a virtual referencing multiple Accounts by ID array.
|
|
36
|
+
*
|
|
37
|
+
* @param {string} name - Virtual field name.
|
|
38
|
+
* @param {string} localField - Field containing array of Account IDs.
|
|
39
|
+
*/
|
|
40
|
+
virtualMultipleAccounts(name: string, localField: string): VirtualsFactory;
|
|
41
|
+
/** Links `accountId` → `account` (single Account) */
|
|
42
|
+
get account(): VirtualsFactory;
|
|
43
|
+
/** Links `accountIds` → `accounts` (multiple Accounts) */
|
|
44
|
+
get accounts(): VirtualsFactory;
|
|
45
|
+
/** Links `authorId` → `author` (single Account) */
|
|
46
|
+
get author(): VirtualsFactory;
|
|
47
|
+
/** Links `authorIds` → `authors` (multiple Accounts) */
|
|
48
|
+
get authors(): VirtualsFactory;
|
|
49
|
+
/** Links `submitterId` → `submitter` (single Account) */
|
|
50
|
+
get submitter(): VirtualsFactory;
|
|
51
|
+
/** Links `submitterIds` → `submitters` (multiple Accounts) */
|
|
52
|
+
get submitters(): VirtualsFactory;
|
|
53
|
+
/** Links `contactId` → `contact` (single Account) */
|
|
54
|
+
get contact(): VirtualsFactory;
|
|
55
|
+
/** Links `contactIds` → `contacts` (multiple Accounts) */
|
|
56
|
+
get contacts(): VirtualsFactory;
|
|
57
|
+
/** Links `_viewedBy` → `viewedBy` and creates derived `views` counter */
|
|
58
|
+
get views(): VirtualsFactory;
|
|
59
|
+
/** Links `_likedBy` → `likedBy` and creates derived `likes` counter */
|
|
60
|
+
get likes(): VirtualsFactory;
|
|
61
|
+
/**
|
|
62
|
+
* Creates `comments` virtual for top-level comments on the resource.
|
|
63
|
+
* Filters out replies.
|
|
64
|
+
*/
|
|
65
|
+
get comments(): VirtualsFactory;
|
|
66
|
+
/**
|
|
67
|
+
* Creates `commentsCount` virtual for counting all related comments on this resource.
|
|
68
|
+
*/
|
|
69
|
+
get commentsCount(): VirtualsFactory;
|
|
70
|
+
/**
|
|
71
|
+
* Creates an empty virtual field for general content use.
|
|
72
|
+
* Placeholder to support virtual getter/setter extension in custom implementations.
|
|
73
|
+
*/
|
|
74
|
+
get content(): VirtualsFactory;
|
|
75
|
+
/**
|
|
76
|
+
* Registers `ref-[resource]` virtuals for each known Hub resource.
|
|
77
|
+
* Used for polymorphic document relationships in the platform.
|
|
78
|
+
*/
|
|
79
|
+
get hubResources(): VirtualsFactory;
|
|
80
|
+
}
|