@carlonicora/nestjs-neo4jsonapi 1.115.1 → 1.116.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bootstrap/app.module.factory.d.ts.map +1 -1
- package/dist/bootstrap/app.module.factory.js +1 -0
- package/dist/bootstrap/app.module.factory.js.map +1 -1
- package/dist/bootstrap/bootstrap.options.d.ts +17 -0
- package/dist/bootstrap/bootstrap.options.d.ts.map +1 -1
- package/dist/common/guards/jwt.auth.guard.d.ts +3 -2
- package/dist/common/guards/jwt.auth.guard.d.ts.map +1 -1
- package/dist/common/guards/jwt.auth.guard.js +7 -2
- package/dist/common/guards/jwt.auth.guard.js.map +1 -1
- package/dist/common/interfaces/entity.schema.interface.d.ts +2 -0
- package/dist/common/interfaces/entity.schema.interface.d.ts.map +1 -1
- package/dist/common/tokens.d.ts +64 -0
- package/dist/common/tokens.d.ts.map +1 -1
- package/dist/common/tokens.js +37 -2
- package/dist/common/tokens.js.map +1 -1
- package/dist/config/base.config.d.ts.map +1 -1
- package/dist/config/base.config.js +1 -0
- package/dist/config/base.config.js.map +1 -1
- package/dist/config/enums/queue.id.d.ts +2 -1
- package/dist/config/enums/queue.id.d.ts.map +1 -1
- package/dist/config/enums/queue.id.js +1 -0
- package/dist/config/enums/queue.id.js.map +1 -1
- package/dist/config/interfaces/config.auth.interface.d.ts +7 -0
- package/dist/config/interfaces/config.auth.interface.d.ts.map +1 -1
- package/dist/config/interfaces/config.email.interface.d.ts +6 -0
- package/dist/config/interfaces/config.email.interface.d.ts.map +1 -1
- package/dist/core/email/services/email.service.d.ts +1 -0
- package/dist/core/email/services/email.service.d.ts.map +1 -1
- package/dist/core/email/services/email.service.js +10 -7
- package/dist/core/email/services/email.service.js.map +1 -1
- package/dist/core/llm/services/llm.service.d.ts +9 -1
- package/dist/core/llm/services/llm.service.d.ts.map +1 -1
- package/dist/core/llm/services/llm.service.js +13 -3
- package/dist/core/llm/services/llm.service.js.map +1 -1
- package/dist/core/neo4j/abstracts/abstract.repository.d.ts.map +1 -1
- package/dist/core/neo4j/abstracts/abstract.repository.js +33 -2
- package/dist/core/neo4j/abstracts/abstract.repository.js.map +1 -1
- package/dist/foundations/auth/auth.module.d.ts.map +1 -1
- package/dist/foundations/auth/auth.module.js +9 -10
- package/dist/foundations/auth/auth.module.js.map +1 -1
- package/dist/foundations/auth/controllers/auth.controller.d.ts.map +1 -1
- package/dist/foundations/auth/controllers/auth.controller.js +5 -0
- package/dist/foundations/auth/controllers/auth.controller.js.map +1 -1
- package/dist/foundations/auth/controllers/auth.discord.controller.d.ts.map +1 -1
- package/dist/foundations/auth/controllers/auth.discord.controller.js +6 -3
- package/dist/foundations/auth/controllers/auth.discord.controller.js.map +1 -1
- package/dist/foundations/auth/controllers/auth.google.controller.d.ts.map +1 -1
- package/dist/foundations/auth/controllers/auth.google.controller.js +7 -3
- package/dist/foundations/auth/controllers/auth.google.controller.js.map +1 -1
- package/dist/foundations/auth/entities/auth.code.d.ts +34 -0
- package/dist/foundations/auth/entities/auth.code.d.ts.map +1 -0
- package/dist/foundations/auth/entities/auth.code.js +53 -0
- package/dist/foundations/auth/entities/auth.code.js.map +1 -0
- package/dist/foundations/auth/entities/auth.d.ts +41 -0
- package/dist/foundations/auth/entities/auth.d.ts.map +1 -0
- package/dist/foundations/auth/entities/auth.js +68 -0
- package/dist/foundations/auth/entities/auth.js.map +1 -0
- package/dist/foundations/auth/entities/pending-auth.d.ts +39 -0
- package/dist/foundations/auth/entities/pending-auth.d.ts.map +1 -0
- package/dist/foundations/auth/entities/pending-auth.js +41 -0
- package/dist/foundations/auth/entities/pending-auth.js.map +1 -0
- package/dist/foundations/auth/index.d.ts +13 -0
- package/dist/foundations/auth/index.d.ts.map +1 -1
- package/dist/foundations/auth/index.js +31 -1
- package/dist/foundations/auth/index.js.map +1 -1
- package/dist/foundations/auth/repositories/auth.repository.d.ts +49 -9
- package/dist/foundations/auth/repositories/auth.repository.d.ts.map +1 -1
- package/dist/foundations/auth/repositories/auth.repository.js +115 -63
- package/dist/foundations/auth/repositories/auth.repository.js.map +1 -1
- package/dist/foundations/auth/services/auth.discord.service.d.ts +1 -1
- package/dist/foundations/auth/services/auth.discord.service.d.ts.map +1 -1
- package/dist/foundations/auth/services/auth.discord.service.js +5 -2
- package/dist/foundations/auth/services/auth.discord.service.js.map +1 -1
- package/dist/foundations/auth/services/auth.google.service.d.ts +1 -1
- package/dist/foundations/auth/services/auth.google.service.d.ts.map +1 -1
- package/dist/foundations/auth/services/auth.google.service.js +6 -2
- package/dist/foundations/auth/services/auth.google.service.js.map +1 -1
- package/dist/foundations/auth/services/auth.service.d.ts +42 -7
- package/dist/foundations/auth/services/auth.service.d.ts.map +1 -1
- package/dist/foundations/auth/services/auth.service.js +140 -77
- package/dist/foundations/auth/services/auth.service.js.map +1 -1
- package/dist/foundations/company/entities/company.d.ts +1 -1
- package/dist/foundations/company/entities/company.d.ts.map +1 -1
- package/dist/foundations/company/entities/company.js +15 -1
- package/dist/foundations/company/entities/company.js.map +1 -1
- package/dist/foundations/company/index.d.ts +5 -0
- package/dist/foundations/company/index.d.ts.map +1 -1
- package/dist/foundations/company/index.js +16 -1
- package/dist/foundations/company/index.js.map +1 -1
- package/dist/foundations/company/processors/company.processor.js +1 -1
- package/dist/foundations/company/processors/company.processor.js.map +1 -1
- package/dist/foundations/company/repositories/company.repository.d.ts +65 -9
- package/dist/foundations/company/repositories/company.repository.d.ts.map +1 -1
- package/dist/foundations/company/repositories/company.repository.js +59 -18
- package/dist/foundations/company/repositories/company.repository.js.map +1 -1
- package/dist/foundations/company/services/company.service.d.ts +44 -4
- package/dist/foundations/company/services/company.service.d.ts.map +1 -1
- package/dist/foundations/company/services/company.service.js +33 -7
- package/dist/foundations/company/services/company.service.js.map +1 -1
- package/dist/foundations/content/content.module.d.ts +20 -8
- package/dist/foundations/content/content.module.d.ts.map +1 -1
- package/dist/foundations/content/content.module.js +40 -24
- package/dist/foundations/content/content.module.js.map +1 -1
- package/dist/foundations/content/controllers/content.controller.d.ts +1 -1
- package/dist/foundations/content/controllers/content.controller.d.ts.map +1 -1
- package/dist/foundations/content/controllers/content.controller.js +2 -2
- package/dist/foundations/content/controllers/content.controller.js.map +1 -1
- package/dist/foundations/content/entities/content.d.ts +74 -0
- package/dist/foundations/content/entities/content.d.ts.map +1 -0
- package/dist/foundations/content/entities/content.js +141 -0
- package/dist/foundations/content/entities/content.js.map +1 -0
- package/dist/foundations/content/index.d.ts +2 -4
- package/dist/foundations/content/index.d.ts.map +1 -1
- package/dist/foundations/content/index.js +6 -5
- package/dist/foundations/content/index.js.map +1 -1
- package/dist/foundations/content/interfaces/content.extension.interface.d.ts +126 -0
- package/dist/foundations/content/interfaces/content.extension.interface.d.ts.map +1 -1
- package/dist/foundations/content/interfaces/content.extension.interface.js +7 -1
- package/dist/foundations/content/interfaces/content.extension.interface.js.map +1 -1
- package/dist/foundations/content/repositories/content.repository.d.ts +14 -7
- package/dist/foundations/content/repositories/content.repository.d.ts.map +1 -1
- package/dist/foundations/content/repositories/content.repository.js +18 -16
- package/dist/foundations/content/repositories/content.repository.js.map +1 -1
- package/dist/foundations/content/services/content.cypher.service.d.ts +19 -0
- package/dist/foundations/content/services/content.cypher.service.d.ts.map +1 -1
- package/dist/foundations/content/services/content.cypher.service.js +65 -4
- package/dist/foundations/content/services/content.cypher.service.js.map +1 -1
- package/dist/foundations/content/services/content.service.js +4 -4
- package/dist/foundations/content/services/content.service.js.map +1 -1
- package/dist/foundations/discord-user/services/discord-user.service.js +2 -2
- package/dist/foundations/discord-user/services/discord-user.service.js.map +1 -1
- package/dist/foundations/feature/entities/feature.d.ts +32 -0
- package/dist/foundations/feature/entities/feature.d.ts.map +1 -0
- package/dist/foundations/feature/entities/feature.js +64 -0
- package/dist/foundations/feature/entities/feature.js.map +1 -0
- package/dist/foundations/feature/entities/feature.model.d.ts +1 -3
- package/dist/foundations/feature/entities/feature.model.d.ts.map +1 -1
- package/dist/foundations/feature/entities/feature.model.js +3 -11
- package/dist/foundations/feature/entities/feature.model.js.map +1 -1
- package/dist/foundations/feature/feature.module.d.ts.map +1 -1
- package/dist/foundations/feature/feature.module.js +4 -5
- package/dist/foundations/feature/feature.module.js.map +1 -1
- package/dist/foundations/feature/index.d.ts +12 -0
- package/dist/foundations/feature/index.d.ts.map +1 -1
- package/dist/foundations/feature/index.js +22 -1
- package/dist/foundations/feature/index.js.map +1 -1
- package/dist/foundations/feature/repositories/feature.repository.d.ts +37 -13
- package/dist/foundations/feature/repositories/feature.repository.d.ts.map +1 -1
- package/dist/foundations/feature/repositories/feature.repository.js +41 -35
- package/dist/foundations/feature/repositories/feature.repository.js.map +1 -1
- package/dist/foundations/feature/services/feature.service.d.ts +31 -4
- package/dist/foundations/feature/services/feature.service.d.ts.map +1 -1
- package/dist/foundations/feature/services/feature.service.js +20 -12
- package/dist/foundations/feature/services/feature.service.js.map +1 -1
- package/dist/foundations/foundations.modules.d.ts +6 -0
- package/dist/foundations/foundations.modules.d.ts.map +1 -1
- package/dist/foundations/foundations.modules.js +14 -3
- package/dist/foundations/foundations.modules.js.map +1 -1
- package/dist/foundations/google-user/services/google-user.service.js +2 -2
- package/dist/foundations/google-user/services/google-user.service.js.map +1 -1
- package/dist/foundations/index.d.ts +3 -0
- package/dist/foundations/index.d.ts.map +1 -1
- package/dist/foundations/index.js +3 -0
- package/dist/foundations/index.js.map +1 -1
- package/dist/foundations/membership/entities/membership.d.ts.map +1 -1
- package/dist/foundations/membership/entities/membership.js +4 -0
- package/dist/foundations/membership/entities/membership.js.map +1 -1
- package/dist/foundations/notification/controllers/notification.controller.js +2 -2
- package/dist/foundations/notification/controllers/notification.controller.js.map +1 -1
- package/dist/foundations/notification/entities/notification.d.ts +75 -0
- package/dist/foundations/notification/entities/notification.d.ts.map +1 -0
- package/dist/foundations/notification/entities/notification.js +73 -0
- package/dist/foundations/notification/entities/notification.js.map +1 -0
- package/dist/foundations/notification/index.d.ts +6 -2
- package/dist/foundations/notification/index.d.ts.map +1 -1
- package/dist/foundations/notification/index.js +17 -3
- package/dist/foundations/notification/index.js.map +1 -1
- package/dist/foundations/notification/notification.module.d.ts.map +1 -1
- package/dist/foundations/notification/notification.module.js +3 -4
- package/dist/foundations/notification/notification.module.js.map +1 -1
- package/dist/foundations/notification/repositories/notification.repository.d.ts +125 -8
- package/dist/foundations/notification/repositories/notification.repository.d.ts.map +1 -1
- package/dist/foundations/notification/repositories/notification.repository.js +219 -20
- package/dist/foundations/notification/repositories/notification.repository.js.map +1 -1
- package/dist/foundations/notification/services/notification.service.d.ts +31 -5
- package/dist/foundations/notification/services/notification.service.d.ts.map +1 -1
- package/dist/foundations/notification/services/notification.service.js +26 -9
- package/dist/foundations/notification/services/notification.service.js.map +1 -1
- package/dist/foundations/rbac/dump.d.ts +48 -4
- package/dist/foundations/rbac/dump.d.ts.map +1 -1
- package/dist/foundations/rbac/dump.js +28 -4
- package/dist/foundations/rbac/dump.js.map +1 -1
- package/dist/foundations/rbac/serializer/matrix-to-ts.d.ts +14 -0
- package/dist/foundations/rbac/serializer/matrix-to-ts.d.ts.map +1 -1
- package/dist/foundations/rbac/serializer/matrix-to-ts.js +13 -3
- package/dist/foundations/rbac/serializer/matrix-to-ts.js.map +1 -1
- package/dist/foundations/relevancy/repositories/relevancy.repository.d.ts.map +1 -1
- package/dist/foundations/relevancy/repositories/relevancy.repository.js +13 -1
- package/dist/foundations/relevancy/repositories/relevancy.repository.js.map +1 -1
- package/dist/foundations/role/entities/role.d.ts +1 -1
- package/dist/foundations/role/entities/role.d.ts.map +1 -1
- package/dist/foundations/stripe/index.d.ts +3 -0
- package/dist/foundations/stripe/index.d.ts.map +1 -1
- package/dist/foundations/stripe/index.js +6 -0
- package/dist/foundations/stripe/index.js.map +1 -1
- package/dist/foundations/stripe-price/entities/stripe-price.entity.d.ts +1 -1
- package/dist/foundations/stripe-price/entities/stripe-price.entity.d.ts.map +1 -1
- package/dist/foundations/tokenusage/entities/tokenusage.d.ts +49 -0
- package/dist/foundations/tokenusage/entities/tokenusage.d.ts.map +1 -0
- package/dist/foundations/tokenusage/entities/tokenusage.js +64 -0
- package/dist/foundations/tokenusage/entities/tokenusage.js.map +1 -0
- package/dist/foundations/tokenusage/index.d.ts +2 -2
- package/dist/foundations/tokenusage/index.d.ts.map +1 -1
- package/dist/foundations/tokenusage/index.js +5 -3
- package/dist/foundations/tokenusage/index.js.map +1 -1
- package/dist/foundations/tokenusage/repositories/tokenusage.repository.d.ts +33 -5
- package/dist/foundations/tokenusage/repositories/tokenusage.repository.d.ts.map +1 -1
- package/dist/foundations/tokenusage/repositories/tokenusage.repository.js +40 -14
- package/dist/foundations/tokenusage/repositories/tokenusage.repository.js.map +1 -1
- package/dist/foundations/tokenusage/services/tokenusage.service.d.ts +36 -9
- package/dist/foundations/tokenusage/services/tokenusage.service.d.ts.map +1 -1
- package/dist/foundations/tokenusage/services/tokenusage.service.js +32 -3
- package/dist/foundations/tokenusage/services/tokenusage.service.js.map +1 -1
- package/dist/foundations/tokenusage/tokenusage.module.js +3 -3
- package/dist/foundations/tokenusage/tokenusage.module.js.map +1 -1
- package/dist/foundations/user/controllers/user.controller.js +4 -4
- package/dist/foundations/user/controllers/user.controller.js.map +1 -1
- package/dist/foundations/user/dtos/user.put.dto.d.ts +1 -1
- package/dist/foundations/user/dtos/user.put.dto.d.ts.map +1 -1
- package/dist/foundations/user/dtos/user.put.dto.js +1 -1
- package/dist/foundations/user/dtos/user.put.dto.js.map +1 -1
- package/dist/foundations/user/entities/user.d.ts +4 -0
- package/dist/foundations/user/entities/user.d.ts.map +1 -1
- package/dist/foundations/user/entities/user.js +18 -4
- package/dist/foundations/user/entities/user.js.map +1 -1
- package/dist/foundations/user/index.d.ts +6 -1
- package/dist/foundations/user/index.d.ts.map +1 -1
- package/dist/foundations/user/index.js +13 -1
- package/dist/foundations/user/index.js.map +1 -1
- package/dist/foundations/user/repositories/user.repository.d.ts +56 -11
- package/dist/foundations/user/repositories/user.repository.d.ts.map +1 -1
- package/dist/foundations/user/repositories/user.repository.js +55 -35
- package/dist/foundations/user/repositories/user.repository.js.map +1 -1
- package/dist/foundations/user/services/user.service.d.ts +48 -9
- package/dist/foundations/user/services/user.service.d.ts.map +1 -1
- package/dist/foundations/user/services/user.service.js +50 -32
- package/dist/foundations/user/services/user.service.js.map +1 -1
- package/dist/foundations/user-activity/entities/user-activity.d.ts +36 -0
- package/dist/foundations/user-activity/entities/user-activity.d.ts.map +1 -0
- package/dist/foundations/user-activity/entities/user-activity.js +86 -0
- package/dist/foundations/user-activity/entities/user-activity.js.map +1 -0
- package/dist/foundations/user-activity/entities/user-activity.meta.d.ts +3 -0
- package/dist/foundations/user-activity/entities/user-activity.meta.d.ts.map +1 -0
- package/dist/foundations/user-activity/entities/user-activity.meta.js +10 -0
- package/dist/foundations/user-activity/entities/user-activity.meta.js.map +1 -0
- package/dist/foundations/user-activity/index.d.ts +10 -0
- package/dist/foundations/user-activity/index.d.ts.map +1 -0
- package/dist/foundations/user-activity/index.js +22 -0
- package/dist/foundations/user-activity/index.js.map +1 -0
- package/dist/foundations/user-activity/interceptors/user-activity.interceptor.d.ts +29 -0
- package/dist/foundations/user-activity/interceptors/user-activity.interceptor.d.ts.map +1 -0
- package/dist/foundations/user-activity/interceptors/user-activity.interceptor.js +98 -0
- package/dist/foundations/user-activity/interceptors/user-activity.interceptor.js.map +1 -0
- package/dist/foundations/user-activity/interfaces/user-activity.config.interface.d.ts +67 -0
- package/dist/foundations/user-activity/interfaces/user-activity.config.interface.d.ts.map +1 -0
- package/dist/foundations/user-activity/interfaces/user-activity.config.interface.js +26 -0
- package/dist/foundations/user-activity/interfaces/user-activity.config.interface.js.map +1 -0
- package/dist/foundations/user-activity/interfaces/user-activity.record.input.d.ts +18 -0
- package/dist/foundations/user-activity/interfaces/user-activity.record.input.d.ts.map +1 -0
- package/dist/foundations/{auth/entities/auth.entity.js → user-activity/interfaces/user-activity.record.input.js} +1 -1
- package/dist/foundations/user-activity/interfaces/user-activity.record.input.js.map +1 -0
- package/dist/foundations/user-activity/processors/user-activity.processor.d.ts +25 -0
- package/dist/foundations/user-activity/processors/user-activity.processor.d.ts.map +1 -0
- package/dist/foundations/user-activity/processors/user-activity.processor.js +74 -0
- package/dist/foundations/user-activity/processors/user-activity.processor.js.map +1 -0
- package/dist/foundations/user-activity/repositories/user-activity.repository.d.ts +47 -0
- package/dist/foundations/user-activity/repositories/user-activity.repository.d.ts.map +1 -0
- package/dist/foundations/user-activity/repositories/user-activity.repository.js +124 -0
- package/dist/foundations/user-activity/repositories/user-activity.repository.js.map +1 -0
- package/dist/foundations/user-activity/services/user-activity.service.d.ts +29 -0
- package/dist/foundations/user-activity/services/user-activity.service.d.ts.map +1 -0
- package/dist/foundations/user-activity/services/user-activity.service.js +61 -0
- package/dist/foundations/user-activity/services/user-activity.service.js.map +1 -0
- package/dist/foundations/user-activity/user-activity.module.d.ts +40 -0
- package/dist/foundations/user-activity/user-activity.module.d.ts.map +1 -0
- package/dist/foundations/user-activity/user-activity.module.js +99 -0
- package/dist/foundations/user-activity/user-activity.module.js.map +1 -0
- package/package.json +1 -1
- package/dist/foundations/auth/entities/auth.code.entity.d.ts +0 -7
- package/dist/foundations/auth/entities/auth.code.entity.d.ts.map +0 -1
- package/dist/foundations/auth/entities/auth.code.entity.js +0 -3
- package/dist/foundations/auth/entities/auth.code.entity.js.map +0 -1
- package/dist/foundations/auth/entities/auth.code.map.d.ts +0 -8
- package/dist/foundations/auth/entities/auth.code.map.d.ts.map +0 -1
- package/dist/foundations/auth/entities/auth.code.map.js +0 -13
- package/dist/foundations/auth/entities/auth.code.map.js.map +0 -1
- package/dist/foundations/auth/entities/auth.code.model.d.ts +0 -4
- package/dist/foundations/auth/entities/auth.code.model.d.ts.map +0 -1
- package/dist/foundations/auth/entities/auth.code.model.js +0 -13
- package/dist/foundations/auth/entities/auth.code.model.js.map +0 -1
- package/dist/foundations/auth/entities/auth.entity.d.ts +0 -18
- package/dist/foundations/auth/entities/auth.entity.d.ts.map +0 -1
- package/dist/foundations/auth/entities/auth.entity.js.map +0 -1
- package/dist/foundations/auth/entities/auth.map.d.ts +0 -8
- package/dist/foundations/auth/entities/auth.map.d.ts.map +0 -1
- package/dist/foundations/auth/entities/auth.map.js +0 -14
- package/dist/foundations/auth/entities/auth.map.js.map +0 -1
- package/dist/foundations/auth/entities/auth.model.d.ts +0 -4
- package/dist/foundations/auth/entities/auth.model.d.ts.map +0 -1
- package/dist/foundations/auth/entities/auth.model.js +0 -15
- package/dist/foundations/auth/entities/auth.model.js.map +0 -1
- package/dist/foundations/auth/entities/pending-auth.entity.d.ts +0 -16
- package/dist/foundations/auth/entities/pending-auth.entity.d.ts.map +0 -1
- package/dist/foundations/auth/entities/pending-auth.entity.js +0 -3
- package/dist/foundations/auth/entities/pending-auth.entity.js.map +0 -1
- package/dist/foundations/auth/entities/pending-auth.map.d.ts +0 -6
- package/dist/foundations/auth/entities/pending-auth.map.d.ts.map +0 -1
- package/dist/foundations/auth/entities/pending-auth.map.js +0 -20
- package/dist/foundations/auth/entities/pending-auth.map.js.map +0 -1
- package/dist/foundations/auth/entities/pending-auth.model.d.ts +0 -9
- package/dist/foundations/auth/entities/pending-auth.model.d.ts.map +0 -1
- package/dist/foundations/auth/entities/pending-auth.model.js +0 -19
- package/dist/foundations/auth/entities/pending-auth.model.js.map +0 -1
- package/dist/foundations/auth/serialisers/auth.serialiser.d.ts +0 -13
- package/dist/foundations/auth/serialisers/auth.serialiser.d.ts.map +0 -1
- package/dist/foundations/auth/serialisers/auth.serialiser.js +0 -52
- package/dist/foundations/auth/serialisers/auth.serialiser.js.map +0 -1
- package/dist/foundations/auth/serialisers/pending-auth.serialiser.d.ts +0 -18
- package/dist/foundations/auth/serialisers/pending-auth.serialiser.d.ts.map +0 -1
- package/dist/foundations/auth/serialisers/pending-auth.serialiser.js +0 -49
- package/dist/foundations/auth/serialisers/pending-auth.serialiser.js.map +0 -1
- package/dist/foundations/content/entities/content.entity.d.ts +0 -31
- package/dist/foundations/content/entities/content.entity.d.ts.map +0 -1
- package/dist/foundations/content/entities/content.entity.js +0 -3
- package/dist/foundations/content/entities/content.entity.js.map +0 -1
- package/dist/foundations/content/entities/content.map.d.ts +0 -8
- package/dist/foundations/content/entities/content.map.d.ts.map +0 -1
- package/dist/foundations/content/entities/content.map.js +0 -19
- package/dist/foundations/content/entities/content.map.js.map +0 -1
- package/dist/foundations/content/entities/content.model.d.ts +0 -4
- package/dist/foundations/content/entities/content.model.d.ts.map +0 -1
- package/dist/foundations/content/entities/content.model.js +0 -16
- package/dist/foundations/content/entities/content.model.js.map +0 -1
- package/dist/foundations/content/factories/content.model.factory.d.ts +0 -17
- package/dist/foundations/content/factories/content.model.factory.d.ts.map +0 -1
- package/dist/foundations/content/factories/content.model.factory.js +0 -65
- package/dist/foundations/content/factories/content.model.factory.js.map +0 -1
- package/dist/foundations/content/serialisers/content.serialiser.d.ts +0 -14
- package/dist/foundations/content/serialisers/content.serialiser.d.ts.map +0 -1
- package/dist/foundations/content/serialisers/content.serialiser.js +0 -78
- package/dist/foundations/content/serialisers/content.serialiser.js.map +0 -1
- package/dist/foundations/feature/entities/feature.entity.d.ts +0 -8
- package/dist/foundations/feature/entities/feature.entity.d.ts.map +0 -1
- package/dist/foundations/feature/entities/feature.entity.js +0 -3
- package/dist/foundations/feature/entities/feature.entity.js.map +0 -1
- package/dist/foundations/feature/entities/feature.map.d.ts +0 -8
- package/dist/foundations/feature/entities/feature.map.d.ts.map +0 -1
- package/dist/foundations/feature/entities/feature.map.js +0 -14
- package/dist/foundations/feature/entities/feature.map.js.map +0 -1
- package/dist/foundations/feature/serialisers/feature.serialiser.d.ts +0 -12
- package/dist/foundations/feature/serialisers/feature.serialiser.d.ts.map +0 -1
- package/dist/foundations/feature/serialisers/feature.serialiser.js +0 -45
- package/dist/foundations/feature/serialisers/feature.serialiser.js.map +0 -1
- package/dist/foundations/notification/entities/notification.entity.d.ts +0 -10
- package/dist/foundations/notification/entities/notification.entity.d.ts.map +0 -1
- package/dist/foundations/notification/entities/notification.entity.js +0 -3
- package/dist/foundations/notification/entities/notification.entity.js.map +0 -1
- package/dist/foundations/notification/entities/notification.map.d.ts +0 -8
- package/dist/foundations/notification/entities/notification.map.d.ts.map +0 -1
- package/dist/foundations/notification/entities/notification.map.js +0 -16
- package/dist/foundations/notification/entities/notification.map.js.map +0 -1
- package/dist/foundations/notification/entities/notification.model.d.ts +0 -4
- package/dist/foundations/notification/entities/notification.model.d.ts.map +0 -1
- package/dist/foundations/notification/entities/notification.model.js +0 -15
- package/dist/foundations/notification/entities/notification.model.js.map +0 -1
- package/dist/foundations/notification/interfaces/notification.service.interface.d.ts +0 -4
- package/dist/foundations/notification/interfaces/notification.service.interface.d.ts.map +0 -1
- package/dist/foundations/notification/interfaces/notification.service.interface.js +0 -3
- package/dist/foundations/notification/interfaces/notification.service.interface.js.map +0 -1
- package/dist/foundations/notification/serialisers/notifications.serialiser.d.ts +0 -12
- package/dist/foundations/notification/serialisers/notifications.serialiser.d.ts.map +0 -1
- package/dist/foundations/notification/serialisers/notifications.serialiser.js +0 -47
- package/dist/foundations/notification/serialisers/notifications.serialiser.js.map +0 -1
- package/dist/foundations/tokenusage/entities/tokenusage.entity.d.ts +0 -11
- package/dist/foundations/tokenusage/entities/tokenusage.entity.d.ts.map +0 -1
- package/dist/foundations/tokenusage/entities/tokenusage.entity.js +0 -3
- package/dist/foundations/tokenusage/entities/tokenusage.entity.js.map +0 -1
- package/dist/foundations/tokenusage/entities/tokenusage.map.d.ts +0 -8
- package/dist/foundations/tokenusage/entities/tokenusage.map.d.ts.map +0 -1
- package/dist/foundations/tokenusage/entities/tokenusage.map.js +0 -17
- package/dist/foundations/tokenusage/entities/tokenusage.map.js.map +0 -1
- package/dist/foundations/tokenusage/entities/tokenusage.model.d.ts +0 -4
- package/dist/foundations/tokenusage/entities/tokenusage.model.d.ts.map +0 -1
- package/dist/foundations/tokenusage/entities/tokenusage.model.js +0 -15
- package/dist/foundations/tokenusage/entities/tokenusage.model.js.map +0 -1
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration interface for the UserActivityModule.
|
|
3
|
+
*
|
|
4
|
+
* Every option is optional and defaults to the inert/library-safe value, so
|
|
5
|
+
* `UserActivityModule.forRoot()` with no arguments changes nothing about a
|
|
6
|
+
* consuming app's HTTP surface: no global interceptor is registered and no
|
|
7
|
+
* activity is recorded unless the app calls `UserActivityService.record()`
|
|
8
|
+
* itself.
|
|
9
|
+
*/
|
|
10
|
+
export interface UserActivityModuleConfig {
|
|
11
|
+
/**
|
|
12
|
+
* BullMQ queue the producer (`UserActivityService.record()`) enqueues onto.
|
|
13
|
+
*
|
|
14
|
+
* The module registers this queue itself (`BullModule.registerQueue`), so an
|
|
15
|
+
* app does not have to add it to its own queue configuration.
|
|
16
|
+
*
|
|
17
|
+
* NOTE: the worker side (`UserActivityProcessor`) binds to `QueueId.USER_ACTIVITY`
|
|
18
|
+
* through the `@Processor()` decorator, which BullMQ evaluates at class-decoration
|
|
19
|
+
* time and therefore cannot read from this config. Overriding `queueId` with a
|
|
20
|
+
* different value moves the producer only — the consuming app must then run its
|
|
21
|
+
* own worker for that queue. Every package processor has the same constraint
|
|
22
|
+
* (see `CompanyProcessor`, `HowToProcessor`, `ChunkProcessor`).
|
|
23
|
+
*
|
|
24
|
+
* @default QueueId.USER_ACTIVITY ("user-activity")
|
|
25
|
+
*/
|
|
26
|
+
queueId?: string;
|
|
27
|
+
/**
|
|
28
|
+
* BullMQ job name used for the enqueue/dispatch handshake between
|
|
29
|
+
* `UserActivityService.record()` and `UserActivityProcessor.process()`.
|
|
30
|
+
*
|
|
31
|
+
* Both sides read this same value, so an app may rename it freely (e.g. to
|
|
32
|
+
* match its own `JobName` enum) as long as it is configured once here.
|
|
33
|
+
*
|
|
34
|
+
* @default "userActivity:record"
|
|
35
|
+
*/
|
|
36
|
+
jobName?: string;
|
|
37
|
+
/**
|
|
38
|
+
* When true, the module registers a global `APP_INTERCEPTOR`
|
|
39
|
+
* (`UserActivityInterceptor`) that records a coarse-grained
|
|
40
|
+
* `ENTITY`/`CREATE|UPDATE|DELETE` activity for every authenticated
|
|
41
|
+
* non-GET, non-OPTIONS request outside the health/metrics/auth paths.
|
|
42
|
+
*
|
|
43
|
+
* Default false: the interceptor is a cross-cutting, app-visible behaviour
|
|
44
|
+
* change and must be opted into explicitly.
|
|
45
|
+
*
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
interceptorEnabled?: boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Injection token for the resolved user-activity configuration.
|
|
52
|
+
* Always resolves to a `Required<UserActivityModuleConfig>` (defaults merged in).
|
|
53
|
+
*/
|
|
54
|
+
export declare const USER_ACTIVITY_CONFIG: unique symbol;
|
|
55
|
+
/**
|
|
56
|
+
* Injection token for the BullMQ queue the module was configured with.
|
|
57
|
+
*
|
|
58
|
+
* `@InjectQueue()` cannot be used directly because the queue name is only known
|
|
59
|
+
* at `forRoot()` time; the module aliases the configured BullMQ queue token onto
|
|
60
|
+
* this stable token instead.
|
|
61
|
+
*/
|
|
62
|
+
export declare const USER_ACTIVITY_QUEUE: unique symbol;
|
|
63
|
+
/**
|
|
64
|
+
* Default configuration values.
|
|
65
|
+
*/
|
|
66
|
+
export declare const DEFAULT_USER_ACTIVITY_CONFIG: Required<UserActivityModuleConfig>;
|
|
67
|
+
//# sourceMappingURL=user-activity.config.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-activity.config.interface.d.ts","sourceRoot":"","sources":["../../../../src/foundations/user-activity/interfaces/user-activity.config.interface.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;;;;;;OAUG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,eAAiC,CAAC;AAEnE;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,eAAgC,CAAC;AAEjE;;GAEG;AACH,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,wBAAwB,CAI3E,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_USER_ACTIVITY_CONFIG = exports.USER_ACTIVITY_QUEUE = exports.USER_ACTIVITY_CONFIG = void 0;
|
|
4
|
+
const queue_id_1 = require("../../../config/enums/queue.id");
|
|
5
|
+
/**
|
|
6
|
+
* Injection token for the resolved user-activity configuration.
|
|
7
|
+
* Always resolves to a `Required<UserActivityModuleConfig>` (defaults merged in).
|
|
8
|
+
*/
|
|
9
|
+
exports.USER_ACTIVITY_CONFIG = Symbol("USER_ACTIVITY_CONFIG");
|
|
10
|
+
/**
|
|
11
|
+
* Injection token for the BullMQ queue the module was configured with.
|
|
12
|
+
*
|
|
13
|
+
* `@InjectQueue()` cannot be used directly because the queue name is only known
|
|
14
|
+
* at `forRoot()` time; the module aliases the configured BullMQ queue token onto
|
|
15
|
+
* this stable token instead.
|
|
16
|
+
*/
|
|
17
|
+
exports.USER_ACTIVITY_QUEUE = Symbol("USER_ACTIVITY_QUEUE");
|
|
18
|
+
/**
|
|
19
|
+
* Default configuration values.
|
|
20
|
+
*/
|
|
21
|
+
exports.DEFAULT_USER_ACTIVITY_CONFIG = {
|
|
22
|
+
queueId: queue_id_1.QueueId.USER_ACTIVITY,
|
|
23
|
+
jobName: "userActivity:record",
|
|
24
|
+
interceptorEnabled: false,
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=user-activity.config.interface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-activity.config.interface.js","sourceRoot":"","sources":["../../../../src/foundations/user-activity/interfaces/user-activity.config.interface.ts"],"names":[],"mappings":";;;AAAA,6DAAyD;AAsDzD;;;GAGG;AACU,QAAA,oBAAoB,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAEnE;;;;;;GAMG;AACU,QAAA,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAEjE;;GAEG;AACU,QAAA,4BAA4B,GAAuC;IAC9E,OAAO,EAAE,kBAAO,CAAC,aAAa;IAC9B,OAAO,EAAE,qBAAqB;IAC9B,kBAAkB,EAAE,KAAK;CAC1B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input accepted by `UserActivityService.record()` / `UserActivityRepository.createActivity()`.
|
|
3
|
+
*
|
|
4
|
+
* `category` and `action` are open strings on purpose: the library does not own
|
|
5
|
+
* the taxonomy. Consuming apps keep their own enums (e.g. `UserActivityCategory`
|
|
6
|
+
* / `UserActivityAction`) and pass their members straight through — every string
|
|
7
|
+
* enum member is assignable to `string`.
|
|
8
|
+
*/
|
|
9
|
+
export interface UserActivityRecordInput {
|
|
10
|
+
userId: string;
|
|
11
|
+
companyId: string;
|
|
12
|
+
category: string;
|
|
13
|
+
action: string;
|
|
14
|
+
entityType?: string;
|
|
15
|
+
entityId?: string;
|
|
16
|
+
metadata?: Record<string, unknown>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=user-activity.record.input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-activity.record.input.d.ts","sourceRoot":"","sources":["../../../../src/foundations/user-activity/interfaces/user-activity.record.input.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-activity.record.input.js","sourceRoot":"","sources":["../../../../src/foundations/user-activity/interfaces/user-activity.record.input.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { WorkerHost } from "@nestjs/bullmq";
|
|
2
|
+
import { Job } from "bullmq";
|
|
3
|
+
import { ClsService } from "nestjs-cls";
|
|
4
|
+
import { AppLoggingService } from "../../../core/logging/services/logging.service";
|
|
5
|
+
import { UserActivityModuleConfig } from "../interfaces/user-activity.config.interface";
|
|
6
|
+
import { UserActivityRepository } from "../repositories/user-activity.repository";
|
|
7
|
+
/**
|
|
8
|
+
* Worker-side of `UserActivityService.record()`.
|
|
9
|
+
*
|
|
10
|
+
* The queue name must be a compile-time constant because `@Processor()` is
|
|
11
|
+
* evaluated at class-decoration time — the same constraint every other package
|
|
12
|
+
* processor lives with (CompanyProcessor, HowToProcessor, ChunkProcessor). The
|
|
13
|
+
* job name, by contrast, is read from `USER_ACTIVITY_CONFIG` at construction
|
|
14
|
+
* time, so producer and consumer always agree on it.
|
|
15
|
+
*/
|
|
16
|
+
export declare class UserActivityProcessor extends WorkerHost {
|
|
17
|
+
private readonly logger;
|
|
18
|
+
private readonly repository;
|
|
19
|
+
private readonly cls;
|
|
20
|
+
private readonly jobName;
|
|
21
|
+
constructor(logger: AppLoggingService, repository: UserActivityRepository, cls: ClsService, config: Required<UserActivityModuleConfig>);
|
|
22
|
+
onError(job: Job): void;
|
|
23
|
+
process(job: Job): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=user-activity.processor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-activity.processor.d.ts","sourceRoot":"","sources":["../../../../src/foundations/user-activity/processors/user-activity.processor.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEtE,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACnF,OAAO,EAAwB,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AAE9G,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAElF;;;;;;;;GAQG;AACH,qBACa,qBAAsB,SAAQ,UAAU;IAIjD,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,GAAG;IALtB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAGd,MAAM,EAAE,iBAAiB,EACzB,UAAU,EAAE,sBAAsB,EAClC,GAAG,EAAE,UAAU,EACF,MAAM,EAAE,QAAQ,CAAC,wBAAwB,CAAC;IAO1E,OAAO,CAAC,GAAG,EAAE,GAAG;IAIV,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAiBvC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
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.UserActivityProcessor = void 0;
|
|
16
|
+
const bullmq_1 = require("@nestjs/bullmq");
|
|
17
|
+
const common_1 = require("@nestjs/common");
|
|
18
|
+
const bullmq_2 = require("bullmq");
|
|
19
|
+
const nestjs_cls_1 = require("nestjs-cls");
|
|
20
|
+
const queue_id_1 = require("../../../config/enums/queue.id");
|
|
21
|
+
const logging_service_1 = require("../../../core/logging/services/logging.service");
|
|
22
|
+
const user_activity_config_interface_1 = require("../interfaces/user-activity.config.interface");
|
|
23
|
+
const user_activity_repository_1 = require("../repositories/user-activity.repository");
|
|
24
|
+
/**
|
|
25
|
+
* Worker-side of `UserActivityService.record()`.
|
|
26
|
+
*
|
|
27
|
+
* The queue name must be a compile-time constant because `@Processor()` is
|
|
28
|
+
* evaluated at class-decoration time — the same constraint every other package
|
|
29
|
+
* processor lives with (CompanyProcessor, HowToProcessor, ChunkProcessor). The
|
|
30
|
+
* job name, by contrast, is read from `USER_ACTIVITY_CONFIG` at construction
|
|
31
|
+
* time, so producer and consumer always agree on it.
|
|
32
|
+
*/
|
|
33
|
+
let UserActivityProcessor = class UserActivityProcessor extends bullmq_1.WorkerHost {
|
|
34
|
+
constructor(logger, repository, cls, config) {
|
|
35
|
+
super();
|
|
36
|
+
this.logger = logger;
|
|
37
|
+
this.repository = repository;
|
|
38
|
+
this.cls = cls;
|
|
39
|
+
this.jobName = config.jobName;
|
|
40
|
+
}
|
|
41
|
+
onError(job) {
|
|
42
|
+
this.logger.error(`UserActivity record failed (jobId=${job.id}): ${job.failedReason ?? "unknown"}`);
|
|
43
|
+
}
|
|
44
|
+
async process(job) {
|
|
45
|
+
if (job.name !== this.jobName) {
|
|
46
|
+
throw new Error(`Job ${job.name} not handled by UserActivityProcessor`);
|
|
47
|
+
}
|
|
48
|
+
const input = job.data;
|
|
49
|
+
// The worker runs outside any HTTP request, so CLS is empty: seed it
|
|
50
|
+
// explicitly (isAutomatedJob + userId + companyId) or SecurityService
|
|
51
|
+
// .userHasAccess() has no context to work from.
|
|
52
|
+
await this.cls.run(async () => {
|
|
53
|
+
this.cls.set("isAutomatedJob", true);
|
|
54
|
+
this.cls.set("userId", input.userId);
|
|
55
|
+
this.cls.set("companyId", input.companyId);
|
|
56
|
+
await this.repository.createActivity(input);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
exports.UserActivityProcessor = UserActivityProcessor;
|
|
61
|
+
__decorate([
|
|
62
|
+
(0, bullmq_1.OnWorkerEvent)("failed"),
|
|
63
|
+
__metadata("design:type", Function),
|
|
64
|
+
__metadata("design:paramtypes", [bullmq_2.Job]),
|
|
65
|
+
__metadata("design:returntype", void 0)
|
|
66
|
+
], UserActivityProcessor.prototype, "onError", null);
|
|
67
|
+
exports.UserActivityProcessor = UserActivityProcessor = __decorate([
|
|
68
|
+
(0, bullmq_1.Processor)(queue_id_1.QueueId.USER_ACTIVITY, { concurrency: 4 }),
|
|
69
|
+
__param(3, (0, common_1.Inject)(user_activity_config_interface_1.USER_ACTIVITY_CONFIG)),
|
|
70
|
+
__metadata("design:paramtypes", [logging_service_1.AppLoggingService,
|
|
71
|
+
user_activity_repository_1.UserActivityRepository,
|
|
72
|
+
nestjs_cls_1.ClsService, Object])
|
|
73
|
+
], UserActivityProcessor);
|
|
74
|
+
//# sourceMappingURL=user-activity.processor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-activity.processor.js","sourceRoot":"","sources":["../../../../src/foundations/user-activity/processors/user-activity.processor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAsE;AACtE,2CAAwC;AACxC,mCAA6B;AAC7B,2CAAwC;AACxC,6DAAyD;AACzD,oFAAmF;AACnF,iGAA8G;AAE9G,uFAAkF;AAElF;;;;;;;;GAQG;AAEI,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,mBAAU;IAGnD,YACmB,MAAyB,EACzB,UAAkC,EAClC,GAAe,EACF,MAA0C;QAExE,KAAK,EAAE,CAAC;QALS,WAAM,GAAN,MAAM,CAAmB;QACzB,eAAU,GAAV,UAAU,CAAwB;QAClC,QAAG,GAAH,GAAG,CAAY;QAIhC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IAChC,CAAC;IAGD,OAAO,CAAC,GAAQ;QACd,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,qCAAqC,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,YAAY,IAAI,SAAS,EAAE,CAAC,CAAC;IACtG,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,GAAQ;QACpB,IAAI,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,OAAO,GAAG,CAAC,IAAI,uCAAuC,CAAC,CAAC;QAC1E,CAAC;QAED,MAAM,KAAK,GAAG,GAAG,CAAC,IAA+B,CAAC;QAElD,qEAAqE;QACrE,sEAAsE;QACtE,gDAAgD;QAChD,MAAM,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE;YAC5B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;YACrC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;YACrC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;YAC3C,MAAM,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAnCY,sDAAqB;AAchC;IADC,IAAA,sBAAa,EAAC,QAAQ,CAAC;;qCACX,YAAG;;oDAEf;gCAhBU,qBAAqB;IADjC,IAAA,kBAAS,EAAC,kBAAO,CAAC,aAAa,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC;IAQhD,WAAA,IAAA,eAAM,EAAC,qDAAoB,CAAC,CAAA;qCAHJ,mCAAiB;QACb,iDAAsB;QAC7B,uBAAU;GANvB,qBAAqB,CAmCjC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ClsService } from "nestjs-cls";
|
|
2
|
+
import { AbstractRepository } from "../../../core/neo4j/abstracts/abstract.repository";
|
|
3
|
+
import { Neo4jService } from "../../../core/neo4j/services/neo4j.service";
|
|
4
|
+
import { SecurityService } from "../../../core/security/services/security.service";
|
|
5
|
+
import { UserActivity, UserActivityDescriptor } from "../entities/user-activity";
|
|
6
|
+
import { UserActivityRecordInput } from "../interfaces/user-activity.record.input";
|
|
7
|
+
export declare class UserActivityRepository extends AbstractRepository<UserActivity, typeof UserActivityDescriptor.relationships> {
|
|
8
|
+
protected readonly descriptor: import("../../..").EntityDescriptor<UserActivity, {}>;
|
|
9
|
+
constructor(neo4j: Neo4jService, securityService: SecurityService, clsService: ClsService);
|
|
10
|
+
/**
|
|
11
|
+
* Adds the activity-log-specific indexes (recent-activity scan by
|
|
12
|
+
* createdAt, category+action lookups) on top of the id constraint that
|
|
13
|
+
* AbstractRepository already creates from the descriptor. There is no
|
|
14
|
+
* declarative way to express a plain (non-FULLTEXT) composite index via
|
|
15
|
+
* defineEntity(), so these stay as an explicit override — mirrors the
|
|
16
|
+
* canonical pattern for repositories that need a bespoke index
|
|
17
|
+
* (e.g. a vector index) alongside the descriptor-derived constraints.
|
|
18
|
+
*/
|
|
19
|
+
onModuleInit(): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Records are written from the async BullMQ worker (see
|
|
22
|
+
* UserActivityProcessor), outside HTTP/CLS request context, so this stays a
|
|
23
|
+
* fully custom Cypher write (explicit userId/companyId params, explicit
|
|
24
|
+
* MATCH on both Company and User) rather than the inherited
|
|
25
|
+
* descriptor-driven create(), which expects CLS-derived company scoping.
|
|
26
|
+
* The explicit `(userActivity)-[:BELONGS_TO]->(company)` edge below is the
|
|
27
|
+
* deliberate, documented exception to buildDefaultMatch()-driven company
|
|
28
|
+
* scoping: there is no CLS company to derive at write time.
|
|
29
|
+
* Not renamed: the params shape is domain-specific (UserActivityRecordInput,
|
|
30
|
+
* not the generic `{id, [key: string]: any}`), which is allowed to coexist
|
|
31
|
+
* under the base class's bivariant method-parameter checking.
|
|
32
|
+
*/
|
|
33
|
+
createActivity(input: UserActivityRecordInput): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Fully custom traversal (by PERFORMED edge + date range), not expressible
|
|
36
|
+
* via the inherited findByRelated() because `user` is intentionally not a
|
|
37
|
+
* descriptor relationship (see entities/user-activity.ts) and the date
|
|
38
|
+
* filtering is bespoke.
|
|
39
|
+
*/
|
|
40
|
+
findByUser(params: {
|
|
41
|
+
userId: string;
|
|
42
|
+
from?: Date;
|
|
43
|
+
to?: Date;
|
|
44
|
+
limit?: number;
|
|
45
|
+
}): Promise<UserActivity[]>;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=user-activity.repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-activity.repository.d.ts","sourceRoot":"","sources":["../../../../src/foundations/user-activity/repositories/user-activity.repository.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AAGnF,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AAEnF,qBACa,sBAAuB,SAAQ,kBAAkB,CAC5D,YAAY,EACZ,OAAO,sBAAsB,CAAC,aAAa,CAC5C;IACC,SAAS,CAAC,QAAQ,CAAC,UAAU,wDAA0B;gBAE3C,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU;IAIzF;;;;;;;;OAQG;IACY,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAc5C;;;;;;;;;;;;OAYG;IACG,cAAc,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;IAmCnE;;;;;OAKG;IACG,UAAU,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,IAAI,CAAC;QAAC,EAAE,CAAC,EAAE,IAAI,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;CAsB9G"}
|
|
@@ -0,0 +1,124 @@
|
|
|
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.UserActivityRepository = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const crypto_1 = require("crypto");
|
|
15
|
+
const nestjs_cls_1 = require("nestjs-cls");
|
|
16
|
+
const neo4j_date_1 = require("../../../common/helpers/neo4j-date");
|
|
17
|
+
const abstract_repository_1 = require("../../../core/neo4j/abstracts/abstract.repository");
|
|
18
|
+
const neo4j_service_1 = require("../../../core/neo4j/services/neo4j.service");
|
|
19
|
+
const security_service_1 = require("../../../core/security/services/security.service");
|
|
20
|
+
const company_meta_1 = require("../../company/entities/company.meta");
|
|
21
|
+
const user_meta_1 = require("../../user/entities/user.meta");
|
|
22
|
+
const user_activity_1 = require("../entities/user-activity");
|
|
23
|
+
let UserActivityRepository = class UserActivityRepository extends abstract_repository_1.AbstractRepository {
|
|
24
|
+
constructor(neo4j, securityService, clsService) {
|
|
25
|
+
super(neo4j, securityService, clsService);
|
|
26
|
+
this.descriptor = user_activity_1.UserActivityDescriptor;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Adds the activity-log-specific indexes (recent-activity scan by
|
|
30
|
+
* createdAt, category+action lookups) on top of the id constraint that
|
|
31
|
+
* AbstractRepository already creates from the descriptor. There is no
|
|
32
|
+
* declarative way to express a plain (non-FULLTEXT) composite index via
|
|
33
|
+
* defineEntity(), so these stay as an explicit override — mirrors the
|
|
34
|
+
* canonical pattern for repositories that need a bespoke index
|
|
35
|
+
* (e.g. a vector index) alongside the descriptor-derived constraints.
|
|
36
|
+
*/
|
|
37
|
+
async onModuleInit() {
|
|
38
|
+
await super.onModuleInit();
|
|
39
|
+
const { nodeName, labelName } = this.descriptor.model;
|
|
40
|
+
await this.neo4j.writeOne({
|
|
41
|
+
query: `CREATE INDEX ${nodeName}_createdAt IF NOT EXISTS FOR (${nodeName}:${labelName}) ON (${nodeName}.createdAt)`,
|
|
42
|
+
});
|
|
43
|
+
await this.neo4j.writeOne({
|
|
44
|
+
query: `CREATE INDEX ${nodeName}_category_action IF NOT EXISTS FOR (${nodeName}:${labelName}) ON (${nodeName}.category, ${nodeName}.action)`,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Records are written from the async BullMQ worker (see
|
|
49
|
+
* UserActivityProcessor), outside HTTP/CLS request context, so this stays a
|
|
50
|
+
* fully custom Cypher write (explicit userId/companyId params, explicit
|
|
51
|
+
* MATCH on both Company and User) rather than the inherited
|
|
52
|
+
* descriptor-driven create(), which expects CLS-derived company scoping.
|
|
53
|
+
* The explicit `(userActivity)-[:BELONGS_TO]->(company)` edge below is the
|
|
54
|
+
* deliberate, documented exception to buildDefaultMatch()-driven company
|
|
55
|
+
* scoping: there is no CLS company to derive at write time.
|
|
56
|
+
* Not renamed: the params shape is domain-specific (UserActivityRecordInput,
|
|
57
|
+
* not the generic `{id, [key: string]: any}`), which is allowed to coexist
|
|
58
|
+
* under the base class's bivariant method-parameter checking.
|
|
59
|
+
*/
|
|
60
|
+
async createActivity(input) {
|
|
61
|
+
const { nodeName, labelName } = this.descriptor.model;
|
|
62
|
+
const query = this.neo4j.initQuery();
|
|
63
|
+
query.queryParams = {
|
|
64
|
+
...query.queryParams,
|
|
65
|
+
id: (0, crypto_1.randomUUID)(),
|
|
66
|
+
userId: input.userId,
|
|
67
|
+
companyId: input.companyId,
|
|
68
|
+
category: input.category,
|
|
69
|
+
action: input.action,
|
|
70
|
+
entityType: input.entityType ?? null,
|
|
71
|
+
entityId: input.entityId ?? null,
|
|
72
|
+
metadata: input.metadata ? JSON.stringify(input.metadata) : null,
|
|
73
|
+
};
|
|
74
|
+
query.query = `
|
|
75
|
+
MATCH (${user_meta_1.userMeta.nodeName}:${user_meta_1.userMeta.labelName} {id: $userId})
|
|
76
|
+
MATCH (${company_meta_1.companyMeta.nodeName}Target:${company_meta_1.companyMeta.labelName} {id: $companyId})
|
|
77
|
+
CREATE (${nodeName}:${labelName} {
|
|
78
|
+
id: $id,
|
|
79
|
+
category: $category,
|
|
80
|
+
action: $action,
|
|
81
|
+
entityType: $entityType,
|
|
82
|
+
entityId: $entityId,
|
|
83
|
+
metadata: $metadata,
|
|
84
|
+
createdAt: datetime(),
|
|
85
|
+
updatedAt: datetime()
|
|
86
|
+
})
|
|
87
|
+
CREATE (${user_meta_1.userMeta.nodeName})-[:PERFORMED]->(${nodeName})
|
|
88
|
+
CREATE (${nodeName})-[:BELONGS_TO]->(${company_meta_1.companyMeta.nodeName}Target)
|
|
89
|
+
`;
|
|
90
|
+
await this.neo4j.writeOne(query);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Fully custom traversal (by PERFORMED edge + date range), not expressible
|
|
94
|
+
* via the inherited findByRelated() because `user` is intentionally not a
|
|
95
|
+
* descriptor relationship (see entities/user-activity.ts) and the date
|
|
96
|
+
* filtering is bespoke.
|
|
97
|
+
*/
|
|
98
|
+
async findByUser(params) {
|
|
99
|
+
const { nodeName, labelName } = this.descriptor.model;
|
|
100
|
+
const query = this.neo4j.initQuery({ serialiser: this.descriptor.model });
|
|
101
|
+
query.queryParams = {
|
|
102
|
+
...query.queryParams,
|
|
103
|
+
userId: params.userId,
|
|
104
|
+
from: params.from ? (0, neo4j_date_1.normalizeNeo4jTemporal)(params.from, "datetime") : null,
|
|
105
|
+
to: params.to ? (0, neo4j_date_1.normalizeNeo4jTemporal)(params.to, "datetime") : null,
|
|
106
|
+
limit: params.limit ?? 100,
|
|
107
|
+
};
|
|
108
|
+
query.query = `
|
|
109
|
+
MATCH (${user_meta_1.userMeta.nodeName}:${user_meta_1.userMeta.labelName} {id: $userId})-[:PERFORMED]->(${nodeName}:${labelName})
|
|
110
|
+
WHERE ($from IS NULL OR ${nodeName}.createdAt >= datetime($from))
|
|
111
|
+
AND ($to IS NULL OR ${nodeName}.createdAt < datetime($to))
|
|
112
|
+
RETURN ${nodeName}
|
|
113
|
+
ORDER BY ${nodeName}.createdAt DESC
|
|
114
|
+
LIMIT toInteger($limit)
|
|
115
|
+
`;
|
|
116
|
+
return this.neo4j.readMany(query);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
exports.UserActivityRepository = UserActivityRepository;
|
|
120
|
+
exports.UserActivityRepository = UserActivityRepository = __decorate([
|
|
121
|
+
(0, common_1.Injectable)(),
|
|
122
|
+
__metadata("design:paramtypes", [neo4j_service_1.Neo4jService, security_service_1.SecurityService, nestjs_cls_1.ClsService])
|
|
123
|
+
], UserActivityRepository);
|
|
124
|
+
//# sourceMappingURL=user-activity.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-activity.repository.js","sourceRoot":"","sources":["../../../../src/foundations/user-activity/repositories/user-activity.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,mCAAoC;AACpC,2CAAwC;AACxC,mEAA4E;AAC5E,2FAAuF;AACvF,8EAA0E;AAC1E,uFAAmF;AACnF,sEAAkE;AAClE,6DAAyD;AACzD,6DAAiF;AAI1E,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,wCAG3C;IAGC,YAAY,KAAmB,EAAE,eAAgC,EAAE,UAAsB;QACvF,KAAK,CAAC,KAAK,EAAE,eAAe,EAAE,UAAU,CAAC,CAAC;QAHzB,eAAU,GAAG,sCAAsB,CAAC;IAIvD,CAAC;IAED;;;;;;;;OAQG;IACM,KAAK,CAAC,YAAY;QACzB,MAAM,KAAK,CAAC,YAAY,EAAE,CAAC;QAE3B,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;QAEtD,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;YACxB,KAAK,EAAE,gBAAgB,QAAQ,iCAAiC,QAAQ,IAAI,SAAS,SAAS,QAAQ,aAAa;SACpH,CAAC,CAAC;QAEH,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;YACxB,KAAK,EAAE,gBAAgB,QAAQ,uCAAuC,QAAQ,IAAI,SAAS,SAAS,QAAQ,cAAc,QAAQ,UAAU;SAC7I,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,cAAc,CAAC,KAA8B;QACjD,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;QACtD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;QACrC,KAAK,CAAC,WAAW,GAAG;YAClB,GAAG,KAAK,CAAC,WAAW;YACpB,EAAE,EAAE,IAAA,mBAAU,GAAE;YAChB,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,IAAI;YACpC,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,IAAI;YAChC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI;SACjE,CAAC;QAEF,KAAK,CAAC,KAAK,GAAG;eACH,oBAAQ,CAAC,QAAQ,IAAI,oBAAQ,CAAC,SAAS;eACvC,0BAAW,CAAC,QAAQ,UAAU,0BAAW,CAAC,SAAS;gBAClD,QAAQ,IAAI,SAAS;;;;;;;;;;gBAUrB,oBAAQ,CAAC,QAAQ,oBAAoB,QAAQ;gBAC7C,QAAQ,qBAAqB,0BAAW,CAAC,QAAQ;KAC5D,CAAC;QAEF,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,UAAU,CAAC,MAAkE;QACjF,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;QACtD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC;QAC1E,KAAK,CAAC,WAAW,GAAG;YAClB,GAAG,KAAK,CAAC,WAAW;YACpB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAA,mCAAsB,EAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI;YAC1E,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,IAAA,mCAAsB,EAAC,MAAM,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI;YACpE,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,GAAG;SAC3B,CAAC;QAEF,KAAK,CAAC,KAAK,GAAG;eACH,oBAAQ,CAAC,QAAQ,IAAI,oBAAQ,CAAC,SAAS,kCAAkC,QAAQ,IAAI,SAAS;gCAC7E,QAAQ;8BACV,QAAQ;eACvB,QAAQ;iBACN,QAAQ;;KAEpB,CAAC;QAEF,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;CACF,CAAA;AA7GY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,mBAAU,GAAE;qCAOQ,4BAAY,EAAmB,kCAAe,EAAc,uBAAU;GAN9E,sBAAsB,CA6GlC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Queue } from "bullmq";
|
|
2
|
+
import { ClsService } from "nestjs-cls";
|
|
3
|
+
import { JsonApiService } from "../../../core/jsonapi/services/jsonapi.service";
|
|
4
|
+
import { AppLoggingService } from "../../../core/logging/services/logging.service";
|
|
5
|
+
import { AbstractService } from "../../../core/neo4j/abstracts/abstract.service";
|
|
6
|
+
import { UserActivity, UserActivityDescriptor } from "../entities/user-activity";
|
|
7
|
+
import { UserActivityModuleConfig } from "../interfaces/user-activity.config.interface";
|
|
8
|
+
import { UserActivityRecordInput } from "../interfaces/user-activity.record.input";
|
|
9
|
+
import { UserActivityRepository } from "../repositories/user-activity.repository";
|
|
10
|
+
export declare class UserActivityService extends AbstractService<UserActivity, typeof UserActivityDescriptor.relationships> {
|
|
11
|
+
private readonly userActivityRepository;
|
|
12
|
+
private readonly queue;
|
|
13
|
+
private readonly logger;
|
|
14
|
+
protected readonly descriptor: import("../../..").EntityDescriptor<UserActivity, {}>;
|
|
15
|
+
private readonly jobName;
|
|
16
|
+
constructor(jsonApiService: JsonApiService, userActivityRepository: UserActivityRepository, clsService: ClsService, queue: Queue, logger: AppLoggingService, config: Required<UserActivityModuleConfig>);
|
|
17
|
+
/**
|
|
18
|
+
* Enqueue an activity for async write. Never throws — the activity log
|
|
19
|
+
* must not break the caller's request path.
|
|
20
|
+
*/
|
|
21
|
+
record(input: UserActivityRecordInput): Promise<void>;
|
|
22
|
+
findByUser(params: {
|
|
23
|
+
userId: string;
|
|
24
|
+
from?: Date;
|
|
25
|
+
to?: Date;
|
|
26
|
+
limit?: number;
|
|
27
|
+
}): Promise<UserActivity[]>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=user-activity.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-activity.service.d.ts","sourceRoot":"","sources":["../../../../src/foundations/user-activity/services/user-activity.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAGL,wBAAwB,EACzB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAElF,qBACa,mBAAoB,SAAQ,eAAe,CAAC,YAAY,EAAE,OAAO,sBAAsB,CAAC,aAAa,CAAC;IAM/G,OAAO,CAAC,QAAQ,CAAC,sBAAsB;IAEV,OAAO,CAAC,QAAQ,CAAC,KAAK;IACnD,OAAO,CAAC,QAAQ,CAAC,MAAM;IARzB,SAAS,CAAC,QAAQ,CAAC,UAAU,wDAA0B;IACvD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAG/B,cAAc,EAAE,cAAc,EACb,sBAAsB,EAAE,sBAAsB,EAC/D,UAAU,EAAE,UAAU,EACwB,KAAK,EAAE,KAAK,EACzC,MAAM,EAAE,iBAAiB,EACZ,MAAM,EAAE,QAAQ,CAAC,wBAAwB,CAAC;IAM1E;;;OAGG;IACG,MAAM,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;IAUrD,UAAU,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,IAAI,CAAC;QAAC,EAAE,CAAC,EAAE,IAAI,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;CAGpF"}
|
|
@@ -0,0 +1,61 @@
|
|
|
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.UserActivityService = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const bullmq_1 = require("bullmq");
|
|
18
|
+
const nestjs_cls_1 = require("nestjs-cls");
|
|
19
|
+
const jsonapi_service_1 = require("../../../core/jsonapi/services/jsonapi.service");
|
|
20
|
+
const logging_service_1 = require("../../../core/logging/services/logging.service");
|
|
21
|
+
const abstract_service_1 = require("../../../core/neo4j/abstracts/abstract.service");
|
|
22
|
+
const user_activity_1 = require("../entities/user-activity");
|
|
23
|
+
const user_activity_config_interface_1 = require("../interfaces/user-activity.config.interface");
|
|
24
|
+
const user_activity_repository_1 = require("../repositories/user-activity.repository");
|
|
25
|
+
let UserActivityService = class UserActivityService extends abstract_service_1.AbstractService {
|
|
26
|
+
constructor(jsonApiService, userActivityRepository, clsService, queue, logger, config) {
|
|
27
|
+
super(jsonApiService, userActivityRepository, clsService, user_activity_1.UserActivityDescriptor.model);
|
|
28
|
+
this.userActivityRepository = userActivityRepository;
|
|
29
|
+
this.queue = queue;
|
|
30
|
+
this.logger = logger;
|
|
31
|
+
this.descriptor = user_activity_1.UserActivityDescriptor;
|
|
32
|
+
this.jobName = config.jobName;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Enqueue an activity for async write. Never throws — the activity log
|
|
36
|
+
* must not break the caller's request path.
|
|
37
|
+
*/
|
|
38
|
+
async record(input) {
|
|
39
|
+
try {
|
|
40
|
+
await this.queue.add(this.jobName, input);
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
this.logger.error(`UserActivityService.record enqueue failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
async findByUser(params) {
|
|
47
|
+
return this.userActivityRepository.findByUser(params);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
exports.UserActivityService = UserActivityService;
|
|
51
|
+
exports.UserActivityService = UserActivityService = __decorate([
|
|
52
|
+
(0, common_1.Injectable)(),
|
|
53
|
+
__param(3, (0, common_1.Inject)(user_activity_config_interface_1.USER_ACTIVITY_QUEUE)),
|
|
54
|
+
__param(5, (0, common_1.Inject)(user_activity_config_interface_1.USER_ACTIVITY_CONFIG)),
|
|
55
|
+
__metadata("design:paramtypes", [jsonapi_service_1.JsonApiService,
|
|
56
|
+
user_activity_repository_1.UserActivityRepository,
|
|
57
|
+
nestjs_cls_1.ClsService,
|
|
58
|
+
bullmq_1.Queue,
|
|
59
|
+
logging_service_1.AppLoggingService, Object])
|
|
60
|
+
], UserActivityService);
|
|
61
|
+
//# sourceMappingURL=user-activity.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-activity.service.js","sourceRoot":"","sources":["../../../../src/foundations/user-activity/services/user-activity.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAoD;AACpD,mCAA+B;AAC/B,2CAAwC;AACxC,oFAAgF;AAChF,oFAAmF;AACnF,qFAAiF;AACjF,6DAAiF;AACjF,iGAIsD;AAEtD,uFAAkF;AAG3E,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,kCAA0E;IAIjH,YACE,cAA8B,EACb,sBAA8C,EAC/D,UAAsB,EACO,KAA6B,EACzC,MAAyB,EACZ,MAA0C;QAExE,KAAK,CAAC,cAAc,EAAE,sBAAsB,EAAE,UAAU,EAAE,sCAAsB,CAAC,KAAK,CAAC,CAAC;QANvE,2BAAsB,GAAtB,sBAAsB,CAAwB;QAEjB,UAAK,GAAL,KAAK,CAAO;QACzC,WAAM,GAAN,MAAM,CAAmB;QARzB,eAAU,GAAG,sCAAsB,CAAC;QAYrD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IAChC,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,MAAM,CAAC,KAA8B;QACzC,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC5C,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,8CAA8C,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CACjG,CAAC;QACJ,CAAC;IACH,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,MAAkE;QACjF,OAAO,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IACxD,CAAC;CACF,CAAA;AAjCY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;IASR,WAAA,IAAA,eAAM,EAAC,oDAAmB,CAAC,CAAA;IAE3B,WAAA,IAAA,eAAM,EAAC,qDAAoB,CAAC,CAAA;qCALb,gCAAc;QACW,iDAAsB;QACnD,uBAAU;QAC+B,cAAK;QACjC,mCAAiB;GATjC,mBAAmB,CAiC/B"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { DynamicModule, OnModuleInit } from "@nestjs/common";
|
|
2
|
+
import { UserActivityModuleConfig } from "./interfaces/user-activity.config.interface";
|
|
3
|
+
/**
|
|
4
|
+
* UserActivityModule — append-only audit trail of user actions.
|
|
5
|
+
*
|
|
6
|
+
* Writes `(User)-[:PERFORMED]->(UserActivity)-[:BELONGS_TO]->(Company)` through a
|
|
7
|
+
* BullMQ worker, so recording never blocks (or breaks) the caller's request path.
|
|
8
|
+
* The module exposes NO HTTP routes: activities are produced by explicit
|
|
9
|
+
* `UserActivityService.record()` calls and — optionally — by a global interceptor.
|
|
10
|
+
*
|
|
11
|
+
* Defaults are deliberately inert: with `forRoot()` and no config, no
|
|
12
|
+
* APP_INTERCEPTOR is registered and nothing is recorded unless the app calls
|
|
13
|
+
* `record()` itself.
|
|
14
|
+
*
|
|
15
|
+
* The descriptor is NOT registered with the GraphDescriptorRegistry here —
|
|
16
|
+
* graph-catalog registration is an application-level policy decision.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* // Inert (library default): producer available, no global interceptor
|
|
21
|
+
* UserActivityModule.forRoot()
|
|
22
|
+
*
|
|
23
|
+
* // Fully enabled, with app-owned queue/job identifiers
|
|
24
|
+
* UserActivityModule.forRoot({
|
|
25
|
+
* queueId: QueueId.USER_ACTIVITY,
|
|
26
|
+
* jobName: JobName.userActivity.Record,
|
|
27
|
+
* interceptorEnabled: true,
|
|
28
|
+
* })
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare class UserActivityModule implements OnModuleInit {
|
|
32
|
+
/**
|
|
33
|
+
* Configure the UserActivityModule.
|
|
34
|
+
*
|
|
35
|
+
* @param config - Optional configuration merged over DEFAULT_USER_ACTIVITY_CONFIG
|
|
36
|
+
*/
|
|
37
|
+
static forRoot(config?: UserActivityModuleConfig): DynamicModule;
|
|
38
|
+
onModuleInit(): void;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=user-activity.module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-activity.module.d.ts","sourceRoot":"","sources":["../../../src/foundations/user-activity/user-activity.module.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAU,YAAY,EAAY,MAAM,gBAAgB,CAAC;AAM/E,OAAO,EAIL,wBAAwB,EACzB,MAAM,6CAA6C,CAAC;AAKrD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBACa,kBAAmB,YAAW,YAAY;IACrD;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,wBAAwB,GAAG,aAAa;IAuChE,YAAY;CAGb"}
|