itlab-internal-services 2.15.7 → 2.16.1
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/README.md +1 -187
- package/dist/classes/document-merger.class.js +2 -3
- package/dist/classes/index.d.ts +4 -1
- package/dist/classes/index.js +7 -3
- package/dist/classes/report-category.class.d.ts +55 -0
- package/dist/classes/report-category.class.js +120 -0
- package/dist/classes/schema-builder.class.d.ts +75 -0
- package/dist/classes/schema-builder.class.js +109 -0
- package/dist/classes/task-manager.class.d.ts +71 -0
- package/dist/classes/task-manager.class.js +99 -0
- package/dist/decorators/{account.decorator.d.ts → authenticated-account.decorator.d.ts} +4 -4
- package/dist/decorators/{account.decorator.js → authenticated-account.decorator.js} +8 -10
- package/dist/decorators/index.d.ts +1 -1
- package/dist/decorators/index.js +1 -1
- package/dist/exceptions/authenticated-user-required.exception.d.ts +34 -0
- package/dist/exceptions/authenticated-user-required.exception.js +51 -0
- package/dist/exceptions/bad-body.exception.d.ts +19 -8
- package/dist/exceptions/bad-body.exception.js +26 -10
- package/dist/exceptions/bad-parameter.exception.d.ts +23 -8
- package/dist/exceptions/bad-parameter.exception.js +41 -18
- package/dist/exceptions/duplicate.exception.d.ts +20 -8
- package/dist/exceptions/duplicate.exception.js +27 -10
- package/dist/exceptions/index.d.ts +1 -0
- package/dist/exceptions/index.js +1 -0
- package/dist/functions/add-views-likes-virtuals.function.d.ts +15 -0
- package/dist/functions/add-views-likes-virtuals.function.js +43 -0
- package/dist/functions/create-internal-axios-client.function.js +2 -2
- package/dist/functions/index.d.ts +1 -0
- package/dist/functions/index.js +3 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -5
- package/dist/interceptors/attribute-sanitizer.interceptor.d.ts +68 -0
- package/dist/interceptors/attribute-sanitizer.interceptor.js +154 -0
- package/dist/interceptors/index.d.ts +1 -0
- package/dist/interceptors/index.js +17 -0
- package/dist/middleware/http-logging.middleware.d.ts +19 -0
- package/dist/middleware/http-logging.middleware.js +50 -0
- package/dist/middleware/index.d.ts +1 -0
- package/dist/middleware/index.js +17 -0
- package/dist/models/account.model.d.ts +23 -0
- package/dist/models/account.model.js +59 -0
- package/dist/models/index.d.ts +3 -1
- package/dist/models/index.js +7 -3
- package/dist/{modules/search/models → models}/search-document.model.d.ts +1 -1
- package/dist/{modules/search/models → models}/search-document.model.js +1 -1
- package/dist/models/{account-entity.model.d.ts → user.model.d.ts} +8 -21
- package/dist/models/{account-entity.model.js → user.model.js} +11 -25
- package/dist/modules/authentication/authentication-module-options.interface.d.ts +2 -8
- package/dist/modules/authentication/authentication-options.parameter.d.ts +4 -0
- package/dist/modules/authentication/{inject-auth-options.decorator.js → authentication-options.parameter.js} +5 -2
- package/dist/modules/authentication/authentication.module.d.ts +23 -0
- package/dist/modules/authentication/authentication.module.js +24 -1
- package/dist/modules/authentication/guards/index.d.ts +2 -2
- package/dist/modules/authentication/guards/index.js +7 -7
- package/dist/modules/authentication/guards/jwt-auth.guard.d.ts +17 -0
- package/dist/modules/authentication/guards/jwt-auth.guard.js +67 -0
- package/dist/modules/authentication/guards/permissions.guard.d.ts +5 -27
- package/dist/modules/authentication/guards/permissions.guard.js +27 -59
- package/dist/modules/authentication/guards/public.guard.d.ts +7 -13
- package/dist/modules/authentication/guards/public.guard.js +10 -24
- package/dist/modules/authentication/guards/service-auth.guard.d.ts +22 -0
- package/dist/modules/authentication/guards/service-auth.guard.js +65 -0
- package/dist/modules/authentication/index.d.ts +3 -3
- package/dist/modules/authentication/index.js +3 -5
- package/dist/modules/cache/cache-response.interceptor.d.ts +2 -2
- package/dist/modules/cache/cache-response.interceptor.js +2 -2
- package/dist/modules/cache/index.d.ts +1 -0
- package/dist/modules/cache/index.js +1 -0
- package/dist/modules/comment/comment-module-options.interface.d.ts +38 -0
- package/dist/modules/comment/comment.controller.d.ts +24 -30
- package/dist/modules/comment/comment.controller.js +59 -61
- package/dist/modules/comment/comment.module-definition.d.ts +1 -42
- package/dist/modules/comment/comment.module-definition.js +1 -2
- package/dist/modules/comment/comment.module.d.ts +13 -13
- package/dist/modules/comment/comment.module.js +15 -42
- package/dist/modules/comment/comment.service.d.ts +27 -37
- package/dist/modules/comment/comment.service.js +50 -84
- package/dist/modules/comment/index.d.ts +2 -3
- package/dist/modules/comment/index.js +16 -7
- package/dist/modules/database/database.module.js +2 -5
- package/dist/modules/database/index.d.ts +2 -5
- package/dist/modules/database/index.js +17 -9
- package/dist/modules/index.d.ts +2 -6
- package/dist/modules/index.js +2 -6
- package/dist/modules/like/index.d.ts +2 -1
- package/dist/modules/like/index.js +16 -3
- package/dist/modules/like/like-module-options.interface.d.ts +21 -0
- package/dist/modules/like/like.controller.d.ts +45 -37
- package/dist/modules/like/like.controller.js +117 -102
- package/dist/modules/like/like.module-definition.d.ts +1 -17
- package/dist/modules/like/like.module-definition.js +1 -2
- package/dist/modules/like/like.module.d.ts +12 -12
- package/dist/modules/like/like.module.js +14 -37
- package/dist/modules/like/like.service.d.ts +31 -27
- package/dist/modules/like/like.service.js +42 -35
- package/dist/modules/merge/index.d.ts +3 -0
- package/dist/modules/merge/index.js +19 -0
- package/dist/modules/merge/merge-module-options.interface.d.ts +21 -0
- package/dist/modules/merge/merge.controller.d.ts +30 -0
- package/dist/modules/merge/merge.controller.js +76 -0
- package/dist/modules/merge/merge.module.d.ts +18 -0
- package/dist/modules/merge/merge.module.js +41 -0
- package/dist/modules/merge/merge.service.interface.d.ts +17 -0
- package/dist/modules/services/base-http.service.d.ts +83 -0
- package/dist/modules/services/base-http.service.js +124 -0
- package/dist/modules/services/base-urls.d.ts +22 -0
- package/dist/modules/services/base-urls.js +121 -0
- package/dist/modules/services/index.d.ts +4 -0
- package/dist/modules/services/index.js +20 -0
- package/dist/modules/services/providers/accounts.service.d.ts +52 -0
- package/dist/modules/services/providers/accounts.service.js +84 -0
- package/dist/modules/services/providers/books.service.d.ts +29 -0
- package/dist/modules/services/providers/books.service.js +55 -0
- package/dist/modules/services/providers/changelog.service.d.ts +18 -0
- package/dist/modules/services/providers/changelog.service.js +43 -0
- package/dist/modules/services/providers/comments/comments.service-definition.d.ts +1 -0
- package/dist/modules/services/providers/comments/comments.service-definition.js +4 -0
- package/dist/modules/services/providers/comments/comments.service.d.ts +60 -0
- package/dist/modules/services/providers/comments/comments.service.js +139 -0
- package/dist/modules/services/providers/comments/index.d.ts +1 -0
- package/dist/{factories → modules/services/providers/comments}/index.js +1 -1
- package/dist/modules/services/providers/content/content-return-types.d.ts +19 -0
- package/dist/modules/services/providers/content/content-return-types.js +7 -0
- package/dist/modules/services/providers/content/content.service-definition.d.ts +1 -0
- package/dist/modules/services/providers/content/content.service-definition.js +4 -0
- package/dist/modules/services/providers/content/content.service.d.ts +96 -0
- package/dist/modules/services/providers/content/content.service.js +231 -0
- package/dist/modules/services/providers/content/index.d.ts +2 -0
- package/dist/modules/{search/models → services/providers/content}/index.js +1 -1
- package/dist/modules/services/providers/demo-hive.service.d.ts +29 -0
- package/dist/modules/services/providers/demo-hive.service.js +55 -0
- package/dist/modules/services/providers/events.service.d.ts +29 -0
- package/dist/modules/services/providers/events.service.js +55 -0
- package/dist/modules/services/providers/hackschool.service.d.ts +49 -0
- package/dist/modules/services/providers/hackschool.service.js +79 -0
- package/dist/modules/services/providers/ideas.service.d.ts +18 -0
- package/dist/modules/services/providers/ideas.service.js +43 -0
- package/dist/modules/services/providers/index.d.ts +19 -0
- package/dist/modules/services/providers/index.js +35 -0
- package/dist/modules/services/providers/lunch-roulette.service.d.ts +18 -0
- package/dist/modules/services/providers/lunch-roulette.service.js +43 -0
- package/dist/modules/services/providers/mail/index.d.ts +3 -0
- package/dist/modules/services/providers/mail/index.js +19 -0
- package/dist/modules/services/providers/mail/mail-types.d.ts +30 -0
- package/dist/modules/services/providers/mail/mail-types.js +22 -0
- package/dist/modules/services/providers/mail/mail.service.d.ts +99 -0
- package/dist/modules/{mail → services/providers/mail}/mail.service.js +55 -92
- package/dist/modules/services/providers/newletter.service.d.ts +29 -0
- package/dist/modules/services/providers/newletter.service.js +55 -0
- package/dist/modules/services/providers/newsroom.service.d.ts +47 -0
- package/dist/modules/services/providers/newsroom.service.js +73 -0
- package/dist/modules/services/providers/notification/dtos/schedule-notification.dto.js +2 -0
- package/dist/modules/services/providers/notification/index.d.ts +2 -0
- package/dist/modules/services/providers/notification/index.js +18 -0
- package/dist/modules/services/providers/notification/notification.service-definition.d.ts +1 -0
- package/dist/modules/services/providers/notification/notification.service-definition.js +4 -0
- package/dist/modules/services/providers/notification/notification.service.d.ts +50 -0
- package/dist/modules/services/providers/notification/notification.service.js +130 -0
- package/dist/modules/services/providers/pass/dtos/create-guild-member-pass.dto.js +2 -0
- package/dist/modules/services/providers/pass/dtos/create-team-member-pass.dto.js +2 -0
- package/dist/modules/services/providers/pass/index.d.ts +2 -0
- package/dist/modules/services/providers/pass/index.js +18 -0
- package/dist/modules/services/providers/pass/pass-types.d.ts +18 -0
- package/dist/modules/services/providers/pass/pass-types.js +7 -0
- package/dist/modules/{pass → services/providers/pass}/pass.service.d.ts +15 -39
- package/dist/modules/{pass → services/providers/pass}/pass.service.js +46 -61
- package/dist/modules/services/providers/podcasts.service.d.ts +29 -0
- package/dist/modules/services/providers/podcasts.service.js +55 -0
- package/dist/modules/services/providers/search/dtos/index-search-document.dto.js +2 -0
- package/dist/modules/services/providers/search/index.d.ts +2 -0
- package/dist/modules/services/providers/search/index.js +18 -0
- package/dist/modules/services/providers/search/search.service-definition.d.ts +1 -0
- package/dist/modules/services/providers/search/search.service-definition.js +4 -0
- package/dist/modules/services/providers/search/search.service.d.ts +66 -0
- package/dist/modules/services/providers/search/search.service.js +171 -0
- package/dist/modules/services/providers/team.service.d.ts +29 -0
- package/dist/modules/services/providers/team.service.js +55 -0
- package/dist/modules/services/providers/tech-radar.service.d.ts +39 -0
- package/dist/modules/services/providers/tech-radar.service.js +67 -0
- package/dist/modules/services/services-module-options.interface.d.ts +4 -0
- package/dist/modules/services/services-module-options.interface.js +2 -0
- package/dist/modules/services/services-options.parameter.d.ts +1 -0
- package/dist/modules/services/services-options.parameter.js +8 -0
- package/dist/modules/services/services.module-definition.d.ts +16 -0
- package/dist/modules/services/services.module-definition.js +21 -0
- package/dist/modules/services/services.module.d.ts +17 -0
- package/dist/modules/services/services.module.js +63 -0
- package/dist/pipes/index.d.ts +2 -3
- package/dist/pipes/index.js +2 -3
- package/dist/pipes/params/hub-id.pipe.d.ts +22 -0
- package/dist/pipes/{hub-id.pipe.js → params/hub-id.pipe.js} +14 -17
- package/dist/pipes/params/hub-resource.pipe.d.ts +22 -0
- package/dist/pipes/{hub-resource.pipe.js → params/hub-resource.pipe.js} +19 -20
- package/dist/pipes/params/index.d.ts +3 -0
- package/dist/pipes/params/index.js +19 -0
- package/dist/pipes/params/mongo-id.pipe.d.ts +15 -0
- package/dist/pipes/params/mongo-id.pipe.js +52 -0
- package/dist/pipes/queries/index.d.ts +3 -0
- package/dist/pipes/queries/index.js +19 -0
- package/dist/pipes/queries/mongo-ids.pipe.d.ts +22 -0
- package/dist/pipes/queries/mongo-ids.pipe.js +60 -0
- package/dist/pipes/queries/optional-boolean.pipe.d.ts +29 -0
- package/dist/pipes/queries/optional-boolean.pipe.js +72 -0
- package/dist/pipes/queries/optional-include-drafts.pipe.d.ts +28 -0
- package/dist/pipes/queries/optional-include-drafts.pipe.js +38 -0
- package/dist/properties/content-return-type.property.d.ts +7 -0
- package/dist/properties/content-return-type.property.js +22 -0
- package/dist/properties/index.d.ts +4 -0
- package/dist/properties/index.js +11 -0
- package/dist/properties/likeable.properties.d.ts +1 -0
- package/dist/properties/likeable.properties.js +66 -0
- package/dist/properties/viewable.properties.d.ts +1 -0
- package/dist/properties/viewable.properties.js +66 -0
- package/dist/swagger/index.d.ts +1 -0
- package/dist/swagger/index.js +5 -0
- package/dist/swagger/remove-public-route-auth.plugin.d.ts +9 -0
- package/dist/swagger/remove-public-route-auth.plugin.js +25 -0
- package/dist/swagger/swagger-options.interface.d.ts +14 -0
- package/dist/swagger/swagger-options.interface.js +2 -0
- package/dist/swagger/swagger.function.d.ts +11 -0
- package/dist/swagger/swagger.function.js +47 -0
- package/dist/transform/boolean.transform.js +3 -3
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +18 -0
- package/dist/types/likeable.type.d.ts +15 -0
- package/dist/types/likeable.type.js +2 -0
- package/dist/types/viewable.type.d.ts +15 -0
- package/dist/types/viewable.type.js +2 -0
- package/package.json +2 -2
- package/dist/classes/document-updater.class.d.ts +0 -39
- package/dist/classes/document-updater.class.js +0 -57
- package/dist/factories/index.d.ts +0 -1
- package/dist/factories/virtuals.factory.d.ts +0 -79
- package/dist/factories/virtuals.factory.js +0 -171
- package/dist/http-logger.middleware.d.ts +0 -12
- package/dist/http-logger.middleware.js +0 -43
- package/dist/likeable.interface.d.ts +0 -41
- package/dist/likeable.interface.js +0 -48
- package/dist/modules/authentication/guards/auth.guard.d.ts +0 -36
- package/dist/modules/authentication/guards/auth.guard.js +0 -107
- package/dist/modules/authentication/guards/internal.guard.d.ts +0 -33
- package/dist/modules/authentication/guards/internal.guard.js +0 -72
- package/dist/modules/authentication/inject-auth-options.decorator.d.ts +0 -1
- package/dist/modules/comment/comment.model.d.ts +0 -29
- package/dist/modules/comment/comment.model.js +0 -43
- package/dist/modules/content/content.module-definition.d.ts +0 -5
- package/dist/modules/content/content.module-definition.js +0 -8
- package/dist/modules/content/content.module.d.ts +0 -31
- package/dist/modules/content/content.module.js +0 -60
- package/dist/modules/content/content.service.d.ts +0 -50
- package/dist/modules/content/content.service.js +0 -145
- package/dist/modules/content/index.d.ts +0 -3
- package/dist/modules/content/index.js +0 -9
- package/dist/modules/database/model-service/dbs/hub-account.db.d.ts +0 -28
- package/dist/modules/database/model-service/dbs/hub-account.db.js +0 -44
- package/dist/modules/database/model-service/dbs/hub-books.db.d.ts +0 -23
- package/dist/modules/database/model-service/dbs/hub-books.db.js +0 -45
- package/dist/modules/database/model-service/dbs/hub-comments.db.d.ts +0 -29
- package/dist/modules/database/model-service/dbs/hub-comments.db.js +0 -68
- package/dist/modules/database/model-service/dbs/hub-content.db.d.ts +0 -24
- package/dist/modules/database/model-service/dbs/hub-content.db.js +0 -49
- package/dist/modules/database/model-service/dbs/hub-demo-hive.db.d.ts +0 -23
- package/dist/modules/database/model-service/dbs/hub-demo-hive.db.js +0 -45
- package/dist/modules/database/model-service/dbs/hub-events.db.d.ts +0 -24
- package/dist/modules/database/model-service/dbs/hub-events.db.js +0 -49
- package/dist/modules/database/model-service/dbs/hub-hackschool.db.d.ts +0 -60
- package/dist/modules/database/model-service/dbs/hub-hackschool.db.js +0 -106
- package/dist/modules/database/model-service/dbs/hub-newsroom.db.d.ts +0 -25
- package/dist/modules/database/model-service/dbs/hub-newsroom.db.js +0 -53
- package/dist/modules/database/model-service/dbs/hub-podcasts.db.d.ts +0 -23
- package/dist/modules/database/model-service/dbs/hub-podcasts.db.js +0 -45
- package/dist/modules/database/model-service/dbs/hub-team.db.d.ts +0 -22
- package/dist/modules/database/model-service/dbs/hub-team.db.js +0 -41
- package/dist/modules/database/model-service/dbs/hub-tech-radar.db.d.ts +0 -42
- package/dist/modules/database/model-service/dbs/hub-tech-radar.db.js +0 -81
- package/dist/modules/database/model-service/model.service.d.ts +0 -6407
- package/dist/modules/database/model-service/model.service.js +0 -136
- package/dist/modules/database/populate-service/populate.service.d.ts +0 -73
- package/dist/modules/database/populate-service/populate.service.js +0 -163
- package/dist/modules/database/service-mapper-service/service-mapper.service.d.ts +0 -32
- package/dist/modules/database/service-mapper-service/service-mapper.service.js +0 -73
- package/dist/modules/fetch/fetch.module.d.ts +0 -31
- package/dist/modules/fetch/fetch.module.js +0 -60
- package/dist/modules/fetch/fetch.service.d.ts +0 -153
- package/dist/modules/fetch/fetch.service.js +0 -274
- package/dist/modules/fetch/index.d.ts +0 -2
- package/dist/modules/fetch/index.js +0 -7
- package/dist/modules/mail/index.d.ts +0 -4
- package/dist/modules/mail/index.js +0 -23
- package/dist/modules/mail/mail.module.d.ts +0 -31
- package/dist/modules/mail/mail.module.js +0 -60
- package/dist/modules/mail/mail.service.d.ts +0 -136
- package/dist/modules/notification/index.d.ts +0 -3
- package/dist/modules/notification/index.js +0 -22
- package/dist/modules/notification/notification.module-definition.d.ts +0 -5
- package/dist/modules/notification/notification.module-definition.js +0 -8
- package/dist/modules/notification/notification.module.d.ts +0 -34
- package/dist/modules/notification/notification.module.js +0 -63
- package/dist/modules/notification/notification.service.d.ts +0 -42
- package/dist/modules/notification/notification.service.js +0 -100
- package/dist/modules/pass/index.d.ts +0 -3
- package/dist/modules/pass/index.js +0 -22
- package/dist/modules/pass/pass.module.d.ts +0 -32
- package/dist/modules/pass/pass.module.js +0 -61
- package/dist/modules/search/index.d.ts +0 -4
- package/dist/modules/search/index.js +0 -23
- package/dist/modules/search/models/index.d.ts +0 -1
- package/dist/modules/search/search.module-definition.d.ts +0 -5
- package/dist/modules/search/search.module-definition.js +0 -8
- package/dist/modules/search/search.module.d.ts +0 -33
- package/dist/modules/search/search.module.js +0 -62
- package/dist/modules/search/search.service.d.ts +0 -49
- package/dist/modules/search/search.service.js +0 -120
- package/dist/pipes/hub-id.pipe.d.ts +0 -22
- package/dist/pipes/hub-resource.pipe.d.ts +0 -22
- package/dist/pipes/mongo-id.pipe.d.ts +0 -14
- package/dist/pipes/mongo-id.pipe.js +0 -52
- package/dist/swagger.config.d.ts +0 -36
- package/dist/swagger.config.js +0 -76
- package/dist/viewable.interface.d.ts +0 -41
- package/dist/viewable.interface.js +0 -48
- /package/dist/modules/{mail/dtos/auth-login-token-mail.dto.js → comment/comment-module-options.interface.js} +0 -0
- /package/dist/modules/{mail/dtos/auth-password-reset-mail.dto.js → like/like-module-options.interface.js} +0 -0
- /package/dist/modules/{mail/dtos/event-cancel-mail.dto.js → merge/merge-module-options.interface.js} +0 -0
- /package/dist/modules/{mail/dtos/event-invite-mail.dto.js → merge/merge.service.interface.js} +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/auth-login-token-mail.dto.d.ts +0 -0
- /package/dist/modules/{mail/dtos/idea-status-updated-mail.dto.js → services/providers/mail/dtos/auth-login-token-mail.dto.js} +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/auth-password-reset-mail.dto.d.ts +0 -0
- /package/dist/modules/{mail/dtos/idea-submitted-mail.dto.js → services/providers/mail/dtos/auth-password-reset-mail.dto.js} +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/event-cancel-mail.dto.d.ts +0 -0
- /package/dist/modules/{mail/dtos/lunch-roulette-cancel-mail.dto.js → services/providers/mail/dtos/event-cancel-mail.dto.js} +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/event-invite-mail.dto.d.ts +0 -0
- /package/dist/modules/{mail/dtos/lunch-roulette-matched-mail.dto.js → services/providers/mail/dtos/event-invite-mail.dto.js} +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/idea-status-updated-mail.dto.d.ts +0 -0
- /package/dist/modules/{mail/dtos/lunch-roulette-submitted-mail.dto.js → services/providers/mail/dtos/idea-status-updated-mail.dto.js} +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/idea-submitted-mail.dto.d.ts +0 -0
- /package/dist/modules/{mail/dtos/lunch-roulette-unmatched-mail.dto.js → services/providers/mail/dtos/idea-submitted-mail.dto.js} +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/index.d.ts +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/index.js +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/lunch-roulette-cancel-mail.dto.d.ts +0 -0
- /package/dist/modules/{mail/dtos/newsletter-issue-mail.dto.js → services/providers/mail/dtos/lunch-roulette-cancel-mail.dto.js} +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/lunch-roulette-matched-mail.dto.d.ts +0 -0
- /package/dist/modules/{mail/dtos/newsletter-subscribed-mail.dto.js → services/providers/mail/dtos/lunch-roulette-matched-mail.dto.js} +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/lunch-roulette-submitted-mail.dto.d.ts +0 -0
- /package/dist/modules/{mail/dtos/newsletter-unsubscribed-mail.dto.js → services/providers/mail/dtos/lunch-roulette-submitted-mail.dto.js} +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/lunch-roulette-unmatched-mail.dto.d.ts +0 -0
- /package/dist/modules/{mail/dtos/notification-mail.dto.js → services/providers/mail/dtos/lunch-roulette-unmatched-mail.dto.js} +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/newsletter-issue-mail.dto.d.ts +0 -0
- /package/dist/modules/{notification/dtos/schedule-notification.dto.js → services/providers/mail/dtos/newsletter-issue-mail.dto.js} +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/newsletter-subscribed-mail.dto.d.ts +0 -0
- /package/dist/modules/{pass/dtos/create-guild-member-pass.dto.js → services/providers/mail/dtos/newsletter-subscribed-mail.dto.js} +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/newsletter-unsubscribed-mail.dto.d.ts +0 -0
- /package/dist/modules/{pass/dtos/create-team-member-pass.dto.js → services/providers/mail/dtos/newsletter-unsubscribed-mail.dto.js} +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/notification-mail.dto.d.ts +0 -0
- /package/dist/modules/{search/dtos/index-search-document.dto.js → services/providers/mail/dtos/notification-mail.dto.js} +0 -0
- /package/dist/modules/{mail → services/providers/mail}/models/index.d.ts +0 -0
- /package/dist/modules/{mail → services/providers/mail}/models/index.js +0 -0
- /package/dist/modules/{mail → services/providers/mail}/models/mail-recipient.model.d.ts +0 -0
- /package/dist/modules/{mail → services/providers/mail}/models/mail-recipient.model.js +0 -0
- /package/dist/modules/{notification → services/providers/notification}/dtos/index.d.ts +0 -0
- /package/dist/modules/{notification → services/providers/notification}/dtos/index.js +0 -0
- /package/dist/modules/{notification → services/providers/notification}/dtos/schedule-notification.dto.d.ts +0 -0
- /package/dist/modules/{pass → services/providers/pass}/dtos/create-guild-member-pass.dto.d.ts +0 -0
- /package/dist/modules/{pass → services/providers/pass}/dtos/create-team-member-pass.dto.d.ts +0 -0
- /package/dist/modules/{pass → services/providers/pass}/dtos/index.d.ts +0 -0
- /package/dist/modules/{pass → services/providers/pass}/dtos/index.js +0 -0
- /package/dist/modules/{search → services/providers/search}/dtos/index-search-document.dto.d.ts +0 -0
- /package/dist/modules/{search → services/providers/search}/dtos/index.d.ts +0 -0
- /package/dist/modules/{search → services/providers/search}/dtos/index.js +0 -0
- /package/dist/{modules/content → properties}/content.property.d.ts +0 -0
- /package/dist/{modules/content → properties}/content.property.js +0 -0
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VirtualsFactory = void 0;
|
|
4
|
-
const class_validator_1 = require("class-validator");
|
|
5
|
-
const hub_resource_enum_1 = require("../hub-resource.enum");
|
|
6
|
-
/**
|
|
7
|
-
* VirtualsFactory
|
|
8
|
-
*
|
|
9
|
-
* Provides a fluent, composable API for defining reusable Mongoose virtuals on schemas.
|
|
10
|
-
* Helps keep schema definitions clean and DRY by centralizing the logic for frequently-used
|
|
11
|
-
* virtual references (accounts, comments, likes, etc.), derived values, and hub-based resources.
|
|
12
|
-
*/
|
|
13
|
-
class VirtualsFactory {
|
|
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, resource) {
|
|
19
|
-
this.schema = schema;
|
|
20
|
-
this.resource = resource;
|
|
21
|
-
}
|
|
22
|
-
// ———————————————————————— Core Helper Methods ————————————————————————
|
|
23
|
-
/**
|
|
24
|
-
* Registers a generic virtual with custom Mongoose options.
|
|
25
|
-
*
|
|
26
|
-
* @param {string} name - The virtual field name.
|
|
27
|
-
* @param {VirtualTypeOptions} [options] - The Mongoose virtual options.
|
|
28
|
-
* @returns {VirtualsFactory} - The VirtualsFactory instance for chaining.
|
|
29
|
-
*/
|
|
30
|
-
virtual(name, options) {
|
|
31
|
-
this.schema.virtual(name, options);
|
|
32
|
-
return this;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Registers a virtual referencing a single Account by ID.
|
|
36
|
-
*
|
|
37
|
-
* @param {string} name - Virtual field name.
|
|
38
|
-
* @param {string} localField - Field containing the Account ID.
|
|
39
|
-
*/
|
|
40
|
-
virtualSingleAccount(name, localField) {
|
|
41
|
-
this.schema.virtual(name, {
|
|
42
|
-
ref: 'accounts',
|
|
43
|
-
foreignField: '_id',
|
|
44
|
-
localField,
|
|
45
|
-
justOne: true,
|
|
46
|
-
});
|
|
47
|
-
return this;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Registers a virtual referencing multiple Accounts by ID array.
|
|
51
|
-
*
|
|
52
|
-
* @param {string} name - Virtual field name.
|
|
53
|
-
* @param {string} localField - Field containing array of Account IDs.
|
|
54
|
-
*/
|
|
55
|
-
virtualMultipleAccounts(name, localField) {
|
|
56
|
-
this.schema.virtual(name, {
|
|
57
|
-
ref: 'accounts',
|
|
58
|
-
foreignField: '_id',
|
|
59
|
-
localField,
|
|
60
|
-
justOne: false,
|
|
61
|
-
});
|
|
62
|
-
return this;
|
|
63
|
-
}
|
|
64
|
-
// ———————————————————————— Account-Related Virtuals ————————————————————————
|
|
65
|
-
/** Links `accountId` → `account` (single Account) */
|
|
66
|
-
get account() {
|
|
67
|
-
return this.virtualSingleAccount('account', 'accountId');
|
|
68
|
-
}
|
|
69
|
-
/** Links `accountIds` → `accounts` (multiple Accounts) */
|
|
70
|
-
get accounts() {
|
|
71
|
-
return this.virtualMultipleAccounts('accounts', 'accountIds');
|
|
72
|
-
}
|
|
73
|
-
/** Links `authorId` → `author` (single Account) */
|
|
74
|
-
get author() {
|
|
75
|
-
return this.virtualSingleAccount('author', 'authorId');
|
|
76
|
-
}
|
|
77
|
-
/** Links `authorIds` → `authors` (multiple Accounts) */
|
|
78
|
-
get authors() {
|
|
79
|
-
return this.virtualMultipleAccounts('authors', 'authorIds');
|
|
80
|
-
}
|
|
81
|
-
/** Links `submitterId` → `submitter` (single Account) */
|
|
82
|
-
get submitter() {
|
|
83
|
-
return this.virtualSingleAccount('submitter', 'submitterId');
|
|
84
|
-
}
|
|
85
|
-
/** Links `submitterIds` → `submitters` (multiple Accounts) */
|
|
86
|
-
get submitters() {
|
|
87
|
-
return this.virtualMultipleAccounts('submitters', 'submitterIds');
|
|
88
|
-
}
|
|
89
|
-
/** Links `contactId` → `contact` (single Account) */
|
|
90
|
-
get contact() {
|
|
91
|
-
return this.virtualSingleAccount('contact', 'contactId');
|
|
92
|
-
}
|
|
93
|
-
/** Links `contactIds` → `contacts` (multiple Accounts) */
|
|
94
|
-
get contacts() {
|
|
95
|
-
return this.virtualMultipleAccounts('contacts', 'contactIds');
|
|
96
|
-
}
|
|
97
|
-
/** Links `_viewedBy` → `viewedBy` and creates derived `views` counter */
|
|
98
|
-
get views() {
|
|
99
|
-
this.virtualMultipleAccounts('viewedBy', '_viewedBy');
|
|
100
|
-
this.schema.virtual('views').get(function () {
|
|
101
|
-
return (0, class_validator_1.isArray)(this._viewedBy) ? this._viewedBy.length : 0;
|
|
102
|
-
});
|
|
103
|
-
return this;
|
|
104
|
-
}
|
|
105
|
-
/** Links `_likedBy` → `likedBy` and creates derived `likes` counter */
|
|
106
|
-
get likes() {
|
|
107
|
-
this.virtualMultipleAccounts('likedBy', '_likedBy');
|
|
108
|
-
this.schema.virtual('likes').get(function () {
|
|
109
|
-
return (0, class_validator_1.isArray)(this._likedBy) ? this._likedBy.length : 0;
|
|
110
|
-
});
|
|
111
|
-
return this;
|
|
112
|
-
}
|
|
113
|
-
// ———————————————————————— Comment-Related Virtuals ————————————————————————
|
|
114
|
-
/**
|
|
115
|
-
* Creates `comments` virtual for top-level comments on the resource.
|
|
116
|
-
* Filters out replies.
|
|
117
|
-
*/
|
|
118
|
-
get comments() {
|
|
119
|
-
this.schema.virtual('comments', {
|
|
120
|
-
ref: 'comments',
|
|
121
|
-
foreignField: '_resourceId',
|
|
122
|
-
localField: '_id',
|
|
123
|
-
match: {
|
|
124
|
-
_resource: this.resource,
|
|
125
|
-
_replyTo: { $exists: false },
|
|
126
|
-
},
|
|
127
|
-
justOne: false,
|
|
128
|
-
});
|
|
129
|
-
return this;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Creates `commentsCount` virtual for counting all related comments on this resource.
|
|
133
|
-
*/
|
|
134
|
-
get commentsCount() {
|
|
135
|
-
this.schema.virtual('commentsCount', {
|
|
136
|
-
ref: 'comments',
|
|
137
|
-
foreignField: '_resourceId',
|
|
138
|
-
localField: '_id',
|
|
139
|
-
match: { _resource: this.resource },
|
|
140
|
-
count: true,
|
|
141
|
-
});
|
|
142
|
-
return this;
|
|
143
|
-
}
|
|
144
|
-
// ———————————————————————— Content and Utility Virtuals ————————————————————————
|
|
145
|
-
/**
|
|
146
|
-
* Creates an empty virtual field for general content use.
|
|
147
|
-
* Placeholder to support virtual getter/setter extension in custom implementations.
|
|
148
|
-
*/
|
|
149
|
-
get content() {
|
|
150
|
-
this.schema.virtual('content');
|
|
151
|
-
return this;
|
|
152
|
-
}
|
|
153
|
-
// ———————————————————————— Hub Resource Virtuals ————————————————————————
|
|
154
|
-
/**
|
|
155
|
-
* Registers `ref-[resource]` virtuals for each known Hub resource.
|
|
156
|
-
* Used for polymorphic document relationships in the platform.
|
|
157
|
-
*/
|
|
158
|
-
get hubResources() {
|
|
159
|
-
for (const resource of hub_resource_enum_1.HUB_RESOURCES) {
|
|
160
|
-
this.schema.virtual(`ref-${resource}`, {
|
|
161
|
-
ref: resource,
|
|
162
|
-
foreignField: '_id',
|
|
163
|
-
localField: '_resourceId',
|
|
164
|
-
match: { _resource: resource },
|
|
165
|
-
justOne: true,
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
return this;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
exports.VirtualsFactory = VirtualsFactory;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { INestApplication } from '@nestjs/common';
|
|
2
|
-
/**
|
|
3
|
-
* @function setupHttpLoggingMiddleware
|
|
4
|
-
* @description
|
|
5
|
-
* Attaches a middleware to the given NestJS application instance for logging HTTP requests and responses.
|
|
6
|
-
* This middleware logs only non-API and non-internal requests to avoid log clutter from system or Swagger routes.
|
|
7
|
-
* Logs include the HTTP method, original URL, response status code, and message.
|
|
8
|
-
*
|
|
9
|
-
* @param {INestApplication} app - The NestJS application to which the logging middleware will be applied.
|
|
10
|
-
* @returns {void}
|
|
11
|
-
*/
|
|
12
|
-
export declare function setupHttpLoggingMiddleware(app: INestApplication): void;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setupHttpLoggingMiddleware = setupHttpLoggingMiddleware;
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
5
|
-
/**
|
|
6
|
-
* @function setupHttpLoggingMiddleware
|
|
7
|
-
* @description
|
|
8
|
-
* Attaches a middleware to the given NestJS application instance for logging HTTP requests and responses.
|
|
9
|
-
* This middleware logs only non-API and non-internal requests to avoid log clutter from system or Swagger routes.
|
|
10
|
-
* Logs include the HTTP method, original URL, response status code, and message.
|
|
11
|
-
*
|
|
12
|
-
* @param {INestApplication} app - The NestJS application to which the logging middleware will be applied.
|
|
13
|
-
* @returns {void}
|
|
14
|
-
*/
|
|
15
|
-
function setupHttpLoggingMiddleware(app) {
|
|
16
|
-
app.use((req, res, next) => {
|
|
17
|
-
const { method, url } = req;
|
|
18
|
-
// Define a list of routes to exclude from logging to prevent unnecessary noise
|
|
19
|
-
const excludedPaths = ['/alive', '/favicon.ico'];
|
|
20
|
-
// Skip logging for known non-critical paths and documentation endpoints
|
|
21
|
-
const isSwagger = url.includes('swagger');
|
|
22
|
-
const isApiInternal = url.startsWith('/api');
|
|
23
|
-
const isExcluded = excludedPaths.includes(url);
|
|
24
|
-
if (isSwagger || isApiInternal || isExcluded) {
|
|
25
|
-
next(); // Skip logging logic for ignored routes
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
// Log response info once the request lifecycle completes
|
|
29
|
-
res.on('finish', () => {
|
|
30
|
-
const { statusCode, statusMessage } = res;
|
|
31
|
-
// Construct log entry using standardized format
|
|
32
|
-
const message = `${method} ${url} - ${statusCode} (${statusMessage})`;
|
|
33
|
-
// Use 'warn' log level for client errors, otherwise use standard 'log'
|
|
34
|
-
const level = statusCode >= 400 && statusCode < 500 ? 'warn' : 'log';
|
|
35
|
-
// Avoid logging again if the path is excluded
|
|
36
|
-
if (!excludedPaths.includes(url)) {
|
|
37
|
-
new common_1.Logger('HTTP')[level](message);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
// Proceed to next middleware or route handler
|
|
41
|
-
next();
|
|
42
|
-
});
|
|
43
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Interface for entities that can be liked by users. Used to track engagement metrics
|
|
3
|
-
* such as user interest or approval. Fields include a reference to user IDs and a count of total likes.
|
|
4
|
-
*
|
|
5
|
-
* Intended to be implemented or extended by Mongoose documents representing likeable resources.
|
|
6
|
-
*/
|
|
7
|
-
export interface Likeable {
|
|
8
|
-
/**
|
|
9
|
-
* List of account IDs who have liked this entity.
|
|
10
|
-
*/
|
|
11
|
-
_likedBy: string[];
|
|
12
|
-
/**
|
|
13
|
-
* Count of total likes.
|
|
14
|
-
*/
|
|
15
|
-
likes: number;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Mongoose property decorator for defining the `_likedBy` field.
|
|
19
|
-
* This field is required and initialized with an empty array to ensure consistency.
|
|
20
|
-
*
|
|
21
|
-
* Useful for tracking which accounts have liked a particular document.
|
|
22
|
-
*
|
|
23
|
-
* @returns {PropertyDecorator} - Mongoose property configuration for `_likedBy`.
|
|
24
|
-
*/
|
|
25
|
-
export declare function PropertyLikedBy(): PropertyDecorator;
|
|
26
|
-
/**
|
|
27
|
-
* Swagger property decorator for documenting the `_likedBy` field in API specs.
|
|
28
|
-
* Describes the field as an array of `AccountEntity` and documents its usage.
|
|
29
|
-
*
|
|
30
|
-
* This improves visibility in auto-generated API docs for consumers of likeable entities.
|
|
31
|
-
*
|
|
32
|
-
* @returns {PropertyDecorator} - Swagger metadata for the `_likedBy` field.
|
|
33
|
-
*/
|
|
34
|
-
export declare function ApiLikedBy(): PropertyDecorator;
|
|
35
|
-
/**
|
|
36
|
-
* Swagger property decorator for documenting the `likes` field in API responses.
|
|
37
|
-
* Represents the total number of likes and helps clarify it is derived/cached.
|
|
38
|
-
*
|
|
39
|
-
* @returns {PropertyDecorator} - Swagger metadata for the `likes` field.
|
|
40
|
-
*/
|
|
41
|
-
export declare function ApiLikes(): PropertyDecorator;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PropertyLikedBy = PropertyLikedBy;
|
|
4
|
-
exports.ApiLikedBy = ApiLikedBy;
|
|
5
|
-
exports.ApiLikes = ApiLikes;
|
|
6
|
-
const mongoose_1 = require("@nestjs/mongoose");
|
|
7
|
-
const swagger_1 = require("@nestjs/swagger");
|
|
8
|
-
const models_1 = require("./models");
|
|
9
|
-
/**
|
|
10
|
-
* Mongoose property decorator for defining the `_likedBy` field.
|
|
11
|
-
* This field is required and initialized with an empty array to ensure consistency.
|
|
12
|
-
*
|
|
13
|
-
* Useful for tracking which accounts have liked a particular document.
|
|
14
|
-
*
|
|
15
|
-
* @returns {PropertyDecorator} - Mongoose property configuration for `_likedBy`.
|
|
16
|
-
*/
|
|
17
|
-
function PropertyLikedBy() {
|
|
18
|
-
return (0, mongoose_1.Prop)({ required: true, default: () => [] });
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Swagger property decorator for documenting the `_likedBy` field in API specs.
|
|
22
|
-
* Describes the field as an array of `AccountEntity` and documents its usage.
|
|
23
|
-
*
|
|
24
|
-
* This improves visibility in auto-generated API docs for consumers of likeable entities.
|
|
25
|
-
*
|
|
26
|
-
* @returns {PropertyDecorator} - Swagger metadata for the `_likedBy` field.
|
|
27
|
-
*/
|
|
28
|
-
function ApiLikedBy() {
|
|
29
|
-
return (0, swagger_1.ApiProperty)({
|
|
30
|
-
name: 'likedBy',
|
|
31
|
-
type: [models_1.AccountEntity],
|
|
32
|
-
default: [],
|
|
33
|
-
description: 'The accounts who have liked the entity.',
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Swagger property decorator for documenting the `likes` field in API responses.
|
|
38
|
-
* Represents the total number of likes and helps clarify it is derived/cached.
|
|
39
|
-
*
|
|
40
|
-
* @returns {PropertyDecorator} - Swagger metadata for the `likes` field.
|
|
41
|
-
*/
|
|
42
|
-
function ApiLikes() {
|
|
43
|
-
return (0, swagger_1.ApiProperty)({
|
|
44
|
-
type: Number,
|
|
45
|
-
default: 0,
|
|
46
|
-
description: 'The number of likes this entity has received.',
|
|
47
|
-
});
|
|
48
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { CanActivate, ExecutionContext } from '@nestjs/common';
|
|
2
|
-
import { Reflector } from '@nestjs/core';
|
|
3
|
-
import { JwtService } from '@nestjs/jwt';
|
|
4
|
-
import { AuthenticationModuleOptions } from '../authentication-module-options.interface';
|
|
5
|
-
/**
|
|
6
|
-
* AuthGuard
|
|
7
|
-
*
|
|
8
|
-
* @class
|
|
9
|
-
* Implements route-level security using JWT authentication.
|
|
10
|
-
* Allows bypassing auth for routes marked with the `IS_PUBLIC_METADATA_KEY` metadata.
|
|
11
|
-
* If authentication is required, verifies the JWT and attaches the decoded payload to the request object.
|
|
12
|
-
*/
|
|
13
|
-
export declare class AuthGuard implements CanActivate {
|
|
14
|
-
private readonly authOptions;
|
|
15
|
-
private readonly jwtService;
|
|
16
|
-
private readonly reflector;
|
|
17
|
-
constructor(authOptions: AuthenticationModuleOptions, jwtService: JwtService, reflector: Reflector);
|
|
18
|
-
/**
|
|
19
|
-
* Evaluates if the current request is authorized to proceed.
|
|
20
|
-
* Skips JWT validation for routes marked as public.
|
|
21
|
-
* If the route is protected, validates the JWT and attaches user data to the request.
|
|
22
|
-
*
|
|
23
|
-
* @param {ExecutionContext} context - The current request execution context.
|
|
24
|
-
* @returns {boolean} Whether the request is allowed to proceed.
|
|
25
|
-
* @throws {UnauthorizedException} If JWT is missing or invalid.
|
|
26
|
-
*/
|
|
27
|
-
canActivate(context: ExecutionContext): boolean;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Decorator that applies JWT authentication to a route or controller.
|
|
31
|
-
* Combines NestJS guards and Swagger decorators to enforce security
|
|
32
|
-
* and document the authentication requirement.
|
|
33
|
-
*
|
|
34
|
-
* @returns {MethodDecorator & ClassDecorator} A decorator that enforces JWT authentication.
|
|
35
|
-
*/
|
|
36
|
-
export declare function RequireJwtAuth(): MethodDecorator & ClassDecorator;
|
|
@@ -1,107 +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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.AuthGuard = void 0;
|
|
16
|
-
exports.RequireJwtAuth = RequireJwtAuth;
|
|
17
|
-
const common_1 = require("@nestjs/common");
|
|
18
|
-
const core_1 = require("@nestjs/core");
|
|
19
|
-
const jwt_1 = require("@nestjs/jwt");
|
|
20
|
-
const swagger_1 = require("@nestjs/swagger");
|
|
21
|
-
const inject_auth_options_decorator_1 = require("../inject-auth-options.decorator");
|
|
22
|
-
const public_guard_1 = require("./public.guard");
|
|
23
|
-
/**
|
|
24
|
-
* AuthGuard
|
|
25
|
-
*
|
|
26
|
-
* @class
|
|
27
|
-
* Implements route-level security using JWT authentication.
|
|
28
|
-
* Allows bypassing auth for routes marked with the `IS_PUBLIC_METADATA_KEY` metadata.
|
|
29
|
-
* If authentication is required, verifies the JWT and attaches the decoded payload to the request object.
|
|
30
|
-
*/
|
|
31
|
-
let AuthGuard = class AuthGuard {
|
|
32
|
-
constructor(authOptions, jwtService, reflector) {
|
|
33
|
-
this.authOptions = authOptions;
|
|
34
|
-
this.jwtService = jwtService;
|
|
35
|
-
this.reflector = reflector;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Evaluates if the current request is authorized to proceed.
|
|
39
|
-
* Skips JWT validation for routes marked as public.
|
|
40
|
-
* If the route is protected, validates the JWT and attaches user data to the request.
|
|
41
|
-
*
|
|
42
|
-
* @param {ExecutionContext} context - The current request execution context.
|
|
43
|
-
* @returns {boolean} Whether the request is allowed to proceed.
|
|
44
|
-
* @throws {UnauthorizedException} If JWT is missing or invalid.
|
|
45
|
-
*/
|
|
46
|
-
canActivate(context) {
|
|
47
|
-
const isPublicRoute = this.reflector.getAllAndOverride(public_guard_1.IS_PUBLIC_METADATA_KEY, [
|
|
48
|
-
context.getHandler(),
|
|
49
|
-
context.getClass(),
|
|
50
|
-
]);
|
|
51
|
-
if (isPublicRoute)
|
|
52
|
-
return true; // Public route; skip auth.
|
|
53
|
-
const request = context.switchToHttp().getRequest();
|
|
54
|
-
const token = extractBearerToken(request);
|
|
55
|
-
if (!token) {
|
|
56
|
-
// No token found in request headers.
|
|
57
|
-
throw new common_1.UnauthorizedException('Authorization token not found.');
|
|
58
|
-
}
|
|
59
|
-
try {
|
|
60
|
-
// Attempt to verify token using configured JWT secret.
|
|
61
|
-
const decodedUser = this.jwtService.verify(token, { secret: this.authOptions.jwtSecret });
|
|
62
|
-
// Attach the decoded JWT payload to the request object for later use.
|
|
63
|
-
request['user'] = decodedUser;
|
|
64
|
-
}
|
|
65
|
-
catch (_a) {
|
|
66
|
-
// Verification failed: could be malformed, expired, or invalid signature.
|
|
67
|
-
throw new common_1.UnauthorizedException('Invalid or expired token.');
|
|
68
|
-
}
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
exports.AuthGuard = AuthGuard;
|
|
73
|
-
exports.AuthGuard = AuthGuard = __decorate([
|
|
74
|
-
(0, common_1.Injectable)(),
|
|
75
|
-
__param(0, (0, inject_auth_options_decorator_1.InjectAuthOptions)()),
|
|
76
|
-
__metadata("design:paramtypes", [Object, jwt_1.JwtService,
|
|
77
|
-
core_1.Reflector])
|
|
78
|
-
], AuthGuard);
|
|
79
|
-
/**
|
|
80
|
-
* Extracts a JWT from the Authorization header of the HTTP request.
|
|
81
|
-
* Accepts only the 'Bearer <token>' format.
|
|
82
|
-
*
|
|
83
|
-
* @param {Request} request - Incoming HTTP request from the client.
|
|
84
|
-
* @returns {string | undefined} The extracted token if present and valid; otherwise, undefined.
|
|
85
|
-
*/
|
|
86
|
-
function extractBearerToken(request) {
|
|
87
|
-
const authorizationHeader = request.headers.authorization;
|
|
88
|
-
if (!authorizationHeader)
|
|
89
|
-
return undefined;
|
|
90
|
-
const [scheme, token] = authorizationHeader.split(' ');
|
|
91
|
-
// Only accept Bearer token format
|
|
92
|
-
if (scheme !== 'Bearer' || !(token === null || token === void 0 ? void 0 : token.trim())) {
|
|
93
|
-
return undefined;
|
|
94
|
-
}
|
|
95
|
-
return token;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Decorator that applies JWT authentication to a route or controller.
|
|
99
|
-
* Combines NestJS guards and Swagger decorators to enforce security
|
|
100
|
-
* and document the authentication requirement.
|
|
101
|
-
*
|
|
102
|
-
* @returns {MethodDecorator & ClassDecorator} A decorator that enforces JWT authentication.
|
|
103
|
-
*/
|
|
104
|
-
function RequireJwtAuth() {
|
|
105
|
-
return (0, common_1.applyDecorators)((0, common_1.UseGuards)(AuthGuard), (0, swagger_1.ApiBearerAuth)(), // Indicates that the route uses bearer token auth.
|
|
106
|
-
(0, swagger_1.ApiUnauthorizedResponse)({ description: 'Unauthorized: Invalid or missing JWT' }));
|
|
107
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { CanActivate, ExecutionContext } from '@nestjs/common';
|
|
2
|
-
import { AuthenticationModuleOptions } from '../authentication-module-options.interface';
|
|
3
|
-
/**
|
|
4
|
-
* INTERNAL_HEADER_KEY
|
|
5
|
-
*
|
|
6
|
-
* Custom HTTP header used to validate internal Kubernetes-based requests.
|
|
7
|
-
* This header must contain a pre-configured token for access to protected internal routes.
|
|
8
|
-
*/
|
|
9
|
-
export declare const INTERNAL_HEADER_KEY = "X-itlab-k8s-auth";
|
|
10
|
-
/**
|
|
11
|
-
* Guard that validates incoming requests against a shared internal token,
|
|
12
|
-
* typically used for internal service-to-service communication (e.g. from Kubernetes).
|
|
13
|
-
* Only requests with a matching token in the `X-itlab-k8s-auth` header are authorized.
|
|
14
|
-
*/
|
|
15
|
-
export declare class InternalGuard implements CanActivate {
|
|
16
|
-
private readonly authOptions;
|
|
17
|
-
constructor(authOptions: AuthenticationModuleOptions);
|
|
18
|
-
/**
|
|
19
|
-
* Determines whether the request contains a valid internal auth token.
|
|
20
|
-
*
|
|
21
|
-
* @param {ExecutionContext} context - The current execution context of the request.
|
|
22
|
-
* @returns {boolean} Whether the request is authorized.
|
|
23
|
-
* @throws {UnauthorizedException} If the token is missing or invalid.
|
|
24
|
-
*/
|
|
25
|
-
canActivate(context: ExecutionContext): boolean;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Decorator that secures a controller or route to only be accessible by internal services
|
|
29
|
-
* using the `InternalGuard`. Adds Swagger docs indicating the required custom header.
|
|
30
|
-
*
|
|
31
|
-
* @returns {MethodDecorator & ClassDecorator} Decorator to enforce internal-only access.
|
|
32
|
-
*/
|
|
33
|
-
export declare function InternalOnly(): MethodDecorator & ClassDecorator;
|
|
@@ -1,72 +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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.InternalGuard = exports.INTERNAL_HEADER_KEY = void 0;
|
|
16
|
-
exports.InternalOnly = InternalOnly;
|
|
17
|
-
const common_1 = require("@nestjs/common");
|
|
18
|
-
const swagger_1 = require("@nestjs/swagger");
|
|
19
|
-
const inject_auth_options_decorator_1 = require("../inject-auth-options.decorator");
|
|
20
|
-
/**
|
|
21
|
-
* INTERNAL_HEADER_KEY
|
|
22
|
-
*
|
|
23
|
-
* Custom HTTP header used to validate internal Kubernetes-based requests.
|
|
24
|
-
* This header must contain a pre-configured token for access to protected internal routes.
|
|
25
|
-
*/
|
|
26
|
-
exports.INTERNAL_HEADER_KEY = 'X-itlab-k8s-auth';
|
|
27
|
-
/**
|
|
28
|
-
* Guard that validates incoming requests against a shared internal token,
|
|
29
|
-
* typically used for internal service-to-service communication (e.g. from Kubernetes).
|
|
30
|
-
* Only requests with a matching token in the `X-itlab-k8s-auth` header are authorized.
|
|
31
|
-
*/
|
|
32
|
-
let InternalGuard = class InternalGuard {
|
|
33
|
-
constructor(authOptions) {
|
|
34
|
-
this.authOptions = authOptions;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Determines whether the request contains a valid internal auth token.
|
|
38
|
-
*
|
|
39
|
-
* @param {ExecutionContext} context - The current execution context of the request.
|
|
40
|
-
* @returns {boolean} Whether the request is authorized.
|
|
41
|
-
* @throws {UnauthorizedException} If the token is missing or invalid.
|
|
42
|
-
*/
|
|
43
|
-
canActivate(context) {
|
|
44
|
-
const request = context.switchToHttp().getRequest();
|
|
45
|
-
const tokenFromHeader = request.header(exports.INTERNAL_HEADER_KEY);
|
|
46
|
-
// Allow request only if the token matches the one provided via configuration.
|
|
47
|
-
const isTokenValid = tokenFromHeader && tokenFromHeader === this.authOptions.k8sToken;
|
|
48
|
-
if (!isTokenValid) {
|
|
49
|
-
throw new common_1.UnauthorizedException('Application unauthorized');
|
|
50
|
-
}
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
exports.InternalGuard = InternalGuard;
|
|
55
|
-
exports.InternalGuard = InternalGuard = __decorate([
|
|
56
|
-
(0, common_1.Injectable)(),
|
|
57
|
-
__param(0, (0, inject_auth_options_decorator_1.InjectAuthOptions)()),
|
|
58
|
-
__metadata("design:paramtypes", [Object])
|
|
59
|
-
], InternalGuard);
|
|
60
|
-
/**
|
|
61
|
-
* Decorator that secures a controller or route to only be accessible by internal services
|
|
62
|
-
* using the `InternalGuard`. Adds Swagger docs indicating the required custom header.
|
|
63
|
-
*
|
|
64
|
-
* @returns {MethodDecorator & ClassDecorator} Decorator to enforce internal-only access.
|
|
65
|
-
*/
|
|
66
|
-
function InternalOnly() {
|
|
67
|
-
return (0, common_1.applyDecorators)((0, common_1.UseGuards)(InternalGuard),
|
|
68
|
-
// Adds Swagger documentation for the custom basic auth header.
|
|
69
|
-
(0, swagger_1.ApiBasicAuth)(exports.INTERNAL_HEADER_KEY),
|
|
70
|
-
// Documents the 403 Forbidden response when access is denied.
|
|
71
|
-
(0, swagger_1.ApiForbiddenResponse)({ description: 'Application unauthorized' }));
|
|
72
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function InjectAuthOptions(): ParameterDecorator;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a single user-generated comment entry in the system.
|
|
3
|
-
*
|
|
4
|
-
* Encapsulates information about the author, creation time, and comment content,
|
|
5
|
-
* including support for rich text (HTML-formatted) body.
|
|
6
|
-
*/
|
|
7
|
-
export declare class Comment {
|
|
8
|
-
/**
|
|
9
|
-
* Identifier of the user who authored the comment.
|
|
10
|
-
* Used to associate the comment with a specific account.
|
|
11
|
-
*
|
|
12
|
-
* @example "000000000000000000000000"
|
|
13
|
-
*/
|
|
14
|
-
authorId: string;
|
|
15
|
-
/**
|
|
16
|
-
* UNIX timestamp of when the comment was created.
|
|
17
|
-
* Used for ordering and displaying relative or absolute creation time.
|
|
18
|
-
*
|
|
19
|
-
* @example 1625074800
|
|
20
|
-
*/
|
|
21
|
-
timestamp: number;
|
|
22
|
-
/**
|
|
23
|
-
* The content of the comment, formatted as rich HTML.
|
|
24
|
-
* Enables structured presentation (e.g., paragraphs, links).
|
|
25
|
-
*
|
|
26
|
-
* @example "<p>Hello World</p>"
|
|
27
|
-
*/
|
|
28
|
-
richtext: string;
|
|
29
|
-
}
|
|
@@ -1,43 +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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.Comment = void 0;
|
|
13
|
-
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
-
/**
|
|
15
|
-
* Represents a single user-generated comment entry in the system.
|
|
16
|
-
*
|
|
17
|
-
* Encapsulates information about the author, creation time, and comment content,
|
|
18
|
-
* including support for rich text (HTML-formatted) body.
|
|
19
|
-
*/
|
|
20
|
-
class Comment {
|
|
21
|
-
}
|
|
22
|
-
exports.Comment = Comment;
|
|
23
|
-
__decorate([
|
|
24
|
-
(0, swagger_1.ApiProperty)({
|
|
25
|
-
description: 'ID of the comment author',
|
|
26
|
-
example: '000000000000000000000000',
|
|
27
|
-
}),
|
|
28
|
-
__metadata("design:type", String)
|
|
29
|
-
], Comment.prototype, "authorId", void 0);
|
|
30
|
-
__decorate([
|
|
31
|
-
(0, swagger_1.ApiProperty)({
|
|
32
|
-
description: 'Timestamp when the comment was created (UNIX format)',
|
|
33
|
-
example: 1625074800,
|
|
34
|
-
}),
|
|
35
|
-
__metadata("design:type", Number)
|
|
36
|
-
], Comment.prototype, "timestamp", void 0);
|
|
37
|
-
__decorate([
|
|
38
|
-
(0, swagger_1.ApiProperty)({
|
|
39
|
-
description: 'HTML-formatted comment content',
|
|
40
|
-
example: '<p>Hello World</p>',
|
|
41
|
-
}),
|
|
42
|
-
__metadata("design:type", String)
|
|
43
|
-
], Comment.prototype, "richtext", void 0);
|
|
@@ -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');
|