@carlonicora/nestjs-neo4jsonapi 1.39.0 → 1.40.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/config/base.config.d.ts.map +1 -1
- package/dist/config/base.config.js +9 -0
- package/dist/config/base.config.js.map +1 -1
- package/dist/config/interfaces/base.config.interface.d.ts +2 -0
- package/dist/config/interfaces/base.config.interface.d.ts.map +1 -1
- package/dist/config/interfaces/config.two.factor.interface.d.ts +27 -0
- package/dist/config/interfaces/config.two.factor.interface.d.ts.map +1 -0
- package/dist/config/interfaces/config.two.factor.interface.js +3 -0
- package/dist/config/interfaces/config.two.factor.interface.js.map +1 -0
- package/dist/config/interfaces/index.d.ts +1 -0
- package/dist/config/interfaces/index.d.ts.map +1 -1
- package/dist/config/interfaces/index.js +1 -0
- package/dist/config/interfaces/index.js.map +1 -1
- package/dist/core/jsonapi/services/jsonapi.service.d.ts.map +1 -1
- package/dist/core/jsonapi/services/jsonapi.service.js +3 -1
- package/dist/core/jsonapi/services/jsonapi.service.js.map +1 -1
- package/dist/core/llm/services/vision.llm.service.d.ts.map +1 -1
- package/dist/core/llm/services/vision.llm.service.js +0 -1
- package/dist/core/llm/services/vision.llm.service.js.map +1 -1
- package/dist/core/security/services/security.service.d.ts +27 -0
- package/dist/core/security/services/security.service.d.ts.map +1 -1
- package/dist/core/security/services/security.service.js +37 -0
- package/dist/core/security/services/security.service.js.map +1 -1
- package/dist/foundations/auth/auth.module.d.ts.map +1 -1
- package/dist/foundations/auth/auth.module.js +6 -0
- package/dist/foundations/auth/auth.module.js.map +1 -1
- package/dist/foundations/auth/entities/pending-auth.entity.d.ts +16 -0
- package/dist/foundations/auth/entities/pending-auth.entity.d.ts.map +1 -0
- package/dist/foundations/auth/entities/pending-auth.entity.js +3 -0
- package/dist/foundations/auth/entities/pending-auth.entity.js.map +1 -0
- package/dist/foundations/auth/entities/pending-auth.map.d.ts +6 -0
- package/dist/foundations/auth/entities/pending-auth.map.d.ts.map +1 -0
- package/dist/foundations/auth/entities/pending-auth.map.js +20 -0
- package/dist/foundations/auth/entities/pending-auth.map.js.map +1 -0
- package/dist/foundations/auth/entities/pending-auth.meta.d.ts +3 -0
- package/dist/foundations/auth/entities/pending-auth.meta.d.ts.map +1 -0
- package/dist/foundations/auth/entities/pending-auth.meta.js +10 -0
- package/dist/foundations/auth/entities/pending-auth.meta.js.map +1 -0
- package/dist/foundations/auth/entities/pending-auth.model.d.ts +9 -0
- package/dist/foundations/auth/entities/pending-auth.model.d.ts.map +1 -0
- package/dist/foundations/auth/entities/pending-auth.model.js +19 -0
- package/dist/foundations/auth/entities/pending-auth.model.js.map +1 -0
- package/dist/foundations/auth/serialisers/pending-auth.serialiser.d.ts +18 -0
- package/dist/foundations/auth/serialisers/pending-auth.serialiser.d.ts.map +1 -0
- package/dist/foundations/auth/serialisers/pending-auth.serialiser.js +49 -0
- package/dist/foundations/auth/serialisers/pending-auth.serialiser.js.map +1 -0
- package/dist/foundations/auth/services/auth.service.d.ts +12 -1
- package/dist/foundations/auth/services/auth.service.d.ts.map +1 -1
- package/dist/foundations/auth/services/auth.service.js +60 -6
- package/dist/foundations/auth/services/auth.service.js.map +1 -1
- package/dist/foundations/foundations.modules.d.ts.map +1 -1
- package/dist/foundations/foundations.modules.js +2 -0
- package/dist/foundations/foundations.modules.js.map +1 -1
- package/dist/foundations/index.d.ts +1 -0
- package/dist/foundations/index.d.ts.map +1 -1
- package/dist/foundations/index.js +1 -0
- package/dist/foundations/index.js.map +1 -1
- package/dist/foundations/stripe/services/billing.service.d.ts +3 -4
- package/dist/foundations/stripe/services/billing.service.d.ts.map +1 -1
- package/dist/foundations/stripe/services/billing.service.js +1 -1
- package/dist/foundations/stripe/services/billing.service.js.map +1 -1
- package/dist/foundations/stripe-invoice/services/stripe-invoice-admin.service.d.ts +1 -1
- package/dist/foundations/stripe-invoice/services/stripe-invoice-admin.service.js +1 -1
- package/dist/foundations/stripe-invoice/services/stripe-invoice-api.service.d.ts +1 -1
- package/dist/foundations/stripe-invoice/services/stripe-invoice-api.service.d.ts.map +1 -1
- package/dist/foundations/stripe-invoice/services/stripe-invoice-api.service.js +2 -2
- package/dist/foundations/stripe-invoice/services/stripe-invoice-api.service.js.map +1 -1
- package/dist/foundations/stripe-subscription/controllers/stripe-subscription.controller.d.ts.map +1 -1
- package/dist/foundations/stripe-subscription/controllers/stripe-subscription.controller.js +0 -3
- package/dist/foundations/stripe-subscription/controllers/stripe-subscription.controller.js.map +1 -1
- package/dist/foundations/stripe-subscription/services/stripe-subscription-admin.service.d.ts +1 -1
- package/dist/foundations/stripe-subscription/services/stripe-subscription-admin.service.d.ts.map +1 -1
- package/dist/foundations/stripe-subscription/services/stripe-subscription-admin.service.js +1 -3
- package/dist/foundations/stripe-subscription/services/stripe-subscription-admin.service.js.map +1 -1
- package/dist/foundations/stripe-subscription/services/stripe-subscription-api.service.d.ts +1 -1
- package/dist/foundations/stripe-subscription/services/stripe-subscription-api.service.d.ts.map +1 -1
- package/dist/foundations/stripe-subscription/services/stripe-subscription-api.service.js +1 -5
- package/dist/foundations/stripe-subscription/services/stripe-subscription-api.service.js.map +1 -1
- package/dist/foundations/two-factor/controllers/passkey.controller.d.ts +52 -0
- package/dist/foundations/two-factor/controllers/passkey.controller.d.ts.map +1 -0
- package/dist/foundations/two-factor/controllers/passkey.controller.js +155 -0
- package/dist/foundations/two-factor/controllers/passkey.controller.js.map +1 -0
- package/dist/foundations/two-factor/controllers/totp.controller.d.ts +47 -0
- package/dist/foundations/two-factor/controllers/totp.controller.d.ts.map +1 -0
- package/dist/foundations/two-factor/controllers/totp.controller.js +132 -0
- package/dist/foundations/two-factor/controllers/totp.controller.js.map +1 -0
- package/dist/foundations/two-factor/controllers/two-factor.controller.d.ts +124 -0
- package/dist/foundations/two-factor/controllers/two-factor.controller.d.ts.map +1 -0
- package/dist/foundations/two-factor/controllers/two-factor.controller.js +352 -0
- package/dist/foundations/two-factor/controllers/two-factor.controller.js.map +1 -0
- package/dist/foundations/two-factor/dtos/passkey-options.dto.d.ts +42 -0
- package/dist/foundations/two-factor/dtos/passkey-options.dto.d.ts.map +1 -0
- package/dist/foundations/two-factor/dtos/passkey-options.dto.js +77 -0
- package/dist/foundations/two-factor/dtos/passkey-options.dto.js.map +1 -0
- package/dist/foundations/two-factor/dtos/passkey-verify.dto.d.ts +120 -0
- package/dist/foundations/two-factor/dtos/passkey-verify.dto.d.ts.map +1 -0
- package/dist/foundations/two-factor/dtos/passkey-verify.dto.js +226 -0
- package/dist/foundations/two-factor/dtos/passkey-verify.dto.js.map +1 -0
- package/dist/foundations/two-factor/dtos/totp-setup.dto.d.ts +32 -0
- package/dist/foundations/two-factor/dtos/totp-setup.dto.d.ts.map +1 -0
- package/dist/foundations/two-factor/dtos/totp-setup.dto.js +67 -0
- package/dist/foundations/two-factor/dtos/totp-setup.dto.js.map +1 -0
- package/dist/foundations/two-factor/dtos/totp-verify.dto.d.ts +62 -0
- package/dist/foundations/two-factor/dtos/totp-verify.dto.d.ts.map +1 -0
- package/dist/foundations/two-factor/dtos/totp-verify.dto.js +118 -0
- package/dist/foundations/two-factor/dtos/totp-verify.dto.js.map +1 -0
- package/dist/foundations/two-factor/dtos/two-factor-verify.dto.d.ts +83 -0
- package/dist/foundations/two-factor/dtos/two-factor-verify.dto.d.ts.map +1 -0
- package/dist/foundations/two-factor/dtos/two-factor-verify.dto.js +161 -0
- package/dist/foundations/two-factor/dtos/two-factor-verify.dto.js.map +1 -0
- package/dist/foundations/two-factor/entities/backup-code.d.ts +22 -0
- package/dist/foundations/two-factor/entities/backup-code.d.ts.map +1 -0
- package/dist/foundations/two-factor/entities/backup-code.js +25 -0
- package/dist/foundations/two-factor/entities/backup-code.js.map +1 -0
- package/dist/foundations/two-factor/entities/backup-code.meta.d.ts +3 -0
- package/dist/foundations/two-factor/entities/backup-code.meta.d.ts.map +1 -0
- package/dist/foundations/two-factor/entities/backup-code.meta.js +10 -0
- package/dist/foundations/two-factor/entities/backup-code.meta.js.map +1 -0
- package/dist/foundations/two-factor/entities/backup-codes-count.d.ts +18 -0
- package/dist/foundations/two-factor/entities/backup-codes-count.d.ts.map +1 -0
- package/dist/foundations/two-factor/entities/backup-codes-count.js +19 -0
- package/dist/foundations/two-factor/entities/backup-codes-count.js.map +1 -0
- package/dist/foundations/two-factor/entities/backup-codes-count.meta.d.ts +3 -0
- package/dist/foundations/two-factor/entities/backup-codes-count.meta.d.ts.map +1 -0
- package/dist/foundations/two-factor/entities/backup-codes-count.meta.js +10 -0
- package/dist/foundations/two-factor/entities/backup-codes-count.meta.js.map +1 -0
- package/dist/foundations/two-factor/entities/backup-codes-generation.d.ts +19 -0
- package/dist/foundations/two-factor/entities/backup-codes-generation.d.ts.map +1 -0
- package/dist/foundations/two-factor/entities/backup-codes-generation.js +20 -0
- package/dist/foundations/two-factor/entities/backup-codes-generation.js.map +1 -0
- package/dist/foundations/two-factor/entities/backup-codes-generation.meta.d.ts +3 -0
- package/dist/foundations/two-factor/entities/backup-codes-generation.meta.d.ts.map +1 -0
- package/dist/foundations/two-factor/entities/backup-codes-generation.meta.js +10 -0
- package/dist/foundations/two-factor/entities/backup-codes-generation.meta.js.map +1 -0
- package/dist/foundations/two-factor/entities/passkey-authentication-options.d.ts +19 -0
- package/dist/foundations/two-factor/entities/passkey-authentication-options.d.ts.map +1 -0
- package/dist/foundations/two-factor/entities/passkey-authentication-options.js +20 -0
- package/dist/foundations/two-factor/entities/passkey-authentication-options.js.map +1 -0
- package/dist/foundations/two-factor/entities/passkey-authentication-options.meta.d.ts +3 -0
- package/dist/foundations/two-factor/entities/passkey-authentication-options.meta.d.ts.map +1 -0
- package/dist/foundations/two-factor/entities/passkey-authentication-options.meta.js +10 -0
- package/dist/foundations/two-factor/entities/passkey-authentication-options.meta.js.map +1 -0
- package/dist/foundations/two-factor/entities/passkey-registration-options.d.ts +19 -0
- package/dist/foundations/two-factor/entities/passkey-registration-options.d.ts.map +1 -0
- package/dist/foundations/two-factor/entities/passkey-registration-options.js +20 -0
- package/dist/foundations/two-factor/entities/passkey-registration-options.js.map +1 -0
- package/dist/foundations/two-factor/entities/passkey-registration-options.meta.d.ts +3 -0
- package/dist/foundations/two-factor/entities/passkey-registration-options.meta.d.ts.map +1 -0
- package/dist/foundations/two-factor/entities/passkey-registration-options.meta.js +10 -0
- package/dist/foundations/two-factor/entities/passkey-registration-options.meta.js.map +1 -0
- package/dist/foundations/two-factor/entities/passkey.d.ts +27 -0
- package/dist/foundations/two-factor/entities/passkey.d.ts.map +1 -0
- package/dist/foundations/two-factor/entities/passkey.js +30 -0
- package/dist/foundations/two-factor/entities/passkey.js.map +1 -0
- package/dist/foundations/two-factor/entities/passkey.meta.d.ts +3 -0
- package/dist/foundations/two-factor/entities/passkey.meta.d.ts.map +1 -0
- package/dist/foundations/two-factor/entities/passkey.meta.js +10 -0
- package/dist/foundations/two-factor/entities/passkey.meta.js.map +1 -0
- package/dist/foundations/two-factor/entities/pending-two-factor.d.ts +24 -0
- package/dist/foundations/two-factor/entities/pending-two-factor.d.ts.map +1 -0
- package/dist/foundations/two-factor/entities/pending-two-factor.js +27 -0
- package/dist/foundations/two-factor/entities/pending-two-factor.js.map +1 -0
- package/dist/foundations/two-factor/entities/pending-two-factor.meta.d.ts +3 -0
- package/dist/foundations/two-factor/entities/pending-two-factor.meta.d.ts.map +1 -0
- package/dist/foundations/two-factor/entities/pending-two-factor.meta.js +10 -0
- package/dist/foundations/two-factor/entities/pending-two-factor.meta.js.map +1 -0
- package/dist/foundations/two-factor/entities/totp-authenticator.d.ts +24 -0
- package/dist/foundations/two-factor/entities/totp-authenticator.d.ts.map +1 -0
- package/dist/foundations/two-factor/entities/totp-authenticator.js +27 -0
- package/dist/foundations/two-factor/entities/totp-authenticator.js.map +1 -0
- package/dist/foundations/two-factor/entities/totp-authenticator.meta.d.ts +3 -0
- package/dist/foundations/two-factor/entities/totp-authenticator.meta.d.ts.map +1 -0
- package/dist/foundations/two-factor/entities/totp-authenticator.meta.js +10 -0
- package/dist/foundations/two-factor/entities/totp-authenticator.meta.js.map +1 -0
- package/dist/foundations/two-factor/entities/totp-setup.d.ts +20 -0
- package/dist/foundations/two-factor/entities/totp-setup.d.ts.map +1 -0
- package/dist/foundations/two-factor/entities/totp-setup.js +21 -0
- package/dist/foundations/two-factor/entities/totp-setup.js.map +1 -0
- package/dist/foundations/two-factor/entities/totp-setup.meta.d.ts +3 -0
- package/dist/foundations/two-factor/entities/totp-setup.meta.d.ts.map +1 -0
- package/dist/foundations/two-factor/entities/totp-setup.meta.js +10 -0
- package/dist/foundations/two-factor/entities/totp-setup.meta.js.map +1 -0
- package/dist/foundations/two-factor/entities/two-factor-challenge.d.ts +21 -0
- package/dist/foundations/two-factor/entities/two-factor-challenge.d.ts.map +1 -0
- package/dist/foundations/two-factor/entities/two-factor-challenge.js +22 -0
- package/dist/foundations/two-factor/entities/two-factor-challenge.js.map +1 -0
- package/dist/foundations/two-factor/entities/two-factor-challenge.meta.d.ts +3 -0
- package/dist/foundations/two-factor/entities/two-factor-challenge.meta.d.ts.map +1 -0
- package/dist/foundations/two-factor/entities/two-factor-challenge.meta.js +10 -0
- package/dist/foundations/two-factor/entities/two-factor-challenge.meta.js.map +1 -0
- package/dist/foundations/two-factor/entities/two-factor-config.d.ts +21 -0
- package/dist/foundations/two-factor/entities/two-factor-config.d.ts.map +1 -0
- package/dist/foundations/two-factor/entities/two-factor-config.js +23 -0
- package/dist/foundations/two-factor/entities/two-factor-config.js.map +1 -0
- package/dist/foundations/two-factor/entities/two-factor-config.meta.d.ts +3 -0
- package/dist/foundations/two-factor/entities/two-factor-config.meta.d.ts.map +1 -0
- package/dist/foundations/two-factor/entities/two-factor-config.meta.js +10 -0
- package/dist/foundations/two-factor/entities/two-factor-config.meta.js.map +1 -0
- package/dist/foundations/two-factor/entities/two-factor-status.d.ts +25 -0
- package/dist/foundations/two-factor/entities/two-factor-status.d.ts.map +1 -0
- package/dist/foundations/two-factor/entities/two-factor-status.js +22 -0
- package/dist/foundations/two-factor/entities/two-factor-status.js.map +1 -0
- package/dist/foundations/two-factor/entities/two-factor-status.meta.d.ts +3 -0
- package/dist/foundations/two-factor/entities/two-factor-status.meta.d.ts.map +1 -0
- package/dist/foundations/two-factor/entities/two-factor-status.meta.js +10 -0
- package/dist/foundations/two-factor/entities/two-factor-status.meta.js.map +1 -0
- package/dist/foundations/two-factor/entities/two-factor-verification.d.ts +19 -0
- package/dist/foundations/two-factor/entities/two-factor-verification.d.ts.map +1 -0
- package/dist/foundations/two-factor/entities/two-factor-verification.js +20 -0
- package/dist/foundations/two-factor/entities/two-factor-verification.js.map +1 -0
- package/dist/foundations/two-factor/entities/two-factor-verification.meta.d.ts +3 -0
- package/dist/foundations/two-factor/entities/two-factor-verification.meta.d.ts.map +1 -0
- package/dist/foundations/two-factor/entities/two-factor-verification.meta.js +10 -0
- package/dist/foundations/two-factor/entities/two-factor-verification.meta.js.map +1 -0
- package/dist/foundations/two-factor/guards/pending-auth.guard.d.ts +35 -0
- package/dist/foundations/two-factor/guards/pending-auth.guard.d.ts.map +1 -0
- package/dist/foundations/two-factor/guards/pending-auth.guard.js +70 -0
- package/dist/foundations/two-factor/guards/pending-auth.guard.js.map +1 -0
- package/dist/foundations/two-factor/index.d.ts +47 -0
- package/dist/foundations/two-factor/index.d.ts.map +1 -0
- package/dist/foundations/two-factor/index.js +134 -0
- package/dist/foundations/two-factor/index.js.map +1 -0
- package/dist/foundations/two-factor/repositories/backup-code.repository.d.ts +34 -0
- package/dist/foundations/two-factor/repositories/backup-code.repository.d.ts.map +1 -0
- package/dist/foundations/two-factor/repositories/backup-code.repository.js +107 -0
- package/dist/foundations/two-factor/repositories/backup-code.repository.js.map +1 -0
- package/dist/foundations/two-factor/repositories/passkey.repository.d.ts +51 -0
- package/dist/foundations/two-factor/repositories/passkey.repository.d.ts.map +1 -0
- package/dist/foundations/two-factor/repositories/passkey.repository.js +159 -0
- package/dist/foundations/two-factor/repositories/passkey.repository.js.map +1 -0
- package/dist/foundations/two-factor/repositories/pending-two-factor.repository.d.ts +47 -0
- package/dist/foundations/two-factor/repositories/pending-two-factor.repository.d.ts.map +1 -0
- package/dist/foundations/two-factor/repositories/pending-two-factor.repository.js +159 -0
- package/dist/foundations/two-factor/repositories/pending-two-factor.repository.js.map +1 -0
- package/dist/foundations/two-factor/repositories/totp-authenticator.repository.d.ts +51 -0
- package/dist/foundations/two-factor/repositories/totp-authenticator.repository.d.ts.map +1 -0
- package/dist/foundations/two-factor/repositories/totp-authenticator.repository.js +156 -0
- package/dist/foundations/two-factor/repositories/totp-authenticator.repository.js.map +1 -0
- package/dist/foundations/two-factor/repositories/two-factor-config.repository.d.ts +32 -0
- package/dist/foundations/two-factor/repositories/two-factor-config.repository.d.ts.map +1 -0
- package/dist/foundations/two-factor/repositories/two-factor-config.repository.js +105 -0
- package/dist/foundations/two-factor/repositories/two-factor-config.repository.js.map +1 -0
- package/dist/foundations/two-factor/services/backup-code.service.d.ts +95 -0
- package/dist/foundations/two-factor/services/backup-code.service.d.ts.map +1 -0
- package/dist/foundations/two-factor/services/backup-code.service.js +216 -0
- package/dist/foundations/two-factor/services/backup-code.service.js.map +1 -0
- package/dist/foundations/two-factor/services/index.d.ts +6 -0
- package/dist/foundations/two-factor/services/index.d.ts.map +1 -0
- package/dist/foundations/two-factor/services/index.js +14 -0
- package/dist/foundations/two-factor/services/index.js.map +1 -0
- package/dist/foundations/two-factor/services/passkey.service.d.ts +132 -0
- package/dist/foundations/two-factor/services/passkey.service.d.ts.map +1 -0
- package/dist/foundations/two-factor/services/passkey.service.js +400 -0
- package/dist/foundations/two-factor/services/passkey.service.js.map +1 -0
- package/dist/foundations/two-factor/services/totp-encryption.service.d.ts +42 -0
- package/dist/foundations/two-factor/services/totp-encryption.service.d.ts.map +1 -0
- package/dist/foundations/two-factor/services/totp-encryption.service.js +136 -0
- package/dist/foundations/two-factor/services/totp-encryption.service.js.map +1 -0
- package/dist/foundations/two-factor/services/totp.service.d.ts +132 -0
- package/dist/foundations/two-factor/services/totp.service.d.ts.map +1 -0
- package/dist/foundations/two-factor/services/totp.service.js +324 -0
- package/dist/foundations/two-factor/services/totp.service.js.map +1 -0
- package/dist/foundations/two-factor/services/two-factor.service.d.ts +165 -0
- package/dist/foundations/two-factor/services/two-factor.service.d.ts.map +1 -0
- package/dist/foundations/two-factor/services/two-factor.service.js +468 -0
- package/dist/foundations/two-factor/services/two-factor.service.js.map +1 -0
- package/dist/foundations/two-factor/two-factor.module.d.ts +23 -0
- package/dist/foundations/two-factor/two-factor.module.d.ts.map +1 -0
- package/dist/foundations/two-factor/two-factor.module.js +132 -0
- package/dist/foundations/two-factor/two-factor.module.js.map +1 -0
- package/dist/foundations/user/repositories/user.repository.d.ts +8 -0
- package/dist/foundations/user/repositories/user.repository.d.ts.map +1 -1
- package/dist/foundations/user/repositories/user.repository.js +28 -1
- package/dist/foundations/user/repositories/user.repository.js.map +1 -1
- package/dist/foundations/waitlist/controllers/waitlist.controller.d.ts.map +1 -1
- package/dist/foundations/waitlist/controllers/waitlist.controller.js +0 -4
- package/dist/foundations/waitlist/controllers/waitlist.controller.js.map +1 -1
- package/dist/foundations/waitlist/repositories/waitlist.repository.d.ts.map +1 -1
- package/dist/foundations/waitlist/repositories/waitlist.repository.js +0 -2
- package/dist/foundations/waitlist/repositories/waitlist.repository.js.map +1 -1
- package/dist/foundations/waitlist/services/waitlist.service.d.ts +1 -0
- package/dist/foundations/waitlist/services/waitlist.service.d.ts.map +1 -1
- package/dist/foundations/waitlist/services/waitlist.service.js +6 -7
- package/dist/foundations/waitlist/services/waitlist.service.js.map +1 -1
- package/dist/scripts/generate-module/generator.js +13 -13
- package/dist/scripts/generate-module/generator.js.map +1 -1
- package/dist/scripts/generate-module/index.js +6 -6
- package/dist/scripts/generate-module/index.js.map +1 -1
- package/dist/scripts/generate-module/utils/file-writer.js +2 -2
- package/dist/scripts/generate-module/utils/file-writer.js.map +1 -1
- package/dist/scripts/generate-module/utils/module-registrar.js +7 -7
- package/dist/scripts/generate-module/utils/module-registrar.js.map +1 -1
- package/dist/tools/migrate-entity/index.js +3 -3
- package/dist/tools/migrate-entity/lib/descriptor-generator.js +6 -6
- package/dist/tools/migrate-entity/lib/entity-migrator.js +13 -13
- package/package.json +5 -1
|
@@ -0,0 +1,159 @@
|
|
|
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.PasskeyRepository = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const nestjs_cls_1 = require("nestjs-cls");
|
|
15
|
+
const abstract_repository_1 = require("../../../core/neo4j/abstracts/abstract.repository");
|
|
16
|
+
const neo4j_service_1 = require("../../../core/neo4j/services/neo4j.service");
|
|
17
|
+
const security_service_1 = require("../../../core/security/services/security.service");
|
|
18
|
+
const passkey_1 = require("../entities/passkey");
|
|
19
|
+
let PasskeyRepository = class PasskeyRepository extends abstract_repository_1.AbstractRepository {
|
|
20
|
+
constructor(neo4j, securityService, clsService) {
|
|
21
|
+
super(neo4j, securityService, clsService);
|
|
22
|
+
this.descriptor = passkey_1.PasskeyDescriptor;
|
|
23
|
+
}
|
|
24
|
+
async findByUserId(params) {
|
|
25
|
+
const { nodeName, labelName } = this.descriptor.model;
|
|
26
|
+
const query = this.neo4j.initQuery({ serialiser: this.descriptor.model });
|
|
27
|
+
query.queryParams = { userId: params.userId };
|
|
28
|
+
query.query = `
|
|
29
|
+
MATCH (user:User {id: $userId})-[:HAS_PASSKEY]->(${nodeName}:${labelName})
|
|
30
|
+
RETURN ${nodeName}
|
|
31
|
+
ORDER BY ${nodeName}.createdAt DESC
|
|
32
|
+
`;
|
|
33
|
+
return this.neo4j.readMany(query);
|
|
34
|
+
}
|
|
35
|
+
async findByIdForUser(params) {
|
|
36
|
+
const { nodeName, labelName } = this.descriptor.model;
|
|
37
|
+
const query = this.neo4j.initQuery({ serialiser: this.descriptor.model });
|
|
38
|
+
query.queryParams = { passkeyId: params.passkeyId };
|
|
39
|
+
query.query = `
|
|
40
|
+
MATCH (${nodeName}:${labelName} {id: $passkeyId})
|
|
41
|
+
RETURN ${nodeName}
|
|
42
|
+
`;
|
|
43
|
+
return this.neo4j.readOne(query);
|
|
44
|
+
}
|
|
45
|
+
async findByCredentialId(params) {
|
|
46
|
+
const { nodeName, labelName } = this.descriptor.model;
|
|
47
|
+
const query = this.neo4j.initQuery({ serialiser: this.descriptor.model });
|
|
48
|
+
query.queryParams = { credentialId: params.credentialId };
|
|
49
|
+
query.query = `
|
|
50
|
+
MATCH (${nodeName}:${labelName} {credentialId: $credentialId})
|
|
51
|
+
RETURN ${nodeName}
|
|
52
|
+
`;
|
|
53
|
+
return this.neo4j.readOne(query);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Returns full data including credentialId and publicKey for WebAuthn operations.
|
|
57
|
+
* Note: Passkey type includes all fields - excludeFromJsonApi only affects API responses.
|
|
58
|
+
*/
|
|
59
|
+
async findAllByUserIdWithCredentials(params) {
|
|
60
|
+
const { nodeName, labelName } = this.descriptor.model;
|
|
61
|
+
const query = this.neo4j.initQuery({ serialiser: this.descriptor.model });
|
|
62
|
+
query.queryParams = { userId: params.userId };
|
|
63
|
+
query.query = `
|
|
64
|
+
MATCH (user:User {id: $userId})-[:HAS_PASSKEY]->(${nodeName}:${labelName})
|
|
65
|
+
RETURN ${nodeName}
|
|
66
|
+
`;
|
|
67
|
+
return this.neo4j.readMany(query);
|
|
68
|
+
}
|
|
69
|
+
async createForUser(params) {
|
|
70
|
+
const { nodeName, labelName } = this.descriptor.model;
|
|
71
|
+
const query = this.neo4j.initQuery({ serialiser: this.descriptor.model });
|
|
72
|
+
query.queryParams = {
|
|
73
|
+
passkeyId: params.passkeyId,
|
|
74
|
+
userId: params.userId,
|
|
75
|
+
name: params.name,
|
|
76
|
+
credentialId: params.credentialId,
|
|
77
|
+
publicKey: params.publicKey,
|
|
78
|
+
counter: params.counter,
|
|
79
|
+
transports: JSON.stringify(params.transports),
|
|
80
|
+
backedUp: params.backedUp,
|
|
81
|
+
};
|
|
82
|
+
query.query = `
|
|
83
|
+
MATCH (user:User {id: $userId})
|
|
84
|
+
CREATE (${nodeName}:${labelName} {
|
|
85
|
+
id: $passkeyId,
|
|
86
|
+
name: $name,
|
|
87
|
+
credentialId: $credentialId,
|
|
88
|
+
publicKey: $publicKey,
|
|
89
|
+
counter: $counter,
|
|
90
|
+
transports: $transports,
|
|
91
|
+
backedUp: $backedUp,
|
|
92
|
+
createdAt: datetime(),
|
|
93
|
+
updatedAt: datetime()
|
|
94
|
+
})
|
|
95
|
+
CREATE (user)-[:HAS_PASSKEY]->(${nodeName})
|
|
96
|
+
RETURN ${nodeName}
|
|
97
|
+
`;
|
|
98
|
+
return this.neo4j.writeOne(query);
|
|
99
|
+
}
|
|
100
|
+
async updatePasskey(params) {
|
|
101
|
+
const { nodeName, labelName } = this.descriptor.model;
|
|
102
|
+
const query = this.neo4j.initQuery({ serialiser: this.descriptor.model });
|
|
103
|
+
const setClauses = [`${nodeName}.updatedAt = datetime()`];
|
|
104
|
+
query.queryParams = { passkeyId: params.passkeyId };
|
|
105
|
+
if (params.name !== undefined) {
|
|
106
|
+
setClauses.push(`${nodeName}.name = $name`);
|
|
107
|
+
query.queryParams.name = params.name;
|
|
108
|
+
}
|
|
109
|
+
if (params.counter !== undefined) {
|
|
110
|
+
setClauses.push(`${nodeName}.counter = $counter`);
|
|
111
|
+
query.queryParams.counter = params.counter;
|
|
112
|
+
}
|
|
113
|
+
if (params.lastUsedAt !== undefined) {
|
|
114
|
+
setClauses.push(`${nodeName}.lastUsedAt = datetime($lastUsedAt)`);
|
|
115
|
+
query.queryParams.lastUsedAt = params.lastUsedAt.toISOString();
|
|
116
|
+
}
|
|
117
|
+
query.query = `
|
|
118
|
+
MATCH (${nodeName}:${labelName} {id: $passkeyId})
|
|
119
|
+
SET ${setClauses.join(", ")}
|
|
120
|
+
RETURN ${nodeName}
|
|
121
|
+
`;
|
|
122
|
+
return this.neo4j.writeOne(query);
|
|
123
|
+
}
|
|
124
|
+
async deletePasskey(params) {
|
|
125
|
+
const { nodeName, labelName } = this.descriptor.model;
|
|
126
|
+
const query = this.neo4j.initQuery();
|
|
127
|
+
query.queryParams = { passkeyId: params.passkeyId };
|
|
128
|
+
query.query = `
|
|
129
|
+
MATCH (${nodeName}:${labelName} {id: $passkeyId})
|
|
130
|
+
DETACH DELETE ${nodeName}
|
|
131
|
+
`;
|
|
132
|
+
await this.neo4j.writeOne(query);
|
|
133
|
+
}
|
|
134
|
+
async deleteAllByUserId(params) {
|
|
135
|
+
const { nodeName, labelName } = this.descriptor.model;
|
|
136
|
+
const query = this.neo4j.initQuery();
|
|
137
|
+
query.queryParams = { userId: params.userId };
|
|
138
|
+
query.query = `
|
|
139
|
+
MATCH (user:User {id: $userId})-[:HAS_PASSKEY]->(${nodeName}:${labelName})
|
|
140
|
+
DETACH DELETE ${nodeName}
|
|
141
|
+
`;
|
|
142
|
+
await this.neo4j.writeOne(query);
|
|
143
|
+
}
|
|
144
|
+
async countByUserId(params) {
|
|
145
|
+
const { labelName } = this.descriptor.model;
|
|
146
|
+
const result = await this.neo4j.read(`MATCH (user:User {id: $userId})-[:HAS_PASSKEY]->(passkey:${labelName})
|
|
147
|
+
RETURN count(passkey) as count`, { userId: params.userId });
|
|
148
|
+
if (result.records.length === 0)
|
|
149
|
+
return 0;
|
|
150
|
+
const count = result.records[0].get("count");
|
|
151
|
+
return count?.toNumber ? count.toNumber() : Number(count) || 0;
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
exports.PasskeyRepository = PasskeyRepository;
|
|
155
|
+
exports.PasskeyRepository = PasskeyRepository = __decorate([
|
|
156
|
+
(0, common_1.Injectable)(),
|
|
157
|
+
__metadata("design:paramtypes", [neo4j_service_1.Neo4jService, security_service_1.SecurityService, nestjs_cls_1.ClsService])
|
|
158
|
+
], PasskeyRepository);
|
|
159
|
+
//# sourceMappingURL=passkey.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passkey.repository.js","sourceRoot":"","sources":["../../../../src/foundations/two-factor/repositories/passkey.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,2CAAwC;AACxC,2FAAuF;AACvF,8EAA0E;AAC1E,uFAAmF;AACnF,iDAAiE;AAG1D,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,wCAAmE;IAGxG,YAAY,KAAmB,EAAE,eAAgC,EAAE,UAAsB;QACvF,KAAK,CAAC,KAAK,EAAE,eAAe,EAAE,UAAU,CAAC,CAAC;QAHzB,eAAU,GAAG,2BAAiB,CAAC;IAIlD,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,MAA0B;QAC3C,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,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;QAC9C,KAAK,CAAC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,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACjE,CAAC;CACF,CAAA;AAnKY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;qCAIQ,4BAAY,EAAmB,kCAAe,EAAc,uBAAU;GAH9E,iBAAiB,CAmK7B"}
|
|
@@ -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 { PendingTwoFactor, PendingTwoFactorDescriptor } from "../entities/pending-two-factor";
|
|
6
|
+
export declare class PendingTwoFactorRepository extends AbstractRepository<PendingTwoFactor, typeof PendingTwoFactorDescriptor.relationships> {
|
|
7
|
+
protected readonly descriptor: import("../../..").EntityDescriptor<PendingTwoFactor, {}>;
|
|
8
|
+
constructor(neo4j: Neo4jService, securityService: SecurityService, clsService: ClsService);
|
|
9
|
+
findByUserId(params: {
|
|
10
|
+
userId: string;
|
|
11
|
+
}): Promise<PendingTwoFactor | null>;
|
|
12
|
+
findByIdForUser(params: {
|
|
13
|
+
pendingId: string;
|
|
14
|
+
}): Promise<PendingTwoFactor | null>;
|
|
15
|
+
findByIdWithUser(params: {
|
|
16
|
+
pendingId: string;
|
|
17
|
+
}): Promise<{
|
|
18
|
+
pending: PendingTwoFactor;
|
|
19
|
+
userId: string;
|
|
20
|
+
} | null>;
|
|
21
|
+
/**
|
|
22
|
+
* Creates a new pending two-factor challenge.
|
|
23
|
+
* Automatically deletes any existing pending challenge for the user first.
|
|
24
|
+
*/
|
|
25
|
+
createForUser(params: {
|
|
26
|
+
pendingId: string;
|
|
27
|
+
userId: string;
|
|
28
|
+
challenge: string;
|
|
29
|
+
challengeType: string;
|
|
30
|
+
expiration: Date;
|
|
31
|
+
}): Promise<PendingTwoFactor>;
|
|
32
|
+
incrementAttemptCount(params: {
|
|
33
|
+
pendingId: string;
|
|
34
|
+
}): Promise<number>;
|
|
35
|
+
deletePending(params: {
|
|
36
|
+
pendingId: string;
|
|
37
|
+
}): Promise<void>;
|
|
38
|
+
deleteByUserId(params: {
|
|
39
|
+
userId: string;
|
|
40
|
+
}): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Deletes all expired pending two-factor challenges.
|
|
43
|
+
* Returns the count of deleted records.
|
|
44
|
+
*/
|
|
45
|
+
deleteExpired(): Promise<number>;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=pending-two-factor.repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pending-two-factor.repository.d.ts","sourceRoot":"","sources":["../../../../src/foundations/two-factor/repositories/pending-two-factor.repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAE9F,qBACa,0BAA2B,SAAQ,kBAAkB,CAChE,gBAAgB,EAChB,OAAO,0BAA0B,CAAC,aAAa,CAChD;IACC,SAAS,CAAC,QAAQ,CAAC,UAAU,4DAA8B;gBAE/C,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU;IAInF,YAAY,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAW1E,eAAe,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAWhF,gBAAgB,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,gBAAgB,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IA4BpH;;;OAGG;IACG,aAAa,CAAC,MAAM,EAAE;QAC1B,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,MAAM,CAAC;QACtB,UAAU,EAAE,IAAI,CAAC;KAClB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA6BvB,qBAAqB,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAarE,aAAa,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAW3D,cAAc,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAW/D;;;OAGG;IACG,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;CA2BvC"}
|
|
@@ -0,0 +1,159 @@
|
|
|
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.PendingTwoFactorRepository = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const nestjs_cls_1 = require("nestjs-cls");
|
|
15
|
+
const abstract_repository_1 = require("../../../core/neo4j/abstracts/abstract.repository");
|
|
16
|
+
const neo4j_service_1 = require("../../../core/neo4j/services/neo4j.service");
|
|
17
|
+
const security_service_1 = require("../../../core/security/services/security.service");
|
|
18
|
+
const pending_two_factor_1 = require("../entities/pending-two-factor");
|
|
19
|
+
let PendingTwoFactorRepository = class PendingTwoFactorRepository extends abstract_repository_1.AbstractRepository {
|
|
20
|
+
constructor(neo4j, securityService, clsService) {
|
|
21
|
+
super(neo4j, securityService, clsService);
|
|
22
|
+
this.descriptor = pending_two_factor_1.PendingTwoFactorDescriptor;
|
|
23
|
+
}
|
|
24
|
+
async findByUserId(params) {
|
|
25
|
+
const { nodeName, labelName } = this.descriptor.model;
|
|
26
|
+
const query = this.neo4j.initQuery({ serialiser: this.descriptor.model });
|
|
27
|
+
query.queryParams = { userId: params.userId };
|
|
28
|
+
query.query = `
|
|
29
|
+
MATCH (user:User {id: $userId})-[:HAS_PENDING_TWO_FACTOR]->(${nodeName}:${labelName})
|
|
30
|
+
RETURN ${nodeName}
|
|
31
|
+
`;
|
|
32
|
+
return this.neo4j.readOne(query);
|
|
33
|
+
}
|
|
34
|
+
async findByIdForUser(params) {
|
|
35
|
+
const { nodeName, labelName } = this.descriptor.model;
|
|
36
|
+
const query = this.neo4j.initQuery({ serialiser: this.descriptor.model });
|
|
37
|
+
query.queryParams = { pendingId: params.pendingId };
|
|
38
|
+
query.query = `
|
|
39
|
+
MATCH (${nodeName}:${labelName} {id: $pendingId})
|
|
40
|
+
RETURN ${nodeName}
|
|
41
|
+
`;
|
|
42
|
+
return this.neo4j.readOne(query);
|
|
43
|
+
}
|
|
44
|
+
async findByIdWithUser(params) {
|
|
45
|
+
const { nodeName, labelName } = this.descriptor.model;
|
|
46
|
+
const result = await this.neo4j.read(`MATCH (user:User)-[:HAS_PENDING_TWO_FACTOR]->(${nodeName}:${labelName} {id: $pendingId})
|
|
47
|
+
RETURN ${nodeName}, user.id as userId`, { pendingId: params.pendingId });
|
|
48
|
+
if (result.records.length === 0)
|
|
49
|
+
return null;
|
|
50
|
+
const record = result.records[0];
|
|
51
|
+
const pendingData = record.get(nodeName).properties;
|
|
52
|
+
const userId = record.get("userId");
|
|
53
|
+
return {
|
|
54
|
+
pending: {
|
|
55
|
+
...pendingData,
|
|
56
|
+
id: pendingData.id,
|
|
57
|
+
type: this.descriptor.model.type,
|
|
58
|
+
createdAt: pendingData.createdAt ? new Date(pendingData.createdAt) : new Date(),
|
|
59
|
+
updatedAt: pendingData.updatedAt ? new Date(pendingData.updatedAt) : new Date(),
|
|
60
|
+
expiration: pendingData.expiration ? new Date(pendingData.expiration) : new Date(),
|
|
61
|
+
attemptCount: pendingData.attemptCount?.toNumber?.() ?? pendingData.attemptCount ?? 0,
|
|
62
|
+
},
|
|
63
|
+
userId,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Creates a new pending two-factor challenge.
|
|
68
|
+
* Automatically deletes any existing pending challenge for the user first.
|
|
69
|
+
*/
|
|
70
|
+
async createForUser(params) {
|
|
71
|
+
// First delete any existing pending for this user
|
|
72
|
+
await this.deleteByUserId({ userId: params.userId });
|
|
73
|
+
const { nodeName, labelName } = this.descriptor.model;
|
|
74
|
+
const query = this.neo4j.initQuery({ serialiser: this.descriptor.model });
|
|
75
|
+
query.queryParams = {
|
|
76
|
+
pendingId: params.pendingId,
|
|
77
|
+
userId: params.userId,
|
|
78
|
+
challenge: params.challenge,
|
|
79
|
+
challengeType: params.challengeType,
|
|
80
|
+
expiration: params.expiration.toISOString(),
|
|
81
|
+
};
|
|
82
|
+
query.query = `
|
|
83
|
+
MATCH (user:User {id: $userId})
|
|
84
|
+
CREATE (${nodeName}:${labelName} {
|
|
85
|
+
id: $pendingId,
|
|
86
|
+
challenge: $challenge,
|
|
87
|
+
challengeType: $challengeType,
|
|
88
|
+
expiration: datetime($expiration),
|
|
89
|
+
attemptCount: 0,
|
|
90
|
+
createdAt: datetime()
|
|
91
|
+
})
|
|
92
|
+
CREATE (user)-[:HAS_PENDING_TWO_FACTOR]->(${nodeName})
|
|
93
|
+
RETURN ${nodeName}
|
|
94
|
+
`;
|
|
95
|
+
return this.neo4j.writeOne(query);
|
|
96
|
+
}
|
|
97
|
+
async incrementAttemptCount(params) {
|
|
98
|
+
const { nodeName, labelName } = this.descriptor.model;
|
|
99
|
+
const query = this.neo4j.initQuery({ serialiser: this.descriptor.model });
|
|
100
|
+
query.queryParams = { pendingId: params.pendingId };
|
|
101
|
+
query.query = `
|
|
102
|
+
MATCH (${nodeName}:${labelName} {id: $pendingId})
|
|
103
|
+
SET ${nodeName}.attemptCount = ${nodeName}.attemptCount + 1
|
|
104
|
+
RETURN ${nodeName}
|
|
105
|
+
`;
|
|
106
|
+
const result = await this.neo4j.writeOne(query);
|
|
107
|
+
return result?.attemptCount ?? 0;
|
|
108
|
+
}
|
|
109
|
+
async deletePending(params) {
|
|
110
|
+
const { nodeName, labelName } = this.descriptor.model;
|
|
111
|
+
const query = this.neo4j.initQuery();
|
|
112
|
+
query.queryParams = { pendingId: params.pendingId };
|
|
113
|
+
query.query = `
|
|
114
|
+
MATCH (${nodeName}:${labelName} {id: $pendingId})
|
|
115
|
+
DETACH DELETE ${nodeName}
|
|
116
|
+
`;
|
|
117
|
+
await this.neo4j.writeOne(query);
|
|
118
|
+
}
|
|
119
|
+
async deleteByUserId(params) {
|
|
120
|
+
const { nodeName, labelName } = this.descriptor.model;
|
|
121
|
+
const query = this.neo4j.initQuery();
|
|
122
|
+
query.queryParams = { userId: params.userId };
|
|
123
|
+
query.query = `
|
|
124
|
+
MATCH (user:User {id: $userId})-[:HAS_PENDING_TWO_FACTOR]->(${nodeName}:${labelName})
|
|
125
|
+
DETACH DELETE ${nodeName}
|
|
126
|
+
`;
|
|
127
|
+
await this.neo4j.writeOne(query);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Deletes all expired pending two-factor challenges.
|
|
131
|
+
* Returns the count of deleted records.
|
|
132
|
+
*/
|
|
133
|
+
async deleteExpired() {
|
|
134
|
+
const { labelName } = this.descriptor.model;
|
|
135
|
+
// First count expired records
|
|
136
|
+
const countResult = await this.neo4j.read(`MATCH (p:${labelName})
|
|
137
|
+
WHERE p.expiration < datetime()
|
|
138
|
+
RETURN count(p) as deletedCount`, {});
|
|
139
|
+
const count = countResult.records[0]?.get("deletedCount");
|
|
140
|
+
const deletedCount = count?.toNumber ? count.toNumber() : Number(count) || 0;
|
|
141
|
+
if (deletedCount === 0)
|
|
142
|
+
return 0;
|
|
143
|
+
// Delete expired records
|
|
144
|
+
const deleteQuery = this.neo4j.initQuery();
|
|
145
|
+
deleteQuery.query = `
|
|
146
|
+
MATCH (p:${labelName})
|
|
147
|
+
WHERE p.expiration < datetime()
|
|
148
|
+
DETACH DELETE p
|
|
149
|
+
`;
|
|
150
|
+
await this.neo4j.writeOne(deleteQuery);
|
|
151
|
+
return deletedCount;
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
exports.PendingTwoFactorRepository = PendingTwoFactorRepository;
|
|
155
|
+
exports.PendingTwoFactorRepository = PendingTwoFactorRepository = __decorate([
|
|
156
|
+
(0, common_1.Injectable)(),
|
|
157
|
+
__metadata("design:paramtypes", [neo4j_service_1.Neo4jService, security_service_1.SecurityService, nestjs_cls_1.ClsService])
|
|
158
|
+
], PendingTwoFactorRepository);
|
|
159
|
+
//# sourceMappingURL=pending-two-factor.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pending-two-factor.repository.js","sourceRoot":"","sources":["../../../../src/foundations/two-factor/repositories/pending-two-factor.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,2CAAwC;AACxC,2FAAuF;AACvF,8EAA0E;AAC1E,uFAAmF;AACnF,uEAA8F;AAGvF,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,wCAG/C;IAGC,YAAY,KAAmB,EAAE,eAAgC,EAAE,UAAsB;QACvF,KAAK,CAAC,KAAK,EAAE,eAAe,EAAE,UAAU,CAAC,CAAC;QAHzB,eAAU,GAAG,+CAA0B,CAAC;IAI3D,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,MAA0B;QAC3C,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,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;QAC9C,KAAK,CAAC,KAAK,GAAG;oEACkD,QAAQ,IAAI,SAAS;eAC1E,QAAQ;KAClB,CAAC;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,MAA6B;QACjD,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,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAA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KAAK,CAAC,aAAa;QACjB,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;QAE5C,8BAA8B;QAC9B,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CACvC,YAAY,SAAS;;uCAEY,EACjC,EAAE,CACH,CAAC;QAEF,MAAM,KAAK,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;QAC1D,MAAM,YAAY,GAAG,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAE7E,IAAI,YAAY,KAAK,CAAC;YAAE,OAAO,CAAC,CAAC;QAEjC,yBAAyB;QACzB,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;QAC3C,WAAW,CAAC,KAAK,GAAG;iBACP,SAAS;;;KAGrB,CAAC;QACF,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QAEvC,OAAO,YAAY,CAAC;IACtB,CAAC;CACF,CAAA;AArKY,gEAA0B;qCAA1B,0BAA0B;IADtC,IAAA,mBAAU,GAAE;qCAOQ,4BAAY,EAAmB,kCAAe,EAAc,uBAAU;GAN9E,0BAA0B,CAqKtC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
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 { TotpAuthenticator, TotpAuthenticatorDescriptor } from "../entities/totp-authenticator";
|
|
6
|
+
export declare class TotpAuthenticatorRepository extends AbstractRepository<TotpAuthenticator, typeof TotpAuthenticatorDescriptor.relationships> {
|
|
7
|
+
protected readonly descriptor: import("../../..").EntityDescriptor<TotpAuthenticator, {}>;
|
|
8
|
+
constructor(neo4j: Neo4jService, securityService: SecurityService, clsService: ClsService);
|
|
9
|
+
findVerifiedByUserId(params: {
|
|
10
|
+
userId: string;
|
|
11
|
+
}): Promise<TotpAuthenticator[]>;
|
|
12
|
+
findByIdForUser(params: {
|
|
13
|
+
authenticatorId: string;
|
|
14
|
+
}): Promise<TotpAuthenticator | null>;
|
|
15
|
+
/**
|
|
16
|
+
* Returns authenticator with secret for internal TOTP validation.
|
|
17
|
+
* Note: TotpAuthenticator type includes secret - excludeFromJsonApi only affects API responses.
|
|
18
|
+
*/
|
|
19
|
+
findByIdWithSecret(params: {
|
|
20
|
+
authenticatorId: string;
|
|
21
|
+
}): Promise<TotpAuthenticator | null>;
|
|
22
|
+
/**
|
|
23
|
+
* Returns all verified authenticators with secrets for internal TOTP validation.
|
|
24
|
+
* Note: TotpAuthenticator type includes secret - excludeFromJsonApi only affects API responses.
|
|
25
|
+
*/
|
|
26
|
+
findAllByUserIdWithSecrets(params: {
|
|
27
|
+
userId: string;
|
|
28
|
+
}): Promise<TotpAuthenticator[]>;
|
|
29
|
+
createForUser(params: {
|
|
30
|
+
authenticatorId: string;
|
|
31
|
+
userId: string;
|
|
32
|
+
name: string;
|
|
33
|
+
secret: string;
|
|
34
|
+
verified?: boolean;
|
|
35
|
+
}): Promise<TotpAuthenticator>;
|
|
36
|
+
updateAuthenticator(params: {
|
|
37
|
+
authenticatorId: string;
|
|
38
|
+
verified?: boolean;
|
|
39
|
+
lastUsedAt?: Date;
|
|
40
|
+
}): Promise<TotpAuthenticator>;
|
|
41
|
+
deleteAuthenticator(params: {
|
|
42
|
+
authenticatorId: string;
|
|
43
|
+
}): Promise<void>;
|
|
44
|
+
deleteAllByUserId(params: {
|
|
45
|
+
userId: string;
|
|
46
|
+
}): Promise<void>;
|
|
47
|
+
countVerifiedByUserId(params: {
|
|
48
|
+
userId: string;
|
|
49
|
+
}): Promise<number>;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=totp-authenticator.repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"totp-authenticator.repository.d.ts","sourceRoot":"","sources":["../../../../src/foundations/two-factor/repositories/totp-authenticator.repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAEhG,qBACa,2BAA4B,SAAQ,kBAAkB,CACjE,iBAAiB,EACjB,OAAO,2BAA2B,CAAC,aAAa,CACjD;IACC,SAAS,CAAC,QAAQ,CAAC,UAAU,6DAA+B;gBAEhD,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU;IAInF,oBAAoB,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAa9E,eAAe,CAAC,MAAM,EAAE;QAAE,eAAe,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAW7F;;;OAGG;IACG,kBAAkB,CAAC,MAAM,EAAE;QAAE,eAAe,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAWhG;;;OAGG;IACG,0BAA0B,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAYpF,aAAa,CAAC,MAAM,EAAE;QAC1B,eAAe,EAAE,MAAM,CAAC;QACxB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA0BxB,mBAAmB,CAAC,MAAM,EAAE;QAChC,eAAe,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,UAAU,CAAC,EAAE,IAAI,CAAC;KACnB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAuBxB,mBAAmB,CAAC,MAAM,EAAE;QAAE,eAAe,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAWvE,iBAAiB,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAW5D,qBAAqB,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;CAazE"}
|
|
@@ -0,0 +1,156 @@
|
|
|
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.TotpAuthenticatorRepository = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const nestjs_cls_1 = require("nestjs-cls");
|
|
15
|
+
const abstract_repository_1 = require("../../../core/neo4j/abstracts/abstract.repository");
|
|
16
|
+
const neo4j_service_1 = require("../../../core/neo4j/services/neo4j.service");
|
|
17
|
+
const security_service_1 = require("../../../core/security/services/security.service");
|
|
18
|
+
const totp_authenticator_1 = require("../entities/totp-authenticator");
|
|
19
|
+
let TotpAuthenticatorRepository = class TotpAuthenticatorRepository extends abstract_repository_1.AbstractRepository {
|
|
20
|
+
constructor(neo4j, securityService, clsService) {
|
|
21
|
+
super(neo4j, securityService, clsService);
|
|
22
|
+
this.descriptor = totp_authenticator_1.TotpAuthenticatorDescriptor;
|
|
23
|
+
}
|
|
24
|
+
async findVerifiedByUserId(params) {
|
|
25
|
+
const { nodeName, labelName } = this.descriptor.model;
|
|
26
|
+
const query = this.neo4j.initQuery({ serialiser: this.descriptor.model });
|
|
27
|
+
query.queryParams = { userId: params.userId };
|
|
28
|
+
query.query = `
|
|
29
|
+
MATCH (user:User {id: $userId})-[:HAS_TOTP_AUTHENTICATOR]->(${nodeName}:${labelName})
|
|
30
|
+
WHERE ${nodeName}.verified = true
|
|
31
|
+
RETURN ${nodeName}
|
|
32
|
+
ORDER BY ${nodeName}.createdAt DESC
|
|
33
|
+
`;
|
|
34
|
+
return this.neo4j.readMany(query);
|
|
35
|
+
}
|
|
36
|
+
async findByIdForUser(params) {
|
|
37
|
+
const { nodeName, labelName } = this.descriptor.model;
|
|
38
|
+
const query = this.neo4j.initQuery({ serialiser: this.descriptor.model });
|
|
39
|
+
query.queryParams = { authenticatorId: params.authenticatorId };
|
|
40
|
+
query.query = `
|
|
41
|
+
MATCH (${nodeName}:${labelName} {id: $authenticatorId})
|
|
42
|
+
RETURN ${nodeName}
|
|
43
|
+
`;
|
|
44
|
+
return this.neo4j.readOne(query);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Returns authenticator with secret for internal TOTP validation.
|
|
48
|
+
* Note: TotpAuthenticator type includes secret - excludeFromJsonApi only affects API responses.
|
|
49
|
+
*/
|
|
50
|
+
async findByIdWithSecret(params) {
|
|
51
|
+
const { nodeName, labelName } = this.descriptor.model;
|
|
52
|
+
const query = this.neo4j.initQuery({ serialiser: this.descriptor.model });
|
|
53
|
+
query.queryParams = { authenticatorId: params.authenticatorId };
|
|
54
|
+
query.query = `
|
|
55
|
+
MATCH (${nodeName}:${labelName} {id: $authenticatorId})
|
|
56
|
+
RETURN ${nodeName}
|
|
57
|
+
`;
|
|
58
|
+
return this.neo4j.readOne(query);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Returns all verified authenticators with secrets for internal TOTP validation.
|
|
62
|
+
* Note: TotpAuthenticator type includes secret - excludeFromJsonApi only affects API responses.
|
|
63
|
+
*/
|
|
64
|
+
async findAllByUserIdWithSecrets(params) {
|
|
65
|
+
const { nodeName, labelName } = this.descriptor.model;
|
|
66
|
+
const query = this.neo4j.initQuery({ serialiser: this.descriptor.model });
|
|
67
|
+
query.queryParams = { userId: params.userId };
|
|
68
|
+
query.query = `
|
|
69
|
+
MATCH (user:User {id: $userId})-[:HAS_TOTP_AUTHENTICATOR]->(${nodeName}:${labelName})
|
|
70
|
+
WHERE ${nodeName}.verified = true
|
|
71
|
+
RETURN ${nodeName}
|
|
72
|
+
`;
|
|
73
|
+
return this.neo4j.readMany(query);
|
|
74
|
+
}
|
|
75
|
+
async createForUser(params) {
|
|
76
|
+
const { nodeName, labelName } = this.descriptor.model;
|
|
77
|
+
const query = this.neo4j.initQuery({ serialiser: this.descriptor.model });
|
|
78
|
+
query.queryParams = {
|
|
79
|
+
authenticatorId: params.authenticatorId,
|
|
80
|
+
userId: params.userId,
|
|
81
|
+
name: params.name,
|
|
82
|
+
secret: params.secret,
|
|
83
|
+
verified: params.verified ?? false,
|
|
84
|
+
};
|
|
85
|
+
query.query = `
|
|
86
|
+
MATCH (user:User {id: $userId})
|
|
87
|
+
CREATE (${nodeName}:${labelName} {
|
|
88
|
+
id: $authenticatorId,
|
|
89
|
+
name: $name,
|
|
90
|
+
secret: $secret,
|
|
91
|
+
verified: $verified,
|
|
92
|
+
createdAt: datetime(),
|
|
93
|
+
updatedAt: datetime()
|
|
94
|
+
})
|
|
95
|
+
CREATE (user)-[:HAS_TOTP_AUTHENTICATOR]->(${nodeName})
|
|
96
|
+
RETURN ${nodeName}
|
|
97
|
+
`;
|
|
98
|
+
return this.neo4j.writeOne(query);
|
|
99
|
+
}
|
|
100
|
+
async updateAuthenticator(params) {
|
|
101
|
+
const { nodeName, labelName } = this.descriptor.model;
|
|
102
|
+
const query = this.neo4j.initQuery({ serialiser: this.descriptor.model });
|
|
103
|
+
const setClauses = [`${nodeName}.updatedAt = datetime()`];
|
|
104
|
+
query.queryParams = { authenticatorId: params.authenticatorId };
|
|
105
|
+
if (params.verified !== undefined) {
|
|
106
|
+
setClauses.push(`${nodeName}.verified = $verified`);
|
|
107
|
+
query.queryParams.verified = params.verified;
|
|
108
|
+
}
|
|
109
|
+
if (params.lastUsedAt !== undefined) {
|
|
110
|
+
setClauses.push(`${nodeName}.lastUsedAt = datetime($lastUsedAt)`);
|
|
111
|
+
query.queryParams.lastUsedAt = params.lastUsedAt.toISOString();
|
|
112
|
+
}
|
|
113
|
+
query.query = `
|
|
114
|
+
MATCH (${nodeName}:${labelName} {id: $authenticatorId})
|
|
115
|
+
SET ${setClauses.join(", ")}
|
|
116
|
+
RETURN ${nodeName}
|
|
117
|
+
`;
|
|
118
|
+
return this.neo4j.writeOne(query);
|
|
119
|
+
}
|
|
120
|
+
async deleteAuthenticator(params) {
|
|
121
|
+
const { nodeName, labelName } = this.descriptor.model;
|
|
122
|
+
const query = this.neo4j.initQuery();
|
|
123
|
+
query.queryParams = { authenticatorId: params.authenticatorId };
|
|
124
|
+
query.query = `
|
|
125
|
+
MATCH (${nodeName}:${labelName} {id: $authenticatorId})
|
|
126
|
+
DETACH DELETE ${nodeName}
|
|
127
|
+
`;
|
|
128
|
+
await this.neo4j.writeOne(query);
|
|
129
|
+
}
|
|
130
|
+
async deleteAllByUserId(params) {
|
|
131
|
+
const { nodeName, labelName } = this.descriptor.model;
|
|
132
|
+
const query = this.neo4j.initQuery();
|
|
133
|
+
query.queryParams = { userId: params.userId };
|
|
134
|
+
query.query = `
|
|
135
|
+
MATCH (user:User {id: $userId})-[:HAS_TOTP_AUTHENTICATOR]->(${nodeName}:${labelName})
|
|
136
|
+
DETACH DELETE ${nodeName}
|
|
137
|
+
`;
|
|
138
|
+
await this.neo4j.writeOne(query);
|
|
139
|
+
}
|
|
140
|
+
async countVerifiedByUserId(params) {
|
|
141
|
+
const { labelName } = this.descriptor.model;
|
|
142
|
+
const result = await this.neo4j.read(`MATCH (user:User {id: $userId})-[:HAS_TOTP_AUTHENTICATOR]->(t:${labelName})
|
|
143
|
+
WHERE t.verified = true
|
|
144
|
+
RETURN count(t) as count`, { userId: params.userId });
|
|
145
|
+
if (result.records.length === 0)
|
|
146
|
+
return 0;
|
|
147
|
+
const count = result.records[0].get("count");
|
|
148
|
+
return count?.toNumber ? count.toNumber() : Number(count) || 0;
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
exports.TotpAuthenticatorRepository = TotpAuthenticatorRepository;
|
|
152
|
+
exports.TotpAuthenticatorRepository = TotpAuthenticatorRepository = __decorate([
|
|
153
|
+
(0, common_1.Injectable)(),
|
|
154
|
+
__metadata("design:paramtypes", [neo4j_service_1.Neo4jService, security_service_1.SecurityService, nestjs_cls_1.ClsService])
|
|
155
|
+
], TotpAuthenticatorRepository);
|
|
156
|
+
//# sourceMappingURL=totp-authenticator.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"totp-authenticator.repository.js","sourceRoot":"","sources":["../../../../src/foundations/two-factor/repositories/totp-authenticator.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC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AAC,KAAK,CAAC;QAC5C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAClC,iEAAiE,SAAS;;gCAEhD,EAC1B,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAC1B,CAAC;QAEF,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,CAAC,CAAC;QAC1C,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC7C,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACjE,CAAC;CACF,CAAA;AA/JY,kEAA2B;sCAA3B,2BAA2B;IADvC,IAAA,mBAAU,GAAE;qCAOQ,4BAAY,EAAmB,kCAAe,EAAc,uBAAU;GAN9E,2BAA2B,CA+JvC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
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 { TwoFactorConfig, TwoFactorConfigDescriptor } from "../entities/two-factor-config";
|
|
6
|
+
export declare class TwoFactorConfigRepository extends AbstractRepository<TwoFactorConfig, typeof TwoFactorConfigDescriptor.relationships> {
|
|
7
|
+
protected readonly descriptor: import("../../..").EntityDescriptor<TwoFactorConfig, {}>;
|
|
8
|
+
constructor(neo4j: Neo4jService, securityService: SecurityService, clsService: ClsService);
|
|
9
|
+
findByUserId(params: {
|
|
10
|
+
userId: string;
|
|
11
|
+
}): Promise<TwoFactorConfig | null>;
|
|
12
|
+
createForUser(params: {
|
|
13
|
+
configId: string;
|
|
14
|
+
userId: string;
|
|
15
|
+
isEnabled?: boolean;
|
|
16
|
+
preferredMethod?: string;
|
|
17
|
+
}): Promise<TwoFactorConfig>;
|
|
18
|
+
updateByUserId(params: {
|
|
19
|
+
userId: string;
|
|
20
|
+
isEnabled?: boolean;
|
|
21
|
+
preferredMethod?: string;
|
|
22
|
+
backupCodesCount?: number;
|
|
23
|
+
}): Promise<TwoFactorConfig>;
|
|
24
|
+
deleteByUserId(params: {
|
|
25
|
+
userId: string;
|
|
26
|
+
}): Promise<void>;
|
|
27
|
+
getOrCreate(params: {
|
|
28
|
+
userId: string;
|
|
29
|
+
configId: string;
|
|
30
|
+
}): Promise<TwoFactorConfig>;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=two-factor-config.repository.d.ts.map
|